Skip to content

Instantly share code, notes, and snippets.

@larkwiot
Last active March 20, 2023 20:56
Show Gist options
  • Save larkwiot/357b8a821bb98c7faa84e10f9a24065f to your computer and use it in GitHub Desktop.
Save larkwiot/357b8a821bb98c7faa84e10f9a24065f to your computer and use it in GitHub Desktop.
yay -S bison flex
git clone --depth 1 git://sourceware.org/git/binutils-gdb.git binutils
mkdir build
cd build
../binutils/configure.sh --enable-gold --enable-plugins --disable-werror
make all-gold -j24
make all -j24
sudo cp gold/ld-new /usr/local/bin/ld.gold
sudo cp binutils/nm-new /usr/local/bin/nm
sudo cp binutils/ar /usr/local/bin/ar
cd ../..
git clone https://github.com/llvm/llvm-project
cd llvm-project
cmake --build . --target clean
# do NOT specify compiler-rt in BOTH projects and runtimes, or you will get duplicate custom target cmake errors
cmake -G Ninja -DCMAKE_C_COMPILER="/usr/bin/clang" -DCMAKE_CXX_COMPILER="/usr/bin/clang++" -DCMAKE_BUILD_TYPE="Release" -DLLVM_USE_LINKER=mold -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;libc;libclc;lld;lldb;pstl;flang" -DLLVM_ENABLE_RUNTIMES="libc;libunwind;libcxxabi;libcxx;compiler-rt;openmp" -DLLVM_ENABLE_LTO=Off -DLLVM_BUILD_DOCS=false -DLLVM_ENABLE_BINDINGS=false -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_BINUTILS_INCDIR=~/clones/binutils/binutils/include -DLLVM_BUILD_TESTS=false llvm/
cmake --build . -j24
# cmake --build . --target ocaml_doc
sudo cmake --install .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment