5

I am trying to compile my Rust project with dynamic linking to reduce the size and provide .so (or .dll on Windows) files with the application just like Qt does for Android. I read Why are Rust executables so huge? and compiled with

cargo rustc  -- -C prefer-dynamic

When I run my program, I get this error:

 % target/debug/t_pro 
target/debug/t_pro: error while loading shared libraries: libstd-a021829e87e39dcf.so: cannot open shared object file: No such file or directory
Shepmaster
  • 326,504
  • 69
  • 892
  • 1,159
LightSith
  • 645
  • 8
  • 21

2 Answers2

8

I got an answer on Reddit.

rustc --print=sysroot

In my case, the .so files are in /home/username/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib and .rlib are in /home/username/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib.

Shepmaster
  • 326,504
  • 69
  • 892
  • 1,159
LightSith
  • 645
  • 8
  • 21
2

The libraries are installed wherever you chose to install Rust. I use rustup on macOS, so they are installed in ~/.rustup/toolchains/*whatever*/lib/ for me.

Use your operating system's tools to search for files of a specific name.

See also:

Shepmaster
  • 326,504
  • 69
  • 892
  • 1,159