mirror of https://github.com/WebAssembly/wasi-sdk
Currently, the Makefile assumes the LLVM toolchain it builds can be executed natively to build `wasi-libc` etc., which isn't true when cross-compiling for another platform, but we can work around that by: 1. Building the native LLVM toolchain and using it to build everything else, as usual 2. Deleting that LLVM build and rebuilding (and reinstalling) it with `LLVM_CMAKE_FLAGS` set to cross compile 3. Rebuilding and reinstalling a cross-compiled `wasm-component-ld` 4. Building deb and tar files from the above Note that we now label the tarfiles `linux-amd64` and `linux-arm64`, respectively for clarity. The whole approach is a bit hacky, but GitHub is planning to roll out ARM64 runner support for open source projects later this year, at which point we can start building natively, so I don't think we need to invest a lot of effort into this. I've run CI in my fork and verified the artifact produced there works on my Ubuntu 24.04 ARM64 machine (Asahi Linux on an Apple M2 Pro). Fixes #236 Fixes #347 Signed-off-by: Joel Dice <joel.dice@fermyon.com>pull/425/head
parent
68df37e7f6
commit
946b725af5
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
set -ex
|
||||
|
||||
rm -r build/llvm build/llvm.BUILT
|
||||
NINJA_FLAGS=-v make strip LLVM_CMAKE_FLAGS="-DLLVM_CCACHE_BUILD=ON -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_CROSSCOMPILING=True -DCMAKE_CXX_FLAGS=-march=armv8-a -DCMAKE_SYSTEM_PROCESSOR=arm64 -DCMAKE_SYSTEM_NAME=Linux -DLLVM_HOST_TRIPLE=aarch64-linux-gnu"
|
||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc cargo install wasm-component-ld@0.5.0 --root "$(pwd)/build/install/opt/wasi-sdk" --target aarch64-unknown-linux-gnu
|
||||
mkdir -p dist
|
||||
./deb_from_installation.sh "$(pwd)/dist" "$(./version.py)" "$(pwd)/build/install/opt/wasi-sdk" "arm64"
|
||||
./tar_from_installation.sh "$(pwd)/dist" "$(./version.py)" "$(pwd)/build/install/opt/wasi-sdk" "linux-arm64"
|
Loading…
Reference in new issue