Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Libra error: missing shared library libpipy.so #684

Open
MrBeanCpp opened this issue Nov 12, 2024 · 1 comment
Open

Libra error: missing shared library libpipy.so #684

MrBeanCpp opened this issue Nov 12, 2024 · 1 comment

Comments

@MrBeanCpp
Copy link
Contributor

I used the following command to compile Libra into a binary:

cargo build --release --bin libra

The compilation process was OK, but when I ran libra command, I got an error:

libra: error while loading shared libraries: libpipy.so: cannot open shared object file: No such file or directory

However, if I run libra directly via cargo run, there are no problem at all.
And this issue occurred after libra introduced gemini for p2p download.

@Hou-Xiaoxuan
Copy link
Contributor

That is because Cargo doesn’t propagate the crate’s link arguments to higher-level crates. In Neptune’s build.rs, we set two arguments: rpath and link-search. The rpath is intended for the final binary to link to the library, and link-search allows Cargo to locate the library.

    println!(
        "cargo:rustc-link-arg=-Wl,-rpath,{}/build,-rpath,{}",
        dst.display(),
        origin_path
    );
    println!("cargo:rustc-link-search={}/build", dst.display());

The problem is that link-search can be passed to crates that use Neptune, but rpath cannot, as noted in this Cargo issue. So, you can use cargo run to execute the program, but you can’t run Libra directly.

One way to address this is to add these arguments to any binaries's build.rs that use Neptune, either directly or indirectly, as demonstrated in this commit. Additionally, you would need to copy libpipy.so to the directory where the executable is located.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants