Error: linking with `cc` failed: exit status: 1 "cc" "-m64" "/tmp/rustczFsphc/symbols.o"

I'm trying to run a program using rust-bert crate but unfortunately I'm getting this error.
The error appears when I try to import from rust-bert crate, if I don't import it compiles well.
You can see in the error log that it fails when creating the binary.
I think there is something wrong with my system as the error appeared right after I updated it about 2-3 weeks ago.

 Compiling torch-sys v0.7.2
   Compiling tokio-native-tls v0.3.0
   Compiling hyper-tls v0.5.0
   Compiling bstr v0.2.17
   Compiling serde_urlencoded v0.7.1
   Compiling reqwest v0.11.11
   Compiling csv v1.1.6
   Compiling cached-path v0.5.3
   Compiling tch v0.7.2
   Compiling rust-bert v0.18.0
   Compiling ai2 v0.1.0 (/home/r/projects/rust/ai2)

Full error log here

Rustc 1.62.1 nightly
OS: Arch linux
Rust-bert version: 0.18.0
Libtorch instalation: manual
Libtorch version:    
error: linking with `cc` failed: exit status: 1
  = note: "cc" "-m64" "/tmp/rustcADHbss/symbols.o" "/home/r/projects

... long error

collect2: error: ld returned 1 exit status
  = help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see

env | grep -e LIBTORCH -e LD_LIBRARY_PATH                                                                                                           

I've tried to change libtorch versions but no luck.
This error appeared right after I updated my system about 2-3 weeks ago.
Also I opened an issue related to rust-bert, some errors I could fix but this is still here

I am facing a similar problem. Did you come up with any solution?

I moved from Arch Linux to fedora.
It works well on fedora without any env variances or pytorch instalation/download as the library downloads all needed files at the compilation process.
Solution: Change the system or try to downgrade glibc or ld. Didn't work for me with downgrading.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.