cargo run
doesn't finds the *.so
files that have been generated by the build scripts, and are in a sub-directory of target
. Why?
I just compiled proj hello-word with the following feature:
proj = { version = "0.16.2", features = ["bundled_proj"] }
The
bundled_proj
feature allows you to link against a PROJ included with (and built from source by) theproj-sys
crate, upon which this crate is built. To do so, enable thebundled_proj
Cargo feature.
As you can see, the PROJ library has been correctly built and the .so
have been generated.
$ ls **/*proj*.so* -l
lrwxrwxrwx. 1 rmoussu domain users 13 May 14 19:39 target/debug/build/proj-sys-d63ece34f7e325f8/out/build/lib/libproj.so -> libproj.so.19
lrwxrwxrwx. 1 rmoussu domain users 17 May 14 19:39 target/debug/build/proj-sys-d63ece34f7e325f8/out/build/lib/libproj.so.19 -> libproj.so.19.1.0
-rwxr-xr-x. 1 rmoussu domain users 36594520 May 14 19:39 target/debug/build/proj-sys-d63ece34f7e325f8/out/build/lib/libproj.so.19.1.0
lrwxrwxrwx. 1 rmoussu domain users 13 May 14 19:40 target/debug/build/proj-sys-d63ece34f7e325f8/out/lib64/libproj.so -> libproj.so.19
lrwxrwxrwx. 1 rmoussu domain users 17 May 14 19:40 target/debug/build/proj-sys-d63ece34f7e325f8/out/lib64/libproj.so.19 -> libproj.so.19.1.0
-rwxr-xr-x. 1 rmoussu domain users 36594520 May 14 19:39 target/debug/build/proj-sys-d63ece34f7e325f8/out/lib64/libproj.so.19.1.0
However cargo doesn't seems to find them.
$ cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.06s
Running `target/debug/transform`
target/debug/transform: error while loading shared libraries: libproj.so.19: cannot open shared object file: No such file or directory
If I specify them manually, the binary runs correctly.
$ LD_LIBRARY_PATH="$PWD/target/debug/build/proj-sys-d63ece34f7e325f8/out/build/lib/:$LD_LIBRARY_PATH" cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.05s
Running `target/debug/transform`
According to the author of the crate proj, it seems that the issue is on his side, but if someone could help us, it would be welcome.
I took a look at the chapter in cargo book on the build script, but I'm not sure what to do.
Note: I also reported the error on proj github