Last active
June 3, 2022 02:31
-
-
Save unhammer/41f2e89a6b9ba36fbe8992315ae860e7 to your computer and use it in GitHub Desktop.
Linking with lld on Ubuntu/Debian in CMake projects (or gold in automake projects)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt install binutils | |
cd ~/src/an_autotools_project | |
export CXXFLAGS='-fuse-ld=gold' | |
export CFLAGS='-fuse-ld=gold' | |
./configure | |
make -j4 # no longer wait for linking! =D | |
# gcc doesn't support -fuse-ld=lld http://gcc.gnu.org/ml/gcc-patches/2016-07/msg00145.html :( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt install lld-4.0 | |
sudo ln -s /usr/bin/ld.lld-4.0 /usr/bin/ld.lld # Why doesn't Debian put this in /etc/alternatives by default? | |
cd ~/src/a_cmake_project | |
./cmake.sh -DCMAKE_C_FLAGS="-fuse-ld=lld" -DCMAKE_CXX_FLAGS="-fuse-ld=lld" | |
make -j4 # no longer wait for linking! =D |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment