rust: support llvm-only systems. closes #304

This commit is contained in:
Dylan Araps 2021-08-16 15:35:06 +03:00
parent 56871a28f3
commit 66c018fdbb
No known key found for this signature in database
GPG Key ID: 13295DAC2CF13B5C

View File

@ -49,6 +49,10 @@ full-bootstrap = false
[install]
prefix = "/usr"
[target.x86_64-unknown-linux-musl]
llvm-config = "/usr/bin/llvm-config"
crt-static = false
[rust]
channel = "stable"
rpath = false
@ -59,12 +63,31 @@ jemalloc = false
debug-assertions = false
codegen-tests = false
codegen-units-std = 1
[target.x86_64-unknown-linux-musl]
llvm-config = "/usr/bin/llvm-config"
crt-static = false
EOF
# Workaround to get Rust to build in llvm-only environments.
case $("$CC" -print-file-name=libunwind.so) in */*)
printf 'llvm-libunwind = "system"\n' >> config.toml
# libgcc_s.so is needed for Rust's bootstrap binaries, on llvm-only systems
# this library does not exist. This hack creates it as alias to libunwind.
{
mkdir -p libgcc
printf 'INPUT(-lunwind)\n' > \
libgcc/libgcc_s.so
ln -sf "$KISS_ROOT/usr/lib/libunwind.so.1" \
libgcc/libgcc_s.so.1
export \
LD_LIBRARY_PATH="$PWD/libgcc:$LD_LIBRARY_PATH" \
LIBRARY_PATH="$PWD/libgcc:$LIBRARY_PATH"
}
echo hello world
esac
python3 ./x.py build -j "$(nproc)"
python3 ./x.py install