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

clang-sys should try harder to use libllvm corresponding to the libclang it loads #89

Closed
glandium opened this issue Mar 26, 2019 · 3 comments

Comments

@glandium
Copy link

See https://bugzilla.mozilla.org/show_bug.cgi?id=1536486 for context.

rust-lang/rust#59173 only papers over the issue, and there are other creative ways for things to go wrong even if rust somehow makes things better.

clang-sys is manually loading libclang, it should ensure that the right corresponding libllvm is used.

@KyleMayes
Copy link
Owner

I don't really understand the problem or what I can do to help.

clang-sys only links to LLVM libraries when linking statically.
When linking dynamically (the default for rust-bindgen), the only linked library is the libclang shared library.

Is there some issue caused by conflicts between dynamically linked instances of libclang and the version of LLVM used by the compiler?

@glandium
Copy link
Author

The problem is that cargo sets some environment variable that makes the dynamic linker find rust's libLLVM instead of the one that comes with libclang, and when you're lucky, that works, but when you're not, things break.

@glandium
Copy link
Author

glandium commented Apr 11, 2019

There's unfortunately nothing that can be done here, short of adding dependencies on crates that can analyze binaries and check what libraries they depend upon. That would almost amount to writing a custom linker, which sounds crazy.

It turns out everything would work fine if rustup wasn't setting DYLD_LIBRARY_PATH, so once rust-lang/rustup#1752 is merged/shipped, it should be less necessary to fix this issue.

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

2 participants