I'm trying to link against LLVM from Rust using the llvm-sys crate. The problem is, linking against all of LLVM 18.1 using the default build flags results in a 4.8 GB rlib, which has the SYM32 symbol table and isn't supported, meaning I have to lower the binary size below 4GB. I tried disabling the low hanging fruit like LLVM examples, benchmarks, etc... in the build, but since I'm only linking against libs that changed nothing. The build is in release mode, so it isn't debug symbols inflating the build, just following the default LLVM build steps with no other projects enabled. Is there something I'm doing majorly wrong to cause this?
Try building with MinSizeRel
instead of Release
mode.
cmake ... -D CMAKE_BUILD_TYPE=MinSizeRel --fresh
cmake --build ... --config MinSizeRel --clean-first
cmake --install ... --config MinSizeRel