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

bzlmod + golang + cgo = undefined symbols #4180

Open
bdleitner opened this issue Nov 25, 2024 · 1 comment
Open

bzlmod + golang + cgo = undefined symbols #4180

bdleitner opened this issue Nov 25, 2024 · 1 comment

Comments

@bdleitner
Copy link

What version of rules_go are you using?

0.50.1

What version of gazelle are you using?

0.38.0

What version of Bazel are you using?

7.4.1

Does this issue reproduce with the latest releases of all the above?

I believe I am on the latest for all these.

What operating system and processor architecture are you using?

Windows 10 64-bit

Any other potentially useful information about your toolchain?

I admit I am not sure I have everything correctly set up. I have mingw-64 within msys2 on my system. I've been unable to find from-scratch documentation to make sure my setup is fully cgo-ready so if there is documentation for this that would reveal I've missed something, a pointer to that would be appreciated.

What did you do?

I attempted first to have my bzlmod monolith repo depend on a library (gosseract) that uses cgo. When that failed I also tried just implementing an example cgo library.

golang_bzlmod_demo has minimal examples of all the issues I've had with golang/bzlmod that I've been able to repro. The cgoimport and cgo subprojects illustrate the import failure and the self-contained failure, respectively. The specific errors I see are shown in the README files there.

What did you expect to see?

I expected the code to compile and to be able to use the library code.

What did you see instead?

The builds failed with "undefined" errors for every time a symbol in the cgo-using library was referenced.

@bdleitner
Copy link
Author

Looks like gazelle has v0.40.0 out. I wouldn't expect that to matter since the issue seems unrelated to gazelle, but just in case I tried changing the version to 0.40.0 locally and got all the same errors.

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

No branches or pull requests

1 participant