I’m using Rust with Inkwell which requires me to install LLVM. To make it an all-in-one build process I setup a GitHub action to build LLVM, then wrote a buildscript to download LLVM. The LLVM build is simple, running at https://github.com/BigBadE/LLVMBinaryBuilder/ on github actions with default build arguments. Since llvm-sys (the llvm library) uses an environmental variable to find LLVM and I can’t guarantee I set it before it runs the buildscript, I manually link against LLVM myself.
The current build script that does the linking can be found at https://github.com/BigBadE/Raven-Language/blob/2aa287e55d379db615f312d8d568c74e134370b9/language/compilers/llvm/build.rs, but from the output of runs I can tell it outputs the correct linker args.
This build system results in a variety of different results despite being the same on every platform:
- MacOS Aarch64 and local Ubuntu builds: “ld: library ‘zstd’ not found”. Installing zstd with ‘sudo apt-get install zstd’ or ‘brew install zstd’ doesn’t fix this issue
- MacOS x86 (MacOS 13): Works without issue
- Windows: “rust-lld: error: truncated or malformed archive (string table at long name offset 576not terminated)” when trying to compile with the LLVM-linked library
- Ubuntu (remote): Linker fails to find a few methods, specifically in the ExecutionEngine. “LLVMCreateJITCompilerForModule”, “LLVM_InitializeNativeTarget”, “LLVM_InitializeNativeAsmPrinter”, “LLVM_InitializeNativeAsmParser”, “LLVM_InitializeNativeDisassembler”, “LLVMDisposeTargetData”, “LLVMGetExecutionEngineTargetData”, “LLVMGetFunctionAddress”, and “LLVMDisposeExecutionEngine” are all unable to be found despite the linker flag for the ExecutionEngine lib being in the output. It’s important to note most of LLVM gets linked correctly, the other ~600 functions get found, it’s just these that fail.
I figure these errors are separate, but them being platform-specific seems like important context to the overall issue. Is there something I’m doing wrong with building the binaries, or is the linker causing the issue?