Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 917492 - =dev-lang/rust-1.73.0 fail to work after successfully compile, with Arm64 Musl LLVM Stage3 rootfs
Summary: =dev-lang/rust-1.73.0 fail to work after successfully compile, with Arm64 Mus...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: ARM64 Linux
: Normal normal (vote)
Assignee: Gentoo Rust Project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-17 12:06 UTC by labyrithfind
Modified: 2024-02-14 10:26 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description labyrithfind 2023-11-17 12:06:18 UTC
The =dev-lang/rust-1.73.0 package, can complete it compile without issue, but rustc binary, keeps reporting below error, and not able to work:

hostname /usr/lib/rust/1.73.0/bin # ./rustc -V
Error loading shared library librustc_driver-c1afb17c7eea4859.so: Exec format error (needed by ./rustc)
Error relocating ./rustc: _RNvCslXYCtOhRy7C_17rustc_driver_impl4main: symbol not found


If we check whether this librustc_driver-c1afb17c7eea4859.so is exist or not, it will show that the compiled into data, not binary:

# file /usr/lib/rust/1.73.0/lib/librustc_driver-c1afb17c7eea4859.so
/usr/lib/rust/1.73.0/lib/librustc_driver-c1afb17c7eea4859.so: data

Reproducible: Always

Steps to Reproduce:
1.Get a fresh Stage3 AArch64 Musl+LLVM Stage 3 Rootfs
2.Emerge =dev-lang/rust-1.73.0 
3.Get the error message with the one we're showing, while the rustc command, failed to work properly

Actual Results:  
Showing in below commands results:

hostname ~ # .cargo/bin/rustc -V
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/librustc_driver-0ddef83cadeab5a8.so)
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/libstd-c81afc684290f6ba.so)
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/librustc_driver-0ddef83cadeab5a8.so: _Unwind_GetRegionStart: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/librustc_driver-0ddef83cadeab5a8.so: _Unwind_GetTextRelBase: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/librustc_driver-0ddef83cadeab5a8.so: _Unwind_RaiseException: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/librustc_driver-0ddef83cadeab5a8.so: _Unwind_SetIP: symbol not found



# file /usr/lib/rust/1.73.0/bin/*
/usr/lib/rust/1.73.0/bin/cargo:              data
/usr/lib/rust/1.73.0/bin/cargo-1.73.0:       data
/usr/lib/rust/1.73.0/bin/rust-gdb:           POSIX shell script, ASCII text executable
/usr/lib/rust/1.73.0/bin/rust-gdb-1.73.0:    POSIX shell script, ASCII text executable
/usr/lib/rust/1.73.0/bin/rust-gdbgui:        POSIX shell script, ASCII text executable
/usr/lib/rust/1.73.0/bin/rust-gdbgui-1.73.0: POSIX shell script, ASCII text executable
/usr/lib/rust/1.73.0/bin/rust-lldb:          POSIX shell script, ASCII text executable
/usr/lib/rust/1.73.0/bin/rust-lldb-1.73.0:   POSIX shell script, ASCII text executable
/usr/lib/rust/1.73.0/bin/rustc:              ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-aarch64.so.1, stripped
/usr/lib/rust/1.73.0/bin/rustc-1.73.0:       ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-aarch64.so.1, stripped
/usr/lib/rust/1.73.0/bin/rustdoc:            data
/usr/lib/rust/1.73.0/bin/rustdoc-1.73.0:     data




I'm suspecting the issue already takes happens, when the rust compile in its Stage0 phase, it's downloaded binaries can't be used.

So i just simply use rustup-init tool, to pull out the latest executable binary.

And it turns out, the same issue happens. With musl+LLVM rootfs, this downloaded rustc binary, is unable to work as expected.

Here's the three lines of commands, pleasse take it as reference.


hostname ~/.cargo/bin # /root/rustup-init 

Welcome to Rust!

This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.

Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:

  /root/.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory is located at:

  /root/.cargo

This can be modified with the CARGO_HOME environment variable.

The cargo, rustc, rustup and other commands will be added to
Cargo's bin directory, located at:

  /root/.cargo/bin

This path will then be added to your PATH environment variable by
modifying the profile file located at:

  /root/.profile

You can uninstall at any time with rustup self uninstall and
these changes will be reverted.

Current installation options:


   default host triple: aarch64-unknown-linux-musl
     default toolchain: stable (default)
               profile: default
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>

info: profile set to 'default'
info: default host triple is aarch64-unknown-linux-musl
warning: Updating existing toolchain, profile choice will be ignored
info: syncing channel updates for 'stable-aarch64-unknown-linux-musl'
info: default toolchain set to 'stable-aarch64-unknown-linux-musl'

  stable-aarch64-unknown-linux-musl unchanged - (error reading rustc version)


Rust is installed now. Great!

To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).

To configure your current shell, run:
source "$HOME/.cargo/env"


