Skip to content
Fangrui Song edited this page Jan 13, 2024 · 7 revisions

Sync files

On the host,

qemu-system-x86_64 -enable-kvm -m 16384 -smp 8 -cpu host -drive file=~/Images/alpine.qcow2,if=virtio -net nic -nic user,hostfwd=tcp::2224-:22 -fsdev local,id=Dev,path=$HOME/Dev,security_model=none -device virtio-9p-pci,fsdev=Dev,mount_tag=Dev 
apk add alpine-sdk clang cmake g++ git lld

apk add exa fzf sudo

llvm

apk add clang-dev  # emmintrin.h
apk add zlib-dev  # LLVM_ENABLE_ZLIB
apk add linux-headers python3-dev libedit-dev # needed by lldb

LLVM_COMMON=(-GNinja -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DLLVM_APPEND_VC_REV=OFF -DLLVM_ENABLE_BINDINGS=OFF -DLLVM_ENABLE_LLD=On -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra;lldb;lld;compiler-rt')
cmake -Hllvm -BAlpineRelease -DCMAKE_BUILD_TYPE=Release ${LLVM_COMMON} -DBUILD_SHARED_LIBS=Off -DCLANG_DEFAULT_CXX_STDLIB=libc++ -DCLANG_DEFAULT_LINKER=lld -DCLANG_DEFAULT_RTLIB=compiler-rt -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-alpine-linux-musl -DLLVM_TARGETS_TO_BUILD=X86 -DLIBCXX_HAS_MUSL_LIBC=On
cmake -Hllvm -BAlpineReleaseS2 -DCMAKE_BUILD_TYPE=Release ${LLVM_COMMON} -DCMAKE_CXX_COMPILER=$HOME/llvm/AlpineRelease/bin/clang++ -DCMAKE_C_COMPILER=$HOME/llvm/AlpineRelease/bin/clang -DBUILD_SHARED_LIBS=On -DCLANG_DEFAULT_CXX_STDLIB=libc++ -DCLANG_DEFAULT_LINKER=lld -DCLANG_DEFAULT_RTLIB=compiler-rt -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-alpine-linux-musl
Clone this wiki locally