Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 926775

Summary: dev-lang/rust fails cross-compilation to musl hosts
Product: Gentoo Linux Reporter: jonys <vidra.jonas>
Component: Current packagesAssignee: Randy Barlow <randy>
Status: UNCONFIRMED ---    
Severity: normal CC: matoro_gentoo, navi, rust
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: A patch for dev-lang/rust/rust-1.75.0-r1.ebuild adding musl-root to config.toml

Description jonys 2024-03-11 16:54:52 UTC
Created attachment 887368 [details, diff]
A patch for dev-lang/rust/rust-1.75.0-r1.ebuild adding musl-root to config.toml

When cross-compiling dev-lang/rust-1.74.1 or dev-lang/rust-1.75.0-r1 using the `system-bootstrap` method for hosts that use musl libc (e.g. aarch64-gentoo-linux-musl, but also others), the build fails with the following message:
```
running sanity check
thread 'main' panicked at sanity.rs:232:25:
when targeting MUSL either the rust.musl-root option or the target.$TARGET.musl-root option must be specified in config.toml
```

Steps to reproduce:
1. Install and set up crossdev for aarch64-gentoo-linux-musl
2. Install Rust with LLVM_TARGETS="AArch64"
3. Run `USE='dist system-bootstrap' LLVM_TARGETS='X86' aarch64-gentoo-linux-musl-emerge =dev-lang/rust-1.75.0-r1`

The fix is to emit the proper musl-root directive when creating config.toml in the ebuild, see the attached patch.

Signed-off-by: Jonáš Vidra <vidra@ufal.mff.cuni.cz>
Comment 1 matoro archtester 2024-05-08 16:53:54 UTC
Did you test this on native musl to make sure it works OK there as well?