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

dyld[27309]: Library not loaded: @rpath/libtest-01ad18af57f4eecf.dylib on MacOS (or with mold on Linux) #962

Closed
dpc opened this issue Sep 16, 2023 · 6 comments

Comments

@dpc
Copy link

dpc commented Sep 16, 2023

I just migrated our project to nextest, landed the PR, just to discover it is broken on MacOS (which we test only on master branch, because GH MacOS runner is soooo slow).

After some looking I wonder: if the reason for it the macOS System Integrity Protection sanitization issue?

If so - I don't understand why am I supposed to do with the extra env variables, or rather ... where exacty. I don't think I'm using any target runners.

Full output:

$ cargo nextest run --no-run
    Finished test [unoptimized + debuginfo] target(s) in 0.51s
error: creating test list failed

Caused by:
  for `fedimint-derive::proc-macro/fedimint_derive`, command `/Users/runner/tmp/fedimint/target/debug/deps/fedimint_derive-0268f54e86f9ab6b --list --format terse` exited with signal 6 (SIGABRT)
--- stdout:

--- stderr:
dyld[31922]: Library not loaded: @rpath/libtest-01ad18af57f4eecf.dylib
  Referenced from: <no uuid> /Users/runner/tmp/fedimint/target/debug/deps/fedimint_derive-0268f54e86f9ab6b
  Reason: tried: '/System/Library/Frameworks/libtest-01ad18af57f4eecf.dylib' (no such file, not in dyld cache), '/System/Volumes/Preboot/Cryptexes/OS/System/Library/Frameworks/libtest-01ad18af57f4eecf.dylib' (no such file), '/System/Library/Frameworks/libtest-01ad18af57f4eecf.dylib' (no such file, not in dyld cache), '/System/Volumes/Preboot/Cryptexes/OS/System/Library/Frameworks/libtest-01ad18af57f4eecf.dylib' (no such file), '/Users/runner/tmp/fedimint/target/debug/build/bzip2-sys-f147f00e3c7bd833/out/lib/libtest-01ad18af57f4eecf.dylib' (no such file), '/Users/runner/tmp/fedimint/target/debug/build/librocksdb-sys-099d0c46376f143d/out/libtest-01ad18af57f4eecf.dylib' (no such file), '/Users/runner/tmp/fedimint/target/debug/build/libsqlite3-sys-16aeb35454a560bd/out/libtest-01ad18af57f4eecf.dylib' (no such file), '/Users/runner/tmp/fedimint/target/debug/build/libz-sys-aca9a3d7ce7e8072/out/lib/libtest-01ad18af57f4eecf.dylib' (no such file), '/Users/runner/tmp/fedimint/target/debug/build/lz4-sys-eaf2000877b26334/out/libtest-01ad18af57f4eecf.dylib' (no such file), '/Users/runner/tmp/fedimint/target/debug/build/ring-8399b7d27e1580d0/out/libtest-01ad18af57f4eecf.dylib' (no such file), '/Users/runner/tmp/fedimint/target/debug/build/secp256k1-sys-202b4797af0d23a4/out/libtest-01ad18af57f4eecf.dylib' (no such file), '/Users/runner/tmp/fedimint/target/debug/build/secp256k1-sys-6c26d5e24aeebaa8/out/libtest-01ad18af57f4eecf.dylib' (no such file), '/Users/runner/tmp/fedimint/target/debug/build/secp256k1-zkp-sys-70a2dd2313be40d8/out/libtest-01ad18af57f4eecf.dylib' (no such file), '/Users/runner/tmp/fedimint/target/debug/build/zstd-sys-3f00e657302f58e2/out/libtest-01ad18af57f4eecf.dylib' (no such file), '/Users/runner/tmp/fedimint/target/debug/deps/libtest-01ad18af57f4eecf.dylib' (no such file), '/Users/runner/tmp/fedimint/target/debug/libtest-01ad18af57f4eecf.dylib' (no such file), '/Users/runner/lib/libtest-01ad18af57f4eecf.dylib' (no such file), '/usr/local/lib/libtest-01ad18af57f4eecf.dylib' (no such file), '/usr/lib/libtest-01ad18af57f4eecf.dylib' (no such file, not in dyld cache)

---
@dpc
Copy link
Author

dpc commented Sep 16, 2023

OK. So I've found a helpful comment. And was able to fix it with:

$ env DYLD_FALLBACK_LIBRARY_PATH=/nix/store/vi0fm4l0xbx4yw2x45fiiybaa2jlk7xp-rust-stable-with-components-2023-08-24/lib/ cargo nextest run --no-run
    Finished test [unoptimized + debuginfo] target(s) in 0.53s

I guess I can work-around it in our Nix dev shell. Maybe it will be helpful for someone else.

@sunshowers
Copy link
Member

sunshowers commented Sep 17, 2023

This is unrelated to SIP, since there are no system binaries involved.

cargo should be responsible for setting this environment variable, so that's really strange.

@dpc
Copy link
Author

dpc commented Sep 17, 2023

What does "system binary" mean here exactly?

@dpc dpc changed the title dyld[27309]: Library not loaded: @rpath/libtest-01ad18af57f4eecf.dylib on MacOS dyld[27309]: Library not loaded: @rpath/libtest-01ad18af57f4eecf.dylib on MacOS (or with mold) Sep 18, 2023
@dpc
Copy link
Author

dpc commented Sep 18, 2023

Coincidentally, I think I've just reproduced this problem on Linux, when I attempted to use mold as a linker. Similiar workaround works (wrapper that makes LD_LIBRARY_PATH point directory with that library, though after that I'm getting different library missing (librocksdb.so.7).

@dpc dpc changed the title dyld[27309]: Library not loaded: @rpath/libtest-01ad18af57f4eecf.dylib on MacOS (or with mold) dyld[27309]: Library not loaded: @rpath/libtest-01ad18af57f4eecf.dylib on MacOS (or with mold on Linux) Sep 18, 2023
@dpc
Copy link
Author

dpc commented Sep 18, 2023

OK. Closing as a dup of #267

@dpc dpc reopened this Sep 18, 2023
@dpc dpc closed this as completed Sep 18, 2023
@dpc
Copy link
Author

dpc commented Sep 18, 2023

Nvmd. The Linux problem was a missing mold wrapper for Nix.

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