Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error loading shared library libgcc_s.so.1; Error relocating XXX (musl, Ubuntu) #108907

Closed
pnkfelix opened this issue Mar 8, 2023 · 7 comments
Closed
Labels
C-bug Category: This is a bug. O-linux Operating system: Linux O-musl Target: The musl libc P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@pnkfelix
Copy link
Member

pnkfelix commented Mar 8, 2023

(ported over from rust-lang/rustup#3254 )

Ran:

$ rustc +stable-x86_64-unknown-linux-musl --version
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-a19ffab541701154.so)
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so)
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-a19ffab541701154.so: _Unwind_GetRegionStart: symbol not found
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-a19ffab541701154.so: _Unwind_GetTextRelBase: symbol not found
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-a19ffab541701154.so: _Unwind_RaiseException: symbol not found
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-a19ffab541701154.so: _Unwind_SetIP: symbol not found
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-a19ffab541701154.so: _Unwind_Resume: symbol not found
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-a19ffab541701154.so: _Unwind_DeleteException: symbol not found
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-a19ffab541701154.so: _Unwind_Resume_or_Rethrow: symbol not found
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-a19ffab541701154.so: _Unwind_GetIPInfo: symbol not found
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-a19ffab541701154.so: _Unwind_GetDataRelBase: symbol not found
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-a19ffab541701154.so: _Unwind_SetGR: symbol not found
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-a19ffab541701154.so: _Unwind_GetLanguageSpecificData: symbol not found
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_Resume: symbol not found
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_GetTextRelBase: symbol not found
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_GetDataRelBase: symbol not found
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_GetRegionStart: symbol not found
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_FindEnclosingFunction: symbol not found
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_DeleteException: symbol not found
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_SetGR: symbol not found
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_SetIP: symbol not found
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_GetCFA: symbol not found
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_GetLanguageSpecificData: symbol not found
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_RaiseException: symbol not found
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_GetIP: symbol not found
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_GetIPInfo: symbol not found
Error relocating /home/fenhl/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-86aefecbddda356d.so: _Unwind_Backtrace: symbol not found

User expected to see this happen: a reasonable version output

Instead, this happened: the above linking/loading failures.

@pnkfelix pnkfelix added C-bug Category: This is a bug. O-musl Target: The musl libc T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Mar 8, 2023
@Noratrieb
Copy link
Member

Could it be that the user hasn't installed musl? Given that they are on ubuntu using a musl toolchain (which is very weird anyways, they should be using a musl target).
Since we do link musl dynamically on the musl toolchain.

So I guess this issue is a request for a better error message? Or a warning when using a non-host toolchain? I don't quite understand what is expected here.

@jyn514 jyn514 added the O-linux Operating system: Linux label Mar 8, 2023
@fenhl
Copy link
Contributor

fenhl commented Mar 8, 2023

A better error message would certainly be useful. I have the toolchain installed because I need to use it as a target. I ran into this issue while trying to run cargo sweep -i, see holmgr/cargo-sweep#102.

@Noratrieb
Copy link
Member

I don't think there is much rustc can do with an error message. The error happens before rustc gets to do anything. But maybe the rustup proxies should display a warning when using a non-host toolchain?

@workingjubilee
Copy link
Member

A better error message would certainly be useful. I have the toolchain installed because I need to use it as a target. I ran into this issue while trying to run cargo sweep -i, see holmgr/cargo-sweep#102

The rustc toolchain performs cross-compilation natively, it is not necessary to install a toolchain that differs from your host. Please post any bugs you encounter while cross-compiling from a host gnu toolchain to a musl target.

@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-low

@rustbot rustbot added P-low Low priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Mar 15, 2023
@Berbe
Copy link

Berbe commented Aug 3, 2024

I got the same problem on Debian 12 Bookworm:

Download
$ wget https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-musl/rustup-init
--2024-08-03 16:17:23--  https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-musl/rustup-init
Resolving static.rust-lang.org (static.rust-lang.org)... 2a04:4e42:6a::649, 199.232.170.137
Connecting to static.rust-lang.org (static.rust-lang.org)|2a04:4e42:6a::649|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 16915040 (16M) [binary/octet-stream]
Saving to: ‘rustup-init’

rustup-init                       100%[===========================================================>]  16.13M  --.-KB/s    in 0.1s

2024-08-03 16:17:23 (110 MB/s) - ‘rustup-init’ saved [16915040/16915040]
Install
$ chmod u+x rustup-init 
$ ./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:

  /home/<user>/.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory is located at:

  /home/<user>/.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:

  /home/<user>/.cargo/bin

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

  /home/<user>/.profile
  /home/<user>/.bashrc

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

Current installation options:


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

1) Proceed with standard installation (default - just press enter)
2) Customize installation
3) Cancel installation
>

info: profile set to 'default'
info: default host triple is x86_64-unknown-linux-musl
info: syncing channel updates for 'stable-x86_64-unknown-linux-musl'
info: latest update on 2024-07-25, rust version 1.80.0 (051478957 2024-07-21)
info: downloading component 'cargo'
  8.8 MiB /   8.8 MiB (100 %)   5.2 MiB/s in  1s ETA:  0s
info: downloading component 'clippy'
info: downloading component 'rust-docs'
 15.8 MiB /  15.8 MiB (100 %)   4.8 MiB/s in  3s ETA:  0s
info: downloading component 'rust-std'
info: downloading component 'rustc'
 79.4 MiB /  79.4 MiB (100 %)   4.8 MiB/s in 35s ETA:  0s
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
 15.8 MiB /  15.8 MiB (100 %)   7.9 MiB/s in  2s ETA:  0s
info: installing component 'rust-std'
 34.9 MiB /  34.9 MiB (100 %)  11.6 MiB/s in  3s ETA:  0s
info: installing component 'rustc'
 79.4 MiB /  79.4 MiB (100 %)  12.4 MiB/s in  6s ETA:  0s
info: installing component 'rustfmt'
info: default toolchain set to 'stable-x86_64-unknown-linux-musl'

  stable-x86_64-unknown-linux-musl installed - (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, you need to source
the corresponding env file under $HOME/.cargo.

This is usually done by running one of the following (note the leading DOT):
. "$HOME/.cargo/env"            # For sh/bash/zsh/ash/dash/pdksh
source "$HOME/.cargo/env.fish"  # For fish
Environment check
$ . ~/.cargo/env 
$ rustc --version
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-872b4b1a50a7b164.so)
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-9e3271737799979c.so)
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-872b4b1a50a7b164.so: _Unwind_GetRegionStart: symbol not found
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-872b4b1a50a7b164.so: _Unwind_GetTextRelBase: symbol not found
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-872b4b1a50a7b164.so: _Unwind_RaiseException: symbol not found
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-872b4b1a50a7b164.so: _Unwind_SetIP: symbol not found
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-872b4b1a50a7b164.so: _Unwind_Resume: symbol not found
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-872b4b1a50a7b164.so: _Unwind_DeleteException: symbol not found
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-872b4b1a50a7b164.so: _Unwind_Resume_or_Rethrow: symbol not found
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-872b4b1a50a7b164.so: _Unwind_GetIPInfo: symbol not found
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-872b4b1a50a7b164.so: _Unwind_GetDataRelBase: symbol not found
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-872b4b1a50a7b164.so: _Unwind_SetGR: symbol not found
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/librustc_driver-872b4b1a50a7b164.so: _Unwind_GetLanguageSpecificData: symbol not found
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-9e3271737799979c.so: _Unwind_Resume: symbol not found
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-9e3271737799979c.so: _Unwind_GetTextRelBase: symbol not found
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-9e3271737799979c.so: _Unwind_GetDataRelBase: symbol not found
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-9e3271737799979c.so: _Unwind_GetRegionStart: symbol not found
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-9e3271737799979c.so: _Unwind_FindEnclosingFunction: symbol not found
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-9e3271737799979c.so: _Unwind_DeleteException: symbol not found
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-9e3271737799979c.so: _Unwind_SetGR: symbol not found
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-9e3271737799979c.so: _Unwind_SetIP: symbol not found
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-9e3271737799979c.so: _Unwind_GetCFA: symbol not found
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-9e3271737799979c.so: _Unwind_GetLanguageSpecificData: symbol not found
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-9e3271737799979c.so: _Unwind_RaiseException: symbol not found
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-9e3271737799979c.so: _Unwind_GetIP: symbol not found
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-9e3271737799979c.so: _Unwind_GetIPInfo: symbol not found
Error relocating /home/<user>/.rustup/toolchains/stable-x86_64-unknown-linux-musl/lib/libstd-9e3271737799979c.so: _Unwind_Backtrace: symbol not found
$ ls -l /lib/x86_64-linux-gnu/libgcc_s.so.1
-rw-r--r-- 1 root root 125312 Jan  8  2023 /lib/x86_64-linux-gnu/libgcc_s.so.1
$ dpkg -l build-essential
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name            Version      Architecture Description
+++-===============-============-============-==============================================
ii  build-essential 12.9         amd64        Informational list of build-essential packages
$ dpkg -l | grep gcc
ii  gcc                                    4:12.2.0-3                              amd64        GNU C compiler
ii  gcc-10                                 10.2.1-6                                amd64        GNU C compiler
ii  gcc-10-base:amd64                      10.2.1-6                                amd64        GCC, the GNU Compiler Collection (base package)
ii  gcc-11-base:amd64                      11.3.0-12                               amd64        GCC, the GNU Compiler Collection (base package)
ii  gcc-12                                 12.2.0-14                               amd64        GNU C compiler
ii  gcc-12-base:amd64                      12.2.0-14                               amd64        GCC, the GNU Compiler Collection (base package)
ii  gcc-4.8-base:amd64                     4.8.4-1                                 amd64        GCC, the GNU Compiler Collection (base package)
ii  gcc-4.9-base:amd64                     4.9.2-10                                amd64        GCC, the GNU Compiler Collection (base package)
ii  gcc-8-base:amd64                       8.3.0-6                                 amd64        GCC, the GNU Compiler Collection (base package)
ii  gcc-9-base:amd64                       9.3.0-22                                amd64        GCC, the GNU Compiler Collection (base package)
ii  libgcc-10-dev:amd64                    10.2.1-6                                amd64        GCC support library (development files)
ii  libgcc-12-dev:amd64                    12.2.0-14                               amd64        GCC support library (development files)
ii  libgcc-s1:amd64                        12.2.0-14                               amd64        GCC support library
ii  libgcc1:amd64                          1:8.3.0-6                               amd64        GCC support library
ii  linux-compiler-gcc-12-x86              6.1.99-1                                amd64        Compiler for Linux on x86 (meta-package)

@workingjubilee
Copy link
Member

@Berbe Debian is a glibc host. You must use the x86_64-unknown-linux-gnu host toolchain. If you go out of your way to install the musl host, then you get a host that is meant to be run on a musl distro. You are bypassing the rustup shell installer to run a binary that happens to be statically linked, but the host toolchain is dynamically linked, because it's for Alpine and the like.

Really, we can't actually solve this any more than we can solve people trying to run the Windows host on their Mac, and we get the same class of errors. Closing.

@workingjubilee workingjubilee closed this as not planned Won't fix, can't repro, duplicate, stale Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. O-linux Operating system: Linux O-musl Target: The musl libc P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

8 participants