From 44cb325aa20806662af1195a9296e1e98ff31fe9 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Tue, 11 Oct 2022 17:33:33 +0800 Subject: [PATCH 1/2] rust: add missing entities for llvm-cmake Note - Clang and compiler-rt are not added into Chapter 3 yet. Also put llvm-cmake after llvm. --- chapter03/packages.xml | 18 +++++++++--------- packages.ent | 6 ++++++ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/chapter03/packages.xml b/chapter03/packages.xml index ceeb88b47..23029b540 100644 --- a/chapter03/packages.xml +++ b/chapter03/packages.xml @@ -477,15 +477,6 @@ - - LLVM-cmake Modules (&llvm-cmake-version;) - &llvm-cmake-size;: - - Home page: - Download: - MD5 sum: &llvm-cmake-md5; - - - LLVM (&llvm-version;) - &llvm-size;: @@ -495,6 +486,15 @@ + + LLVM CMake Modules (&llvm-version;) - &llvm-cmake-size;: + + Home page: + Download: + MD5 sum: &llvm-cmake-md5; + + + M4 (&m4-version;) - &m4-size;: diff --git a/packages.ent b/packages.ent index a4ddd10ca..49a789ec6 100644 --- a/packages.ent +++ b/packages.ent @@ -466,6 +466,12 @@ + + + + + From 4621dcbd904c67f2d261e4685d0723ad6652b775 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Tue, 11 Oct 2022 19:39:08 +0800 Subject: [PATCH 2/2] 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 +