Open vlisivka opened 6 years ago
You should probably file this against the clang-sys crate upstream. Meanwhile you can workaround it with LIBCLANG_PATH I'd think.
LIBCLANG_PATH solves my problem. (BTW: can I set it from build.rs?)
Can you update bindgen to point to LIBCLANG_PATH variable when libclang is failed to load, please? It will save some time for a next person with the same problem.
I don't see any reason why setting it with env::set_var
wouldn't be feasible.
Looks like clang-sys doesn't offer another way from loading the lib from a different place... Maybe requesting one would allow a nicer API...
In any case, sure, I agree mentioning it on the docs would be great... Not sure what the best wording for it should be... Perhaps you'd be interested in suggesting one or submitting a PR?
Thanks!
bindgen may found wrong libclang and then fail to open it. For example, on x86_64 arch it may found libclang.so in /usr/lib for i686 arch and then fails.
To test, install clang for both i686 and x86_64 on same machine. It expected, that bindgen is able to compile code for both i686 target and x86_64 target. In reality, bindgen fails when it founds library for wrong architecture.
--- stdout cargo:rustc-link-search=native=/usr/local/lib64
--- stderr thread 'main' panicked at 'Unable to find libclang: "the
libclang
shared library could not be opened: /usr/lib/libclang.so"', libcore/result.rs:945:5 note: Run withRUST_BACKTRACE=1
for a backtrace.