From 4621dcbd904c67f2d261e4685d0723ad6652b775 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Tue, 11 Oct 2022 19:39:08 +0800 Subject: [PATCH] rust: temporary rustc: export LD_LIBRARY_PATH for LLVM Pass 1 Rustc Pass 1 links to LLVM Pass 1, but the building system does not set rpath for LLVM shared library (even if rpath = true is used). Explicitly tell the host dynamic linker to search $LFS/tools/lib so LLVM Pass 1 can be found. Thanks Moody for report. --- chapter06/rustc.xml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/chapter06/rustc.xml b/chapter06/rustc.xml index 90f8b7a75..d1094e257 100644 --- a/chapter06/rustc.xml +++ b/chapter06/rustc.xml @@ -53,7 +53,13 @@ sed -i.orig compiler/rustc_target/src/spec/mod.rs \ -e '/targets!/a\ ("i586-lfs-linux-gnu", i586_lfs_linux_gnu),' In the first pass, build Rustc as a cross compiler for - $LFS_TGT. Create a suitable configuration: + $LFS_TGT. The cross compiler will link to LLVM Pass 1, + so we need to tell the dynamic linker of the host distro where to find + the LLVM Pass 1 dynamic library: + +export LD_LIBRARY_PATH=$LFS/tools/lib + + Create a suitable configuration: install -vm755 src/llvm-project/llvm/cmake/config.guess config.guess cat > pass1.toml << EOF @@ -163,6 +169,14 @@ python3 x.py install --keep-stage 0 \ --config pass2.toml ln -sv rustc-&rustc-version; $LFS/opt/rustc + + Clean up the environment: + +unset LD_LIBRARY_PATH +