BinaryBuild: build with a specific version of LLVM and clang


I would like to make the wrapit executable available through the BinaryBuilder facilities.

The code (C++) uses LLVM and clang. I can use the corresponding _jll packages. Nevertheless, I want to fix the version to the one the wrapit binary was tested with.

Using the _jll dependencies, I am bound to the LLVM version used by the julia application of the user: it won’t accept to install another libLLVM_jll version than the one Julia uses internally.

It should not be a problem to have the libLLVM and Clang artifacts of the desired version installed and use the libLLVM, libclang and libclang-cpp libraries they provide. Ideally I would like to have symbolic links to them in the lib directory of the wrapit binary artifact so wrapit can be executed without the complication of setting LD_LIBRARY_PATH.

What is the proper way to achieve this? Should I make a custom Wrapit_jll package, that will include libLLVM and libclang artifacts in its Artifact.toml file, to substitute the one produced by BinaryBuilder?


There are multiple LLVMs involved, so you have to be very clear about what you want: do you need only a cross-compiler toolchain to compile C/C++ code (clang) for the target platform, or you need to link your code to a libllvm built for the target platform? In the former case, you can control the version of llvm used by passing preferred_llvm_version="..." to the function build_tarballs, in the latter case you can have a single recipe producing multiple versions of a single package, linking each time to a different version of llvm: this is what the Enzyme recipe does, which currently produces builds compatible with libllvm 11-15.

Hello Mosè,

I am in the second situation. The code is using clang, itself using LLVM, to interpret c++ code. The versions of LLVM and clang are tight together.

I already had issues with differences between clang version and I don’t want to maintain and support different versions, neither to force to use a specific Julia version.

The idea would be to get the artifact containing the LLVM and clang libraries of the desired version installed independently of the version used by Julia itself. They should not interfere.


I’ve made a PR with the recipe. It is not perfect but it is working. Followup can be done in the PR discussion thread.