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
  • 388,571
  • 95
  • 1,107
  • 1,366
LightSith
  • 795
  • 12
  • 27
  • Please provide additional information: what program are you trying to build? Which compiler version, which toolchain, and which host OS? – E_net4 Nov 22 '18 at 19:10
  • 1
    Most operating systems come with tools to search the hard drive for files of a specific name. Have you tried one of those? – Shepmaster Nov 22 '18 at 21:35

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
  • 388,571
  • 95
  • 1,107
  • 1,366
LightSith
  • 795
  • 12
  • 27
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
  • 388,571
  • 95
  • 1,107
  • 1,366