Closed saschanaz closed 2 years ago
This is probably because visual studio installs clang under C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\Llvm\\bin
. The path isn't on clang-sys's search list.
Is this where your clang is locally or are you using the distribution from LLVM which is stored at C:\\LLVM\\
?
I added the Visual Studio LLVM component directory to the search paths as part of the now released v1.1.0
.
I downloaded the Visual Studio LLVM component on my Windows machine and clang-sys
found that libclang
so hopefully this should remove the need to manually set LIBCLANG_PATH
for users relying on the VS LLVM component.
Well, my script installs LLVM by KyleMayes/install-llvm-action (your GH Action script 😉) so I don't think it's about Visual Studio.
Yes, I see that now.
I tunnel visioned on the mention of VS in a previous comment.
I think the solution is just to set LIBCLANG_PATH
like I do in the CI for this crate.
It probably shouldn't be necessary, but 🤷♂️ .
Could it try guessing by the global clang path, which is what my step does? 👀
clang-sys
should be finding it already because install-llvm-action
adds the installed directory to LD_LIBRARY_PATH
and clang-sys
searches LD_LIBRARY_PATH
.
Why this isn't working I don't know.
I'll reopen the issue since it is a bug that should be fixed but I can't guarantee I'll get around to investigating it in a timely fashion.
This also appears to be a problem on Azure Pipelines: https://github.com/mimblewimble/grin/pull/3596#issuecomment-801240927
I've partially fixed this problem (for dynamic linking but not runtime linking) in 1.2.0
:
First, I fixed my install-llvm-action
GitHub action to use the platform appropriate path delimiter (I was using :
always but Windows uses ;
) when updating LD_LIBRARY_PATH
with the path to the LLVM/Clang binaries: https://github.com/KyleMayes/install-llvm-action/commit/4609a7b44dbb15353bdb46dafaac2914948399c9
Second, I fixed this crate to properly split the paths in LD_LIBRARY_PATH
using the platform appropriate path delimiter (same as before, using :
when Windows uses ;
) when searching for Clang binaries: https://github.com/KyleMayes/clang-sys/commit/84b17dfe0c7ee5f05eb4dd3360f65d1bb148e470
I removed setting the environment variables in the CI YAML for this crate as a demonstration of clang-sys
being able to find the Clang binaries when linking dynamically after these changes. However, as reported in https://github.com/rust-lang/rust-bindgen/issues/1797, clang-sys
still attempts to link to an invalid MinGW libclang.so
instance when linking at runtime.
Not sure what's going on there, I'll try to take another crack at it this weekend.
I added the Visual Studio LLVM component directory to the search paths as part of the now released
v1.1.0
.I downloaded the Visual Studio LLVM component on my Windows machine and
clang-sys
found thatlibclang
so hopefully this should remove the need to manually setLIBCLANG_PATH
for users relying on the VS LLVM component.
On my Windows machine, the LLVM is by default installed into C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\Llvm
. Should we add this path too? I've googled a bit, but didn't find any documentation provided by Microsoft telling the standard location in where the bundled LLVM is installed.
It no longer seems necessary to set LIBCLANG_PATH
in GitHub actions that use Windows.
I was able to remove the last clang-sys
environment variable from this repository's CI action and it worked just fine (https://github.com/KyleMayes/clang-sys/commit/609d1c196f3ee621deb69590d9434ce69aeec7cd).
I'm going to close but if someone has a similar issue please open a new issue.
Background: https://github.com/rust-lang/rust-bindgen/issues/1797
I had to add this step:
... per the following line:
https://github.com/KyleMayes/clang-sys/blob/ddd3af568ed76a2af94bcc3a9fd06af8e00fec99/build/dynamic.rs#L149
It seems this is only problematic in GitHub Action, not sure why. It's not a problem in my Windows machine without that environment variable.
My current script: https://github.com/saschanaz/jxl-winthumb/blob/2fc12d454163c7096158f93b712ef9f51b6f1f4b/.github/workflows/ci.yml