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: dlls not found #9585

Open
Thomas008 opened this issue Oct 9, 2024 · 8 comments
Open

Clang: dlls not found #9585

Thomas008 opened this issue Oct 9, 2024 · 8 comments

Comments

@Thomas008
Copy link

When calling clang.exe in the artifact, error messages occur that some dll's are not found. They are neither in the tools-directory, nor in the bin-directory. More specific the following dll's are not found:
libclang-cpp.dll, libLLVM-15jl.dll, libstdc++-6.dll.
At least libclang-cpp.dll is in the bin-directory. But libLLVM-15jl.dllandlibstdc++-6.dll` are not there.
Do you have any suggestions, how to repair this? Does Clang_jll not provide these dll's?

@giordano
Copy link
Member

giordano commented Oct 9, 2024

When calling clang.exe in the artifact

How are you calling it? Be sure to read https://docs.binarybuilder.org/stable/jll/#ExecutableProduct very carefully before answering.

@giordano
Copy link
Member

giordano commented Oct 9, 2024

Also, duplicate of #8015?

@Thomas008
Copy link
Author

It is similar to 8015, but much more specific (see above). The issue, that clang in the artifact does not seem to work, has not been solved.

@maleadt
Copy link
Contributor

maleadt commented Nov 8, 2024

The clang.exe binaries work fine, I've been using them in combination with PoCL successfully. The problem is likely that either you're executing them without setting-up PATH to include the dependencies of the JLL, or that you're using a mismatched version of LLVM (it's Julia providing libLLVM-XXjl.dll, the current design disallows using anything except the version of Clang_jll.jl that exactly matches the LLVM version used by your Julia build, unless you're using LLVM_full_jll.jl which includes the library too). See

function generate_wrapper_script(name, path, LIBPATH, PATH)
if Sys.iswindows()
LIBPATH_env = "PATH"
LIBPATH_default = ""
pathsep = ';'
elseif Sys.isapple()
LIBPATH_env = "DYLD_FALLBACK_LIBRARY_PATH"
LIBPATH_default = "~/lib:/usr/local/lib:/lib:/usr/lib"
pathsep = ':'
else
LIBPATH_env = "LD_LIBRARY_PATH"
LIBPATH_default = ""
pathsep = ':'
end
# XXX: cache, but invalidate when deps change
script = joinpath(bindir, name)
if Sys.isunix()
open(script, "w") do io
println(io, "#!/bin/bash")
LIBPATH_base = get(ENV, LIBPATH_env, expanduser(LIBPATH_default))
LIBPATH_value = if !isempty(LIBPATH_base)
string(LIBPATH, pathsep, LIBPATH_base)
else
LIBPATH
end
println(io, "export $LIBPATH_env=\\"$LIBPATH_value\\"")
if LIBPATH_env != "PATH"
PATH_base = get(ENV, "PATH", "")
PATH_value = if !isempty(PATH_base)
string(PATH, pathsep, ENV["PATH"])
else
PATH
end
println(io, "export PATH=\\"$PATH_value\\"")
end
println(io, "exec \\"$path\\" \\"\$@\\"")
end
chmod(script, 0o755)
else
error("Unsupported platform")
end
return script
end
ENV["POCL_PATH_SPIRV_LINK"] =
generate_wrapper_script("spirv_link", SPIRV_Tools_jll.spirv_link_path,
SPIRV_Tools_jll.LIBPATH[], SPIRV_Tools_jll.PATH[])
ENV["POCL_PATH_CLANG"] =
generate_wrapper_script("clang", Clang_unified_jll.clang_path,
Clang_unified_jll.LIBPATH[], Clang_unified_jll.PATH[])
, and how that uses Clang_unified_jll.jl to automatically select a compatible version.

@fingolfin
Copy link
Member

@Thomas008 can you describe how exactly you are invoking clang? Ideally with code that we can use to reproduce the issue.

Or perhaps the issue is indeed as suggested and you did not follow https://docs.binarybuilder.org/stable/jll/#ExecutableProduct ?

@Thomas008
Copy link
Author

I tried to call invoke clang diretly in the directory artifact (in the subdirectory tools) with e.g.
clang.exe -v
Versions of clang I downloaded from e.g.
https://github.com/llvm/llvm-project/releases/tag/llvmorg-17.0.5
work fine,

The version of clang in the artifact puts the error message that the following dlls are not found:

libclang-cpp.dll
libLLVM-15jl.dll
libstdc++-6.dll

When I copy all dll from the downloaded clang into the subdirectory tools of the artifact, then the clang.exe works fine.

@maleadt
Copy link
Contributor

maleadt commented Nov 25, 2024

I tried to call invoke clang diretly in the directory artifact

Don't do that. JLLs aren't meant to be used that way. See #9585 (comment)

Instead, do:

julia> run(`$(Clang_jll.clang()) --version`);
clang version 16.0.6 (/cache/yggdrasil/downloads/clones/llvm-project.git-5a9787eb535c2edc5dea030cc221c1d60f38c9f42344f410e425ea2139e233aa 499f87882a4ba1837ec12a280478cf4cb0d2753d)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/tim/.julia/artifacts/e9aa081a3c28bdace800f92312f1212f6ec1921f/tools

@Thomas008
Copy link
Author

Thomas008 commented Nov 30, 2024

Doing

 run(`$(Clang_jll.clang()) --version`);

gives the error message

ERROR: failed process: Process(setenv('C:\Users\T460\.julia\artifacts\7d2877da43b3fef993c8488c267bb543f27414f8\tools\clang.exe' --version,["WINDIR=C:\Windows", "PATH=C:\Users\T460\.julia\juliaup\julia-1.10.6+0.x64.w64.mingw32\bin;C:\Users\T460\.julia\juliaup\julia-1.10.6+0.x64.w64.mingw32\bin\..\lib\julia;C:\Users\T460\.julia\juliaup\julia-1.10.6+0.x64.w64.mingw32\bin\..\lib;C:\Users\T460\.julia\juliaup\julia-1.10.6+0.x64.w64.mingw32\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\mingw-w64-v9.0.0\mingw-w64-libraries;C:\MinGW;C:\Program Files\CMake\bin;C:\mingw-w64_packagecompiler\bin;C:\Users\T460\.julia\juliaup\julia-1.10.6+0.x64.w64.mingw32\bin;C:\Ruby27-x64\bin;C:\Users\T460\AppData\Local\Microsoft\WindowsApps;C:\Users\T460\.dotnet\tools;C:\mingw-w64_packagecompiler\bin;C:\llvm-mingw-20231031-ucrt-x86_64\bin;C:\Users\T460\.julia\juliaup\julia-1.10.6+0.x64.w64.mingw32\bin;", "USERDOMAIN_ROAMINGPROFILE=DESKTOP-0RMUE7S", "ZES_ENABLE_SYSMAN=1", "LOCALAPPDATA=C:\Users\T460\AppData\Local", "HOMEPATH=\Users\T460", "PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 78 Stepping 3, GenuineIntel", "NUMBER_OF_PROCESSORS=4", "PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.RB;.RBW", "SESSIONNAME=Console" … "FPS_BROWSER_USER_PROFILE_STRING=Default", "PROCESSOR_LEVEL=6", "SYSTEMDRIVE=C:", "=C:=C:\Users\T460", "FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer", "PROGRAMW6432=C:\Program Files", "TEMP=C:\Users\T460\AppData\Local\Temp", "HOMEDRIVE=C:", "OPENBLAS_MAIN_FREE=1", "PROCESSOR_ARCHITECTURE=AMD64"]), ProcessExited(3221225785)) [3221225785]

Downloading clang from e.g.
https://github.com/llvm/llvm-project/releases/tag/llvmorg-17.0.4
and copying from there the clang.exe and dll's into the sub-directory tools
of the artifacts-directory works when doing run(`$(Clang_jll.clang()) --version`);

This leads me to the conclusion that at least for Windows the clang of Clang_jll does not work.

I use julia 1.10.6. The clang version that Clang_jll provides in the artifact directory seems to be clang-15.
As mentioned above, e.g. the dll libLLVM-15jl.dll is not in the artifact (neither in bin nor in tools).

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

4 participants