Created
January 19, 2026 22:41
-
-
Save orzklv/1bbe6a6f4d237e8d62b5113db790f49f to your computer and use it in GitHub Desktop.
LLVM as a benchmark suite
This file contains hidden or 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
| git clone https://github.com/llvm/llvm-project/ ./llvm | |
| cd llvm && vim shell.nix | |
| nix-shell | |
| mkdir -p ./build && cd ./build | |
| cmake $cmakeFlags -G Ninja ../llvm | |
| time ninja |
This file contains hidden or 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
| with import <nixpkgs> {}; | |
| let | |
| gccForLibs = stdenv.cc.cc; | |
| in stdenv.mkDerivation { | |
| name = "llvm-env"; | |
| buildInputs = [ | |
| bashInteractive | |
| python3 | |
| ninja | |
| cmake | |
| llvmPackages_latest.llvm | |
| hyperfine | |
| ]; | |
| # where to find libgcc | |
| NIX_LDFLAGS="-L${gccForLibs}/lib/gcc/${targetPlatform.config}/${gccForLibs.version}"; | |
| # teach clang about C startup file locations | |
| CFLAGS="-B${gccForLibs}/lib/gcc/${targetPlatform.config}/${gccForLibs.version} -B ${stdenv.cc.libc}/lib"; | |
| cmakeFlags = [ | |
| "-DGCC_INSTALL_PREFIX=${gcc}" | |
| "-DC_INCLUDE_DIRS=${stdenv.cc.libc_dev}/include" | |
| "-GNinja" | |
| # Debug for debug builds | |
| "-DCMAKE_BUILD_TYPE=Release" | |
| # inst will be our installation prefix | |
| "-DCMAKE_INSTALL_PREFIX=../inst" | |
| "-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON" | |
| # change this to enable the projects you need | |
| "-DLLVM_ENABLE_PROJECTS=clang" | |
| # enable libcxx* to come into play at runtimes | |
| "-DLLVM_ENABLE_RUNTIMES=libcxx;libcxxabi" | |
| # this makes llvm only to produce code for the current platform, this saves CPU time, change it to what you need | |
| "-DLLVM_TARGETS_TO_BUILD=host" | |
| ]; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment