Rustfmt: Error while loading libsyntax

Created on 15 Jun 2017  路  5Comments  路  Source: rust-lang/rustfmt

I've just installed rustfmt-nigtly and got the following error:

$ rustfmt --help
rustfmt: error while loading shared libraries: libsyntax-93b867817c21b413.so: cannot open shared object file: No such file or directory
cargo 0.20.0-nightly (0d0f3baad 2017-06-13)
$ rustc --version --verbose
rustc 1.19.0-nightly (03abb1bd7 2017-06-13)
binary: rustc
commit-hash: 03abb1bd70ac56e4aba0684bab819892a0157843
commit-date: 2017-06-13
host: x86_64-unknown-linux-gnu
release: 1.19.0-nightly
LLVM version: 4.0

Most helpful comment

To use libsyntax.so, LD_LIBRARY_PATH must include the directory which contains libsyntax.so.
In Linux, export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib:$LD_LIBRARY_PATH should work.

All 5 comments

To use libsyntax.so, LD_LIBRARY_PATH must include the directory which contains libsyntax.so.
In Linux, export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib:$LD_LIBRARY_PATH should work.

That worked, thank you!

Just a note for anyone coming across this issue and the above solution does not work as it did not work for me. I found that libsyntax-93b867817c21b413.so was not even in the path (rustc --print sysroot)/lib and the issue was due to my nightly version of rust being stuck on 1.19.0-nightly.

I had to reinstall nightly rust as described here and now I'm on rustc 1.21.0-nightly. I then did rustup run nightly cargo install rustfmt-nightly --force and that solved the issue for me.

Hmmm.. this doesn't seem to work for me.

marcus@localhost ~/lisp-parser> echo $LD_LIBRARY_PATH
/home/marcus/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib

marcus@localhost ~/lisp-parser> ls -l /home/marcus/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib
[...]
-rw-r--r--. 1 marcus marcus  6587560 Aug 17 14:19 libsyntax-e261a49b7068161c.so

marcus@localhost ~/lisp-parser> rustfmt
rustfmt: error while loading shared libraries: libsyntax-e261a49b7068161c.so: cannot open shared object file: No such file or directory

I'm at a loss on why it cannot be found :/

edit: it seems to be a thing related to vs code - it works in a regular terminal emulator.

If you run VSCode from the command line, it should pick up the right environment, however, I think something different happens when you start it from an icon?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

torkleyy picture torkleyy  路  5Comments

Julian-Wollersberger picture Julian-Wollersberger  路  5Comments

gnzlbg picture gnzlbg  路  3Comments

fulara picture fulara  路  4Comments

BartMassey picture BartMassey  路  4Comments