hostname ~/.cargo/bin # ./cargo
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/bin/cargo)
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/bin/cargo: _Unwind_SetIP: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/bin/cargo: _Unwind_GetRegionStart: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/bin/cargo: _Unwind_GetTextRelBase: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/bin/cargo: _Unwind_Resume: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/bin/cargo: _Unwind_DeleteException: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/bin/cargo: _Unwind_RaiseException: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/bin/cargo: _Unwind_GetIP: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/bin/cargo: _Unwind_GetIPInfo: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/bin/cargo: _Unwind_GetDataRelBase: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/bin/cargo: _Unwind_SetGR: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/bin/cargo: _Unwind_Backtrace: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/bin/cargo: _Unwind_GetLanguageSpecificData: symbol not found


hostname ~/.cargo/bin # ./rustc -V
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/librustc_driver-0ddef83cadeab5a8.so)
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/libstd-c81afc684290f6ba.so)
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/librustc_driver-0ddef83cadeab5a8.so: _Unwind_GetRegionStart: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/librustc_driver-0ddef83cadeab5a8.so: _Unwind_GetTextRelBase: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/librustc_driver-0ddef83cadeab5a8.so: _Unwind_RaiseException: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/librustc_driver-0ddef83cadeab5a8.so: _Unwind_SetIP: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/librustc_driver-0ddef83cadeab5a8.so: _Unwind_Resume: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/librustc_driver-0ddef83cadeab5a8.so: _Unwind_DeleteException: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/librustc_driver-0ddef83cadeab5a8.so: _Unwind_Resume_or_Rethrow: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/librustc_driver-0ddef83cadeab5a8.so: _Unwind_GetIPInfo: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/librustc_driver-0ddef83cadeab5a8.so: _Unwind_GetDataRelBase: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/librustc_driver-0ddef83cadeab5a8.so: _Unwind_SetGR: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/librustc_driver-0ddef83cadeab5a8.so: _Unwind_GetLanguageSpecificData: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/libstd-c81afc684290f6ba.so: _Unwind_GetTextRelBase: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/libstd-c81afc684290f6ba.so: _Unwind_GetDataRelBase: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/libstd-c81afc684290f6ba.so: _Unwind_GetRegionStart: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/libstd-c81afc684290f6ba.so: _Unwind_FindEnclosingFunction: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/libstd-c81afc684290f6ba.so: _Unwind_DeleteException: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/libstd-c81afc684290f6ba.so: _Unwind_Resume: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/libstd-c81afc684290f6ba.so: _Unwind_SetGR: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/libstd-c81afc684290f6ba.so: _Unwind_SetIP: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/libstd-c81afc684290f6ba.so: _Unwind_GetCFA: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/libstd-c81afc684290f6ba.so: _Unwind_GetLanguageSpecificData: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/libstd-c81afc684290f6ba.so: _Unwind_RaiseException: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/libstd-c81afc684290f6ba.so: _Unwind_GetIP: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/libstd-c81afc684290f6ba.so: _Unwind_GetIPInfo: symbol not found
Error relocating /root/.rustup/toolchains/stable-aarch64-unknown-linux-musl/lib/libstd-c81afc684290f6ba.so: _Unwind_Backtrace: symbol not found


It's keeps reporting the missing file library, should I install Gcc on this system? I've also taken tried to install gcc, but also facing issues, here's the bug link:
https://bugs.gentoo.org/917422

Anyway, would still much thinks for your help!
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-17 12:11:33 UTC
Please keep in mind that the musl/llvm stage3s are experimental still.

I'm not sure why you have anything in .cargo or how it relates to dev-lang/rust or dev-lang/rust-bin though.
Comment 2 labyrithfind 2023-11-17 12:31:31 UTC
Hi @Sam, thanks for your remarks.

Yes the reason i post on this, is that i found the Rust Stage0 compiler during the compile of dev-lang/rust, is also facing the same issue. 

Stage0 binaries, is the same rust executable, that you installed in .cargo folder, and it's producing errors.

Despite the rust package is compiled, its main binary file such like rustc, is not able to use as expected.


Would much appreciated if you can share us some ideas on this, thansk!
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-17 12:35:11 UTC
(Let's not confuse matters with upstream's rustup binary - that's expected not to work, for the same reason that dev-lang/rust-bin (and dev-lang/rust) need hacks for bootstrap binaries.)

I think for dev-lang/rust-bin in the past, we considered some hacks to work around the Unwind_* symbol problems -- it requires libgcc's unwind.

I've got to be honest though, this was about 2 years ago that I last looked into it, so the details are fuzzy for me at the moment.

From a quick grep, it looks like only dev-lang/rust has the needed workarounds right now. Not clear to me why dev-lang/rust would fail - it's possible we haven't wired up the aforementioned hacks for arm64, just amd64 (see esetup_unwind_hack in dev-lang/rust's ebuild).
Comment 4 labyrithfind 2023-11-17 12:39:06 UTC
Hi @Sam,

Thanks for your help, i would have this do some test to see how it goes.
Appreciated.