Skip to contentSkip to conversation

package/rust: set musl-root for musl toolchains

PATCH Applied Romain Naour 3 participants 3 messages Feb 25, 2022 – Mar 20, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/rust: set musl-root for musl toolchains

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

---
Runtime tested with TestRust with ripgrep and bat packages.

---
 package/rust/rust.mk | 1 +
 1 file changed, 1 insertion(+)
package/rust/rust.mk +1 -0
index 4a6b04dc8c..c2e0a361dd 100644
@@ -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]'; \
Signature · 6 lines
2.35.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 7 lines · Romain Naour

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].

Quoted 6 lines

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

Applied to master, thanks.

Regards,
Arnout

Quoted 11 lines

---
Runtime tested with TestRust with ripgrep and bat packages.

---
  package/rust/rust.mk | 1 +
  1 file changed, 1 insertion(+)
package/rust/rust.mk +0 -0
index 4a6b04dc8c..c2e0a361dd 100644

package/rust/rust.mk define HOST_RUST_CONFIGURE_CMDS · line 62

Quoted 7 lines
package/rust/rust.mk +1 -0
@@ -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]'; \

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
In reply to Romain Naour
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Romain" == Romain Naour <[email protected]> writes:

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].

Quoted 8 lines

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

---
Runtime tested with TestRust with ripgrep and bat packages.

Committed to 2022.02.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot