tce-load -i compiletc cmake libxml2-dev libffi-dev ninja zstd-dev wget https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/llvm-15.0.7.src.tar.xz wget https://anduin.linuxfromscratch.org/BLFS/llvm/llvm-cmake-15.0.7.src.tar.xz wget https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang-15.0.7.src.tar.xz wget https://www.linuxfromscratch.org/patches/blfs/svn/clang-15.0.7-enable_default_ssp-1.patch wget https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/compiler-rt-15.0.7.src.tar.xz cd llvm-15.0.7.src tar -xf ../llvm-cmake-15.0.7.src.tar.xz sed '/LLVM_COMMON_CMAKE_UTILS/s@../cmake@cmake-15.0.7.src@' -i CMakeLists.txt tar -xf ../clang-15.0.7.src.tar.xz -C tools mv tools/clang-15.0.7.src tools/clang tar -xf ../compiler-rt-15.0.7.src.tar.xz -C projects mv projects/compiler-rt-15.0.7.src projects/compiler-rt grep -rl '#!.*python' | xargs sed -i '1s/python$/python3/' patch -Np2 -d tools/clang <../clang-15.0.7-enable_default_ssp-1.patch mkdir build cd build cmake -LAH -DCMAKE_C_FLAGS_RELEASE="-mtune=generic -Os -pipe" CC="gcc" CXX="g++" -DCMAKE_CXX_FLAGS_RELEASE="-mtune=generic -Os -pipe" -DCMAKE_INSTALL_PREFIX=/usr/local -DLLVM_ENABLE_FFI=ON -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_TARGETS_TO_BUILD="host;AMDGPU;BPF" -DLLVM_BINUTILS_INCDIR=/usr/local/include -DLLVM_INCLUDE_BENCHMARKS=OFF -DCLANG_DEFAULT_PIE_ON_LINUX=ON -DCMAKE_VERBOSE_MAKEFILE=TRUE -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_LIBEXECDIR=lib/clang -Wno-dev -G Ninja ../ [static libs huge with -flto] find . -name flags.make -type f -exec sed -i 's/ -O3 -g//g' {} \; find . -name flags.make -type f -exec sed -i 's/ -O3//g' {} \; find . -name link.txt -type f -exec sed -i 's/-Wl,-O3/-Wl -Os/g' {} \; find . -name AddLLVM.cmake -type f -exec sed -i 's/-Wl,-O3/-Wl,-Os/g' {} \; find . -name compile_commands.json -type f -exec sed -i 's/ -O3 -g//g' {} \; find . -name build.make -type f -exec sed -i 's/ -O3 -g//g' {} \; ninja [2h 15m 09s] sudo ninja install sudo cp bin/FileCheck /usr/local/bin sudo mkdir /usr/local/lib/bfd-plugins cd /usr/local/lib/bfd-plugins sudo ln -s ../LLVMgold.so ./ [links against ncursesw without ncursesw-dev]