I would like to use two user generated .so library file in my rust code. These files are named lib_dens-mods.so
and lib_twobody.so
. My build.rs is the following
//build.rs
use std::env;
use std::process::Command;
fn main() {
Command::new("sh")
.arg("-c")
.arg("export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.")
.status()
.expect("failed to execute command");
println!("cargo:rustc-link-search=./");
// link against lib_dens-mods.so
println!("cargo:rustc-link-search=lib_dens-mods");
// link against lib_twobody.so
println!("cargo:rustc-link-search=lib_twobody");
}
and my Cargo.toml is below
[package]
name = "pion-twobody"
authors = ["me myemail@mywebsite.xyz"]
version = "0.1.0"
[dependencies]
array2d = "0.3.0"
cc = "1.0.79"
lebedev_laikov= {git = "https://github.com/Rufflewind/lebedev_laikov.git", branch="master"}
libc = "0.2.144"
multiarray = "0.1.3"
num = "0.4.0"
# rand = "0.8.5"
[build-dependencies]
cc = "1.0.79"
But when I run this I get the following errors
error: linking with `cc` failed: exit status: 1
note: LC_ALL= (very long string)
note: /usr/bin/ld: cannot find -llib_dens-mods: No such file or directory
/usr/bin/ld: cannot find -llib_twobody: No such file or directory
collect2: error: ld returned 1 exit status
Within my rust code I am linking to the libraries using the lines
#[link(name = "lib_dens-mods")]
#[link(name = "lib_twobody")]
What can I do to solve these errors?