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

NSS_Initialize failed #482

Closed
EngAlaaEmad opened this issue Mar 7, 2020 · 7 comments
Closed

NSS_Initialize failed #482

EngAlaaEmad opened this issue Mar 7, 2020 · 7 comments
Labels
help wanted Extra attention is needed p3 Backlog

Comments

@EngAlaaEmad
Copy link

i followed the readme instruction to build Neqo but when i ran this command
./target/debug/neqo-server 12345 -k key --db ./test-fixture/db i got this error

thread 'main' panicked at 'NSS_Initialize failed: NssError { name: "PR_LOAD_LIBRARY_ERROR", code: -5977, desc: "Failure to load dynamic library" }', src/libcore/result.rs:1188:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

any help please , Thanks in advance

@martinthomson
Copy link
Member

This is the result of not having $LD_LIBRARY_PATH (or $DYLD_LIBRARY_PATH) set. When you build using an external NSS, the binaries don't get correctly annotated and so you have to tell it where NSS is manually. I haven't worked out why the linker ignores instructions that should have fixed this.

@EngAlaaEmad
Copy link
Author

i understood but how can i fix it, please?

@agrover agrover added the help wanted Extra attention is needed label Apr 28, 2020
@abbcdfin
Copy link
Collaborator

Hi @martinthomson,
Just want to check by "correctly annotated", do you mean the rpath inserted during the building process? I would like to have a look at this issue if it has not been resolved yet. Thanks.

@martinthomson
Copy link
Member

Yes, attempting to set the rpath by passing arguments to the linker doesn't seem to work (or at least I tried several approaches and got nowhere). If you have more experience with this, then I'd be very happy for the help.

@abbcdfin
Copy link
Collaborator

abbcdfin commented Jun 3, 2020

Hi @martinthomson,

Sorry for could not attend this issue earlier, got stuck with something at work.

Previously the thing does not make sense to me is that if NSS was built inside the project, then we do not need to set the LD_LIBRARY_PATH. After reading the Cargo Book, it makes sense now.

The rustc-link-search instruction tells Cargo to pass the -L flag to the compiler to add a directory to the library search path. The optional KIND may be one of dependency, crate, native, framework, or all. See the rustc book for more detail.
These paths are also added to the dynamic library search path environment variable if they are within the OUT_DIR.

Regarding setting the rpath in the build script, seems it is still an open issue in Cargo:
rust-lang/cargo#5077

So far I could not think of any cleaner way of doing this. What was your plan previously?

Cheers.

@martinthomson
Copy link
Member

Don't stress about timing. We're muddling along with LD_LIBRARY_PATH :)

All I had was the rpath tweak, which the docs seem to imply is possible, but as you say it doesn't work (I will concede that maybe I'm just not holding it right).

@ddragana ddragana added the p3 Backlog label Nov 24, 2021
@edgul
Copy link

edgul commented Dec 13, 2022

I haven't had a moment to fully investigate, but in case this is helpful to someone, here is my experience with this issue.

After building neqo in $HOME/mozilla/neqo with external $HOME/nss and $HOME/nspr with environment variable set, I was able to run cargo run --bin neqo-server -- [::]:12345 --db ./test-fixture/db. But then in new shell ./target/debug/neqo-client http://127.0.0.1:12345/ was yielding similar error as comment 1.

Exporting proper variables did not work.
Exporting variables in new shell did not work.
Rebuilding nss (clean) and neqo (clean) did not work.

It was only after re-cloning neqo in a different dir $HOME/neqo and rebuilding did I get past the error. (At this point I am not certain if re-clone into same dir location would have worked, so worth mentioning).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed p3 Backlog
Projects
Status: Closed
Development

No branches or pull requests

7 participants