-
Notifications
You must be signed in to change notification settings - Fork 723
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
Undefined references for native library #1046
Comments
Is Aside: @emilio do you think we should move the tutorial into this repo to test it for breakage in CI and keep it up to date and all that? |
Yes, the dev package for bzip2 is installed via the package manager, apt-get.
and I can link to it with a C program:
|
That sounds fine to me. |
It appears that this may be due to the
If I manually remove them or comment them all out, then the tests seem to link and run properly, like:
Why is it mangling the names like that? Thanks |
Yep, same issue here, also because of wrong At home I have |
Rust doesn't use
The other thing to double check is that you have the |
OK. It looks like this might be the root cause of the issue. All of my Linux machines have multiple versions of clang, including 3.6, 3.8, and 3.9. Even the machine that "works" has v3.6, but for some reason it... works. The
So perhaps it is (somewhat inconsistently?) seeking the oldest I tried to see if I could set the Cargo features, but had no luck. Admittedly I have no idea what I'm doing. But if I set the
|
Yes, it appears that the old clang version is causing problems, although somewhat inconsistently which made it difficult to diagnose. This issue appears to be a repeat of #528, and possibly a few others. Setting LIBCLANG_PATH seems the correct fix, but this places a burden on users with a silent failure when things go wrong. There is even a work-around already in place for older clang's in the
I hope this is harmless if we're wrapping a straight C library, which shouldn't require mangling? I guess this issue can be closed, but it might be nice for bindgen to issue a warning on build if it detects a clang library that is unsupported. Thanks for the help and this awesome tool. |
libclang versioning is tricky, but we have hopes of eventually side-stepping the issue: #918
We do have a warning, but only in the executable, not in the library: https://github.com/rust-lang-nursery/rust-bindgen/blob/master/src/main.rs#L46 Would love to receive a PR that moves it somewhere shared by both the executable and library. |
I'm attempting to get the stock bindgen tutorial working from:
https://github.com/fitzgen/bindgen-tutorial-bzip2-sys
I have several Linux development machines running various flavors of Mint 17 & 18 (Ubuntu 14.04 and 16.04). The weird thing is that everything works fine on one machine, but on all the others machines, the linker is reporting undefined references in the native library whenever I try to create an executable.
This can be seen in an attempt to build and then run the tests for the tutorial:
I can't figure out why it's working on one computer but none of the others.
Thanks
The text was updated successfully, but these errors were encountered: