Skip to content

Instantly share code, notes, and snippets.

@navyxliu
Created October 2, 2023 03:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save navyxliu/3463c98f12b97d6614167f0cc48375a8 to your computer and use it in GitHub Desktop.
Save navyxliu/3463c98f12b97d6614167f0cc48375a8 to your computer and use it in GitHub Desktop.
My build script of llvm
#/bin/bash
#
# 1.after check out llvm repo, create a directory 'llvm-build' nearby.I prefer out-of-tree-build.
# 2.configure
# execute 'sh ./mybuild.sh RelWithDebInfo'
#
# the only argument is CMAKE_BUILD_TYPE. options: Release, Debug, RelWithDebInfo etc. ref: https://llvm.org/docs/CMake.html
# Debug build is desireable for development, but be mindful that it requires a lot of memory in linkage stage. Curb the number of parallel jobs.
# I configure mlir,clang and lld(llvm will be built as the dependency). I only select x86 and amdgpu.
#
# 3. shoot
# cmake --build . -j8
# I use 8 parallel jobs at most.(CPU: 8700K; Memory: 32G)
#
cmake -DLLVM_TARGETS_TO_BUILD='X86;AMDGPU' -DLLVM_ENABLE_PROJECTS='clang;mlir;lld' -DCMAKE_BUILD_TYPE=$* ../llvm-project/llvm/ -DLLVM_USE_LINKER=lld
@navyxliu
Copy link
Author

One problem I found is that WSL is subject to the scheduler of Windows. Once WSL is NOT visible on screen, Window will put the WSL process into sleep. Of course, we also need to keep screen on. I feel that Windows treats WSL as an interactive UI application instead of a task. it's impractical for building.

A workaround of this is using vscode to build. vscode has pretty good plugins of cmake and WSL. building in vscode is not subject to windows scheduler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment