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: error while loading shared libraries: librustc_driver--4e7c5e5c.so #24677

Closed
ghost opened this Issue Apr 22, 2015 · 13 comments

Comments

Projects
None yet
10 participants
@ghost
Copy link

ghost commented Apr 22, 2015

When I run a cargo build command, I get the following errors:

Process didn't exit successfully: rustc -vV (exit code: 127)
--- stderr
rustc: error while loading shared libraries: librustc_driver-4e7c5e5c.so: cannot open shared object file: No such file or directory

My computer is running the latest version of arch linux, and I installed rust using the curl command: curl -sf -L https://static.rust-lang.org/rustup.sh | sudo sh

I don't think the issue is with my code, but you can look in my repositories for my simple hello_world program here: https://github.com/a-jamesregan/LearnRust

@muattiyah

This comment has been minimized.

Copy link
Contributor

muattiyah commented Apr 22, 2015

I have the same problem running latest version of arch linux, running rustc generates the same error (without running cargo).

@zaeleus

This comment has been minimized.

Copy link
Contributor

zaeleus commented Apr 22, 2015

Add /usr/local/lib to your LD_LIBRARY_PATH (or include it in your /etc/ld.so.conf so ldconfig searches it when run).

This doesn't happen just on Arch. Most non-Debian systems don't trust anything outside /lib and /usr/lib by default. Because rustup installs to /usr/local, ldconfig doesn't see the newly installed libraries.

@muattiyah

This comment has been minimized.

Copy link
Contributor

muattiyah commented Apr 22, 2015

Ah, I see. You're correct @zaeleus.

For anyone else who faces this problem:
1- Edit the file /etc/ld.so.conf and add /usr/local/lib to it, you will need sudo rights to be able to write changes to the file.
2- Run sudo ldconfig to update the ldconfig cache.
3- Profit!

@steveklabnik

This comment has been minimized.

Copy link
Member

steveklabnik commented Apr 22, 2015

/cc @brson , in theory, we made rustup.sh run ldconfig to fix this.

@ghost

This comment has been minimized.

Copy link
Author

ghost commented Apr 23, 2015

Thanks @skeuomorf, what you suggested worked. It's worth nothing that when you say to add /usr/local/lib to the file, you should do this literally. I got confused because the file by default contains a single line starting with include /etc/ld.so.conf.d/*.conf. If you place an include before /usr/local/lib the fix doesn't work.

@steveklabnik, should I mark this issue as closed now? Or is this going to be used to track the issue in the rustup.sh script?

@chessnokov

This comment has been minimized.

Copy link

chessnokov commented May 12, 2015

just run:
sudo ldconfig /usr/local/lib

@yantonov

This comment has been minimized.

Copy link

yantonov commented May 17, 2015

Same problem if you install rust into specifi dir (./configure --prefix=$INSTALL_DIR && make && make install)
In that case you need to manually add file, for example rustlib.conf at /etc/ld.so.conf.d/ which contains one line $INSTALL_DIR.
You can do this way:
sudo echo $INSTALL_DIR >> /etc/ld.so.conf.d/rustlib.conf
Than reconfigure ldconfig by call
sudo ldconfig

@andschwa

This comment has been minimized.

Copy link

andschwa commented May 25, 2015

Reporting that the latest version of the installer fails to add the path properly on CentOS 7.

@ghost

This comment has been minimized.

Copy link
Author

ghost commented Jun 17, 2015

Ha ha ha! I just had this problem again on a different distro (fedora instead of ubuntu, or was it arch?) and when I searched for the issue again, my own bug report came up! I just wanted to point out that this issue exists for Fedora too.

@PAStheLoD

This comment has been minimized.

Copy link

PAStheLoD commented Jul 16, 2015

If editing anything in /etc/ is not really an option (or someone prefers not to), using a script to launch cargo (and I assume this works for other executables in bin/) works pretty well:

~/bin/cargo:

#!/bin/bash
PREFIX=/home/john/rust
export LD_LIBRARY_PATH=$PREFIX/lib
exec $PREFIX/bin/cargo "$@"

Maybe rustup could emit minimal shims/wrappers like these, kind of how other version managers do it. (rvm, pyenv, nvm)

@cyplo

This comment has been minimized.

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 , for Fedora at least. @a-jamesregan: could you maybe add info that it did not work on Arch for you there (if it still doesn't?) ? :)

@ghost

This comment has been minimized.

Copy link
Author

ghost commented Aug 4, 2015

@cyplo Sorry, I can't check to see if it works in Arch. As much fun - and by that I mean a headache - as it was setting up Arch, I'm now running Ubuntu. Rust seems to be working fine on 15.10 though!

@cyplo

This comment has been minimized.

Copy link
Contributor

cyplo commented Aug 4, 2015

No worries, thanks a lot for checking :) Running ok on my ubuntu machine as well, fedora one having problems though. thanks again !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.