-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
macos: dyld: Library not loaded: @rpath/libtest-77ee8c29c330e4a3.dylib #267
Comments
Thanks. This looks like an issue with a dynamic library provided by Rust, presumably created at build time, not being found at runtime. How is cargo installed? I'm guessing a rustup based installation sets particular environment variables that a nix install doesn't. |
OK, I know what's going on—we need to grab the value of "rustc --print sysroot" and set the sysroot path as part of LD_FALLBACK_LIBRARY_PATH properly. Will fix in the next couple of days or you're welcome to fix it as well. |
This method needs to be updated to also grab the sysroot: nextest/nextest-runner/src/list/test_list.rs Line 385 in 3ab960d
|
thanks for looking into this @sunshowers.
it's provided by a nix-shell derivation which makes use of functions from here: https://github.com/oxalica/rust-overlay/.
this is possible and could be easily resolved in the nix-shell setup as well. i'm puzzled by the difference in linux and macos. the nix-shell input is identical for both environments. are you aware of any rust specific platform differences that influences what cargo-nextest sees? |
I'm not sure what nix is doing, but it does look like they had to work around a very similar issue on just macOS here: https://github.com/oxalica/rust-overlay/blob/44801306a2aa0e9aaa47588d615ce6df4acf18c6/mk-component-set.nix#L89 |
This is exactly what we would have to fix, except we'll use DYLD_FALLBACK_LIBRARY_PATH rather than adding the rpath to the binary. |
looks like there's already a TODO for this in the codebase:
|
Yeah that definitely looks like it. I'm not sure how this would work with reused builds. We currently promise not to require rustc, but we may not be able to uphold that promise when dealing specifically with proc-macro tests. |
it seems like this isn't effective. i ran the following on the github macos runner and it still produced the same error:
on the positive side, the path looks healthy:
i'll look into whether the nextest-runner does not forward this environment variable to the test binary, which would be an explanation. or maybe we do need to modify the rpath after all. EDIT: whops, i used |
You want |
with this correct path the workaround described above works indeed, thank you 🙌 now, i think it's worth putting a best-effort solution into cargo-nextest the way you described. trying to think about how we could solve this without shelling out and thus depending on |
Agreed about supporting it properly by updating the sysroot, though given the complexity and edge case nature here (only occurs for proc-macro tests + not using cargo from rustup) I'm going to prioritize it downwards because a workaround exists for now. However, if someone would like to send a PR then that would be really appreciated as well! I'll outline the main things that need to be done, for both someone who would like to contribute a PR and also for my future self:
For testing:
And a similar thing should be done for reused builds. This is hard to do within the current nextest suite because it runs under cargo (we want to minimize the things that can add a libdir to the dylib path), so it should should be a script within the This is likely 2-3 days of work that I think can be done by a contributor willing to dive into this! |
@DaniPopes if you'd be down to do this, go for it |
@sunshowers I've also encountered this when running: export CARGO='cargo'
cargo-nextest nextest run --workspace --target x86_64-unknown-linux-gnu --no-default-features --features rustls,fancy-with-backtrace,zstd-thin,log_release_max_level_debug,pkg-config in our CI. However, if I run:
then it would work fine, presumably because Also, I'm now trying to get |
See nextest-rs/nextest#267 Signed-off-by: Roman Volosatovs <[email protected]>
`proc-macro` crate tests require additional config See nextest-rs/nextest#267 Signed-off-by: Roman Volosatovs <[email protected]>
`proc-macro` crate tests require additional config See nextest-rs/nextest#267 Signed-off-by: Roman Volosatovs <[email protected]>
`proc-macro` crate tests require additional config See nextest-rs/nextest#267 Signed-off-by: Roman Volosatovs <[email protected]>
Prevents this error: ``` (...) dyld: Library not loaded: @rpath/libtest-77ee8c29c330e4a3.dylib Referenced from: /private/tmp/holochain_repo/target/fast-test/deps/hdk_derive-73ec051829ad694a Reason: image not found error: creating test list failed Caused by: for `hdk_derive::proc-macro/hdk_derive`, running command `/private/tmp/holochain_repo/target/fast-test/deps/hdk_derive-73ec051829ad694a --list --format terse` failed Caused by: command ["/private/tmp/holochain_repo/target/fast-test/deps/hdk_derive-73ec051829ad694a", "--list", "--format", "terse"] exited with code <signal 6> Error: Process completed with exit code 104. ``` nextest-rs/nextest#267
Prevents this error: ``` (...) dyld: Library not loaded: @rpath/libtest-77ee8c29c330e4a3.dylib Referenced from: /private/tmp/holochain_repo/target/fast-test/deps/hdk_derive-73ec051829ad694a Reason: image not found error: creating test list failed Caused by: for `hdk_derive::proc-macro/hdk_derive`, running command `/private/tmp/holochain_repo/target/fast-test/deps/hdk_derive-73ec051829ad694a --list --format terse` failed Caused by: command ["/private/tmp/holochain_repo/target/fast-test/deps/hdk_derive-73ec051829ad694a", "--list", "--format", "terse"] exited with code <signal 6> Error: Process completed with exit code 104. ``` nextest-rs/nextest#267
Prevents this error: ``` (...) dyld: Library not loaded: @rpath/libtest-77ee8c29c330e4a3.dylib Referenced from: /private/tmp/holochain_repo/target/fast-test/deps/hdk_derive-73ec051829ad694a Reason: image not found error: creating test list failed Caused by: for `hdk_derive::proc-macro/hdk_derive`, running command `/private/tmp/holochain_repo/target/fast-test/deps/hdk_derive-73ec051829ad694a --list --format terse` failed Caused by: command ["/private/tmp/holochain_repo/target/fast-test/deps/hdk_derive-73ec051829ad694a", "--list", "--format", "terse"] exited with code <signal 6> Error: Process completed with exit code 104. ``` nextest-rs/nextest#267
All right, so as the flurry of activity above suggests, we ended up being forced to fix this due to a rustup behavior change on Windows.
That should address this class of issues comprehensively, in all situations including archives (we now include libstd in archives -- unconditionally for now, but we could get smarter and/or add config knobs in the future). After #1514, nextest will no longer depend on rustup. It'll continue to depend on cargo, of course, until #842 is resolved. |
cargo-nextest 0.9.72 is out with a fix for this. Try it out! |
Note from maintainer: Here's an outline of the work required for this. Please dive in if you're interested!
we're having issues running
cargo nextest
in a nix-shell on a macos github actions runner.we run the same steps on an ubuntu runner in parallel which succeeds, so this seems to be macos specific.
it may or may not have something to do that the tested source code is under
/tmp
, which on this macos runner has an implicit/private/
prefix.some references for context:
cargo nextest
please let me know if i can provide further debug output to help us understand what's happening.
The text was updated successfully, but these errors were encountered: