Config requirements for LLVM bindings #14376
Labels
platform:unix
platform:windows
Windows support based on the MSVC toolchain / Win32 API
status:discussion
topic:stdlib:llvm
The bindings for
libllvm
have some specific requirements for discovering LLVM configuration. The details differ between Unix and Windows, but either way they expect a specific setup and the availability ofllvm-config
orllvm_VERSION
(the latter is only provided for the packaged libllvm in the Crystal package on Windows).This all works for the most common use cases. But there are serious challenges for more advanced use cases such as cross-compiling, targeting a non-default LLVM version, or just doing semantic analysis without codegen.
For example, when cross-compiling the LLVM bindings from a Unix-like system to Windows, compilation fails due to missing
llvm_VERSION
file:It's not possible to explicitly set
$LLVM_VERSION
or$LLVM_CONFIG
, they'll just get ignored.$LLVM_CONFIG
of course could only work if an approriatellvm-config
is available. Cross-compiling from Windows to Unix, this wouldn't be the case, for example.I think this should all work without special requirements and I can't see a reason why it couldn't be possible to pass in all the necessary information explicitly.
We should also consider what information is really needed for the llvm bindings.
llvm_VERSION
currently provides the version, build targets and ldflags. On Unix-like sytems, the same information is retrieved fromllvm-config
As far as I can see, only the LLVM version is strictly required. We need it in order to target the correct API version.
Build targets could assume just the current target if no other information is available.
Linker flags are potentially irrelevant when cross-compiling, so it shouldn't be a show-stopper if they're missing. You can always provide them on the command line explicitly.
So I think we should make it that the LLVM bindings work (for both Unix and Windows) when only
$LLVM_VERSION
is provided and neitherllvm_VERSION
norllvm-config
are available.The text was updated successfully, but these errors were encountered: