-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[windows] Rust Bindgen does not work because libclang.dll could not be loaded #3316
Comments
Hi @wrenger! |
Hello @wrenger,
I've verified that it works fine for your test repo as well. Could you please check for your main project and provide feedback? |
Yes ok installing llvm and clang every time is a possible solution. However, I think because bindgen is already preinstalled in the virtual environment, it should also be functional. This is not the case if the clang and llvm libraries cannot be loaded. Also one of the comments suggests that the clang libraries already seem be installed as part of msys. Windows is, however, unable to load them because they have dependencies to other msys libraries ( |
Ok I also found the In this action I print the contents of Could you look into that? It would be great to simply use this preinstalled clang version. PS: I totally forgot to thank you about your fast and helpful response. Thanks 👍🏻 |
Hello @wrenger, |
Hello @Darleev, The solution of manually installing a new clang version and using it also works for my other projects. The installation adds an overhead of about 13-15s which is also not that bad. So now this is more a matter of ease of use. As a rust developer you have to know that bindgen does not work directly on windows. Additionally, bindgen is used by many other libraries, as it generates rust bindings for c apis, so the chance is fairly high to encounter this problem. |
@wrenger the reason of the problem is bindgen is compiled agains In order you build to pass you mast enforce cargo to use This can be done this way:
Unfortunately we can not set mingw clang default compiler and the right way to use github actions default compiler with bindgen is to request its support team to probvive bindgen binary compiled using Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Llvm.Clang |
@dsame Well I tried to set the path to mingw, but without success (3ac994a). And I also tried to use the Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Llvm.Clang in another repo by setting the LIBCLANG_PATH to the install location of Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Llvm.Clang (inside the Visual Studio folders) as described here. |
@wrenger i am sorry i forget to point the success build The problem you face relates to the strange behaviour of setx /m in actions - for some reason it does not make the change permanent. This is why i used |
Closing this issue due to no response in a while. Please, let us know if you have any concerns or the workaround doesn't work. Thanks. |
Description
Rusts bindgen build tool panics because libclang.dll cannot be opened.
Area for Triage:
Rust
Question, Bug, or Feature?:
Bug
Virtual environments affected
Image version
20210425.1
Expected behavior
It should be possible to use bindgen as (build) depenency to generate rust bindings for C APIs, similar to the linux and mac environments.
Actual behavior
Bindgen crashes because it cannot open libclang.dll:
Repro steps
Example Project, that uses bindgen:
https://github.com/wrenger/rust-ffi-test
Here the associated Action: https://github.com/wrenger/rust-ffi-test/actions/runs/812930118
The text was updated successfully, but these errors were encountered: