Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: Adds the static libraries from cgo_deps to the link command line #4134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

filmil
Copy link

@filmil filmil commented Oct 7, 2024

Not sure why this wasn't added here.

What type of PR is this?

Bug fix repro.
At least I think.

What does this PR do? Why is it needed?

It adds the .a libraries when linking a go program with C or C++ FFI archive.
I am not seeing why this is not being done when linking the binary.

An alternative is to add linkmode = "c-shared", or linkmode = "c-archive", but this is not correct if you want an actual executable, and not a library.

Which issues(s) does this PR fix?

Fixes #

Other notes for review

@fmeum
Copy link
Member

fmeum commented Oct 7, 2024

Could you add a test case that exercises this logic and fails without it? cgo is complicated enough that I wouldn't want to make a change without a test.

@filmil
Copy link
Author

filmil commented Oct 7, 2024

Sorry, this is not a polished fix. This just illustrates what seems to be a glaring omission in how cgo binaries are linked.
I am not 100% sure what the correct fix should be.
Do y'all have someone who's well versed in the innards of link.bzl who could advise?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants