Open JohnClaw opened 2 months ago
I find the same behaviour on Windows 10.
StaticCompiler.jl on Windows would be incredibly useful for me. I am not competent to help with compiling, alas.
The code causing the problem is here, \c should be /c:
I made the change (on my machine) as @bluebug suggests, and this causes an error (which actually means progress):
'clang' is not recognized as an internal or external command, operable program or batch file.
I assume clang is a C compiler.
Do I already have clang installed with Julia and/or StaticCompiler.jl and I need to do something to make CMD know about it, or is clang not a part of the installation, and I have to install clang myself?
I made the change (on my machine) as @bluebug suggests, and this causes an error (which actually means progress):
'clang' is not recognized as an internal or external command, operable program or batch file.
I assume clang is a C compiler.
Do I already have clang installed with Julia and/or StaticCompiler.jl and I need to do something to make CMD know about it, or is clang not a part of the installation, and I have to install clang myself?
I'm using clang.exe from preinstalled llvm and add "C:\Program Files\LLVM\bin" into windows paths.
clang --version
clang version 17.0.6
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin
maybe you can find clang.exe from the path "C:\Users\yourname\.julia\artifacts"
The problem is in the function generate_executable()
of StaticCopmiler.jl in the line
cmd \c clang # Not clear ...
It must be
cmd /c clang
It is kind of a typo that was unfortunately integrated.
The clang.exe in the artifacts does not work for Windows, as pointed out in https://github.com/JuliaPackaging/Yggdrasil/issues/8015 There are versions of clang that work for Windows. They have to be integrated into the Clang_jll - package, i.e. into the artifacts.
Hi @Thomas008.
First, thank you for developping StaticCompiler, that's a very important work.
From JuliaPackaging/Yggdrasil#8015, I get the impression you have a workaround, using a local clang installation.
If that is the case, a "how to" (starting from installing clang) would be very valuable. Do you get an executable from releases.llvm.org ? Do we need to install LLVM or just Clang...?
Hi @PhilippeMaincon
thank you! Just a correction: I did not develop StaticCompiler, but adapt it to Windows. Yes, I did a workaround.
First you would add the package StaticCompiler. However, the file StaticCompiler.jl has still a small bug:
The line must be cmd /c clang
(instead of cmd \c clang
) as mentioned above.
Second, you need a clang that works for Windows. You probably don't need the whole LLVM project, only clang. The clang versions I used for Windows are e.g. on
https://github.com/llvm/llvm-project/releases/tag/llvmorg-17.0.5
and
https://github.com/mstorsjo/llvm-mingw/releases
However, we want to have repaired the clang in the artifact of the package Clang_jll,
such that in StaticCompiler.jl
one can use the function clang()
provided by the package Clang_jll
instead of applying cmd /c clang
.
I typed intsructions from readme:
using StaticCompiler, StaticTools hello() = println(c"Hello, world!") compile_executable(hello, (), "c:/binary")