[Buildroot] [git commit branch/2022.02.x] package/rust: set musl-root for musl toolchains

Peter Korsgaard peter at korsgaard.com
Sun Mar 20 18:13:52 UTC 2022


commit: https://git.buildroot.net/buildroot/commit/?id=46c073662bc24bb7c5b9fd1a27ae1945d0439528
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/2022.02.x

Without musl-root in config.toml the build stop with the following error:

thread 'main' panicked at 'couldn't find libc.a in musl libdir: output/host/arm-buildroot-linux-musleabihf/sysroot/lib/lib', src/bootstrap/sanity.rs:192:25

musl-root is needed to provide the path to libc.a and libunwind.a because
rust link them statically into the standard library and liblibc [1].

For other libc, musl-root is not used and ignored [2].

[1] https://github.com/rust-lang/rust/commit/cd980b3bee5bd48e8a6cd4c0d7c8e0fb0fdb64dd
[2] https://github.com/rust-lang/rust/blob/1.58.1/src/bootstrap/sanity.rs#L181

Signed-off-by: Romain Naour <romain.naour at gmail.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout at mind.be>
(cherry picked from commit a41b0f31dea3e62b006ac815bf628600676b328f)
Signed-off-by: Peter Korsgaard <peter at korsgaard.com>
---
 package/rust/rust.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/rust/rust.mk b/package/rust/rust.mk
index 3c560882ca..cd8c87b68d 100644
--- a/package/rust/rust.mk
+++ b/package/rust/rust.mk
@@ -56,6 +56,7 @@ define HOST_RUST_CONFIGURE_CMDS
 		echo 'sysconfdir = "$(HOST_DIR)/etc"'; \
 		echo '[rust]'; \
 		echo 'channel = "stable"'; \
+		echo 'musl-root = "$(STAGING_DIR)"' ; \
 		echo '[target.$(RUSTC_TARGET_NAME)]'; \
 		echo 'cc = "$(TARGET_CROSS)gcc"'; \
 		echo '[llvm]'; \



More information about the buildroot mailing list