You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The compiler reports which version of LLVM it was built with on crystal --version. The source of that is LibLLVM::VERSION which is baked in at compile time. It's the version of LLVM that the compiler is linked against.
But when running the binary and libllvm is loaded from a shared library, the library migth actually be a different version. Not too different because it needs to be binary compatible. But there's some wiggle room. A difference in the patch version is entirely possible, for example.
The issue was first reported on discord by @JarnaChao09 who had crystal installed from homebrew, which is linked against llvm from homebrew. Yet llvm-config --version and crystal --version disagreed, showing 19.1.7 and 19.1.6, respectively. The cause for this must be that crystal was built with 19.1.6, but in the mean time the library has been updated to 19.1.7. The compiler still works with the new version, but reports the wrong version number.
This behaviour is surprising and unexpected. I'd expect the version information to show which version of LLVM the compiler actually uses. Not which one happend to be available when it was linked.
The function LLVMGetVersion is available since LLVM 16.0 and makes it possible to query the version at runtime.
For earlier versions we could consider exposing the function in libllvm_ext. But I'm not sure that's worth it. We should rather be phasing out older LLVM versions.
The text was updated successfully, but these errors were encountered:
The compiler reports which version of LLVM it was built with on
crystal --version
. The source of that isLibLLVM::VERSION
which is baked in at compile time. It's the version of LLVM that the compiler is linked against.But when running the binary and libllvm is loaded from a shared library, the library migth actually be a different version. Not too different because it needs to be binary compatible. But there's some wiggle room. A difference in the patch version is entirely possible, for example.
The issue was first reported on discord by @JarnaChao09 who had crystal installed from homebrew, which is linked against llvm from homebrew. Yet
llvm-config --version
andcrystal --version
disagreed, showing19.1.7
and19.1.6
, respectively. The cause for this must be that crystal was built with 19.1.6, but in the mean time the library has been updated to 19.1.7. The compiler still works with the new version, but reports the wrong version number.This behaviour is surprising and unexpected. I'd expect the version information to show which version of LLVM the compiler actually uses. Not which one happend to be available when it was linked.
The function
LLVMGetVersion
is available since LLVM 16.0 and makes it possible to query the version at runtime.For earlier versions we could consider exposing the function in
libllvm_ext
. But I'm not sure that's worth it. We should rather be phasing out older LLVM versions.The text was updated successfully, but these errors were encountered: