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

rustc cannot find librustc when installed with rustup.sh #15684

Closed
mpdn opened this issue Jul 15, 2014 · 30 comments
Closed

rustc cannot find librustc when installed with rustup.sh #15684

mpdn opened this issue Jul 15, 2014 · 30 comments

Comments

@mpdn
Copy link
Contributor

mpdn commented Jul 15, 2014

I recently installed rustc with rustup.sh on an Arch Linux x64 machine, but executing rustc after installation (no matter the parameters) results in this error:

rustc: error while loading shared libraries: librustc-4e7c5e5c.so: cannot open shared object file: No such file or directory

This is even though librustc-4e7c5e5c.so can be found in both ./usr/local/lib/librustc-4e7c5e5c.so and ./usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc-4e7c5e5c.so.

@mpdn mpdn changed the title rustc crashes when installed with rustup.sh rustc cannot find librustc when installed with rustup.sh Jul 15, 2014
@huonw
Copy link
Member

huonw commented Jul 15, 2014

Do you remember how recently? AIUI, I think this should've been fixed by #15597.

@mpdn
Copy link
Contributor Author

mpdn commented Jul 15, 2014

Yesterday, but I tried reinstalling it just now and it's still a problem.

@huonw
Copy link
Member

huonw commented Jul 15, 2014

Hm, interesting. Are you redownloading rustup.sh each time, or do you have a cached local copy of the script? (If the latter, could you try downloading a new copy? ... If the former, I'm all out of ideas.)

@mpdn
Copy link
Contributor Author

mpdn commented Jul 15, 2014

I'm using the one-liner from the guide: curl -s http://www.rust-lang.org/rustup.sh | sudo sh, so it should be the newest rustup.sh script.

@mpdn
Copy link
Contributor Author

mpdn commented Jul 15, 2014

I solved the issue. Rustup.sh requires the LD_LIBRARY_PATH variable to point to to /usr/local/lib, which it did not on my machine. Adding export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib to .bashrc solved it.

The installer currently says Note: please ensure '/usr/local/lib' is added to LD_LIBRARY_PATH after installing rustc, but since cargo is now installed right after, it can be very easy to miss.

@mpdn mpdn closed this as completed Jul 15, 2014
@pengzj
Copy link

pengzj commented Dec 4, 2014

Yeah. edit /etc/profile add new line
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib
then fix it.

@JohnAppleSeed-
Copy link

If you're using fish shell:

execute:

set -x LD_LIBRARY_PATH {LD_LIBRARY_PATH}:/usr/local/lib

and add that line to ~/config/fish/config.fish to make it permanent.

@viseztrance
Copy link

I had the same issue on Fedora. Although it was easy to fix, it would be great for this to be solved properly.

@Gonzih
Copy link

Gonzih commented Jan 12, 2015

@JohnAppleSeed-

set -Ux LD_LIBRARY_PATH $LD_LIBRARY_PATH:/usr/local/lib

@dLobatog
Copy link
Contributor

Same issue here on Fedora 21, any reason why the script shouldn't export the path by default?

@kl4ng
Copy link

kl4ng commented Mar 19, 2015

Had this issue in Fedora 21, even if I compiled rust from sources, the above fixed it.

@matachi
Copy link

matachi commented Mar 21, 2015

Had the same issue on Fedora 21, both with Nightly and 1.0.0-alpha.2. Adding that line to .zshrc solved it though (I'm using zsh instead of bash).

@dumindu
Copy link

dumindu commented Mar 26, 2015

Same happens on Fedora 22 alpha. /etc/profile was updated but gave bellow errors when compile a file
error: could not exec the linker cc: No such file or directory (os error 2)
error: aborting due to previous error

@zwippie
Copy link

zwippie commented Apr 12, 2015

Same happens on Ubuntu 14.04.2 LTS with rust 1.0.0-beta. Adding export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib to .zshrc solved it.

@mhristache
Copy link

Same issue on Redhat 6.4 after installing as root user. Should we reopen this? It gives a bad impression if rust installation doesn't 'just' work.

@roelvanduijnhoven
Copy link

Also got this error after an upgrade.

@mhristache
Copy link

cc @brson

@danielkza
Copy link

Got the same problem on Fedora 21. I believe installing a script into /etc/profile.d if it exists, correcting LD_LIBRARY_PATH, could work without requiring user intervention.

The script could be something like this:

_RUST_LIB_PATH=/usr/local/lib
if ! echo "$LD_LIBRARY_PATH" | grep -q -E '(^|:)'"$_RUST_LIB_PATH"'(:|$)'; then
    export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$_RUST_LIB_PATH"
fi
unset _RUST_LIB_PATH

@a-metz
Copy link

a-metz commented May 18, 2015

I had the same problem in Fedora 21. I suppose a cleaner way to solve this is adding a file in /etc/ld.so.conf.d/ wtih the content /usr/local/lib and running ldconfig afterwards.

@Keats
Copy link

Keats commented May 22, 2015

Just got it on Archlinux x64 as well, adding export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib to my zshrc fixed it but it would be nice to have rustup working out of the box

@s-p-n
Copy link

s-p-n commented May 27, 2015

I had this issue on Fedora 21, too. This comment helped me solve the issue.

@ybian19
Copy link

ybian19 commented Jun 9, 2015

I met this on Fedora 22, and follow steps help me resolve it.

  1. $ sudo vim /etc/ld.so.conf
    add /usr/local/lib in it.
  2. $ sudo ldconfig
    update the ldconfig cache.
    After this, It should work now~

@dumindu
Copy link

dumindu commented Jun 28, 2015

@Noctune This should be reopened.

@mpdn
Copy link
Contributor Author

mpdn commented Jun 28, 2015

@dumindu Alright, I'll reopen it.

@mpdn mpdn reopened this Jun 28, 2015
@cyplo
Copy link
Contributor

cyplo commented Aug 1, 2015

Hello !
Same issue on newest fresh Fedora 22.
When searching for this issue I found this one as well, seems very similar: #24677
It happens when I run curl -sSf https://static.rust-lang.org/rustup.sh | sh

Let me know if I can help debugging this.
Excerpt from the log and then ldd showing missing libraries:

rustup: gpg available. signatures will be verified
rustup: downloading manifest for 'stable'
rustup: downloading toolchain for 'stable'
######################################################################## 100.0%
gpg: assuming signed data in '/home/cyryl/.rustup/dl/88582fca9f8c53945b8f/rust-1.1.0-x86_64-unknown-linux-gnu.tar.gz'
gpg: Signature made Sat 20 Jun 2015 09:36:00 CEST using RSA key ID 7B3B09DC
gpg: Good signature from "Rust Language (Tag and Release Signing Key) <rust-key@rust-lang.org>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 108F 6620 5EAE B0AA A8DD  5E1C 85AB 96E6 FA1B E5FE
     Subkey fingerprint: C134 66B7 E169 A085 1886  3216 5CB4 A934 7B3B 09DC
rustup: extracting installer
rustup: installing toolchain for 'stable'
[sudo] password for cyryl: 
install: uninstalling component 'rustc'
install: uninstalling component 'cargo'
install: uninstalling component 'rust-docs'
install: creating uninstall script at /usr/local/lib/rustlib/uninstall.sh
install: installing component 'rustc'
install: installing component 'cargo'
install: installing component 'rust-docs'

    Rust is ready to roll.


# vim: set noet ts=8 sts=4 sw=4:
[cyryl@localhost ~]$ rustc -V
rustc: error while loading shared libraries: librustc_driver-7d23ff90.so: cannot open shared object file: No such file or directory
[cyryl@localhost ~]$ which rustc
/usr/local/bin/rustc
[cyryl@localhost ~]$ ldd /usr/local/bin/rustc 
    linux-vdso.so.1 (0x00007ffdd93f6000)
    librustc_driver-7d23ff90.so => not found
    libstd-7d23ff90.so => not found
    libc.so.6 => /lib64/libc.so.6 (0x00007f83755fe000)
    /lib64/ld-linux-x86-64.so.2 (0x00005593d7200000)

@cyplo
Copy link
Contributor

cyplo commented Aug 1, 2015

Seems that this is the same issue as: #26860
Comment there references rust-lang/rust-installer#30 as the main culript. It has a patch already, so probably will be fixed soon :)

@mcpherrinm
Copy link
Contributor

Fixed by rust-lang/rust-installer@c37d374

@cyplo
Copy link
Contributor

cyplo commented Aug 8, 2015

👍

@dumindu
Copy link

dumindu commented Aug 30, 2015

Fixed on Fedora 22, Thanks @mcpherrinm

@steveklabnik
Copy link
Member

With a number of people saying this is fixed, i'm giving a close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests