On Wed, Apr 1, 2020 at 2:06 AM Niels Möller nisse@lysator.liu.se wrote:
Jeffrey Walton noloader@gmail.com writes:
Tested mostly OK on my mac-mini:
Thanks for testing.
dyld: Library not loaded: /Users/jwalton/tmp/nettle/lib/libnettle.7.dylib
Is this the expected location after install, from
-install_name ${libdir}/$(LIBNETTLE_SONAME)
on the command linking libnettle.dylib?
I think that is a red herring that will take you down a rabbit hole. On OS X I build with -Wl,-rpath,@loader_path/../lib. Eventually, when the library is installed, it will be a good path.
But I don't think it is the problem here. The problem here seems to be DYLD_LIBRARY_PATH is empty, so the loader is falling back to the rpath.
Then maybe using DYLD_FALLBACK_LIBRARY_PATH could work a bit better, if the runtime linker only looks for libnettle.7.dylib in the given install location, and not in system directories. Will still not be correct if you install into a location where you have an older version but with the same soname, but at least will be correct in some more cases?
Referenced from: /Users/jwalton/Build-Scripts/nettle-master/testsuite/../tools/sexp-conv Reason: image not found cmp: EOF on test1.out FAIL: sexp-conv FAIL: pkcs1-conv FAIL: nettle-pbkdf2
The three failing tests are /bin/sh scripts running the binaries in tools/. I guess those still have DYLD_LIBRARY_PATH dropped from the environment, can you confirm?
To me, "system integrity protection", dropping DYLD_LIBRARY_PATH, seems a bit pointless in a setting where we're running code of our choice anyway.
Do you see any clean workaround? One could maybe delegate it further, similar to how $EMULATOR is handled.
Well, you patched run-tests, but you did not patch the other scripts. Maybe patch the other scripts?
I patch the other scripts and don't have a problem. I think the other scripts include testsuite/nettle-pbkdf2-test, testsuite/sexp-conv-test, testsuite/pkcs1-conv-test, examples/rsa-encrypt-test, examples/rsa-verify-test and examples/rsa-sign-test.
I believe some of the other scripts need patching because a call chain looks sometimes like the following.
run-tests => testsuite/sexp-conv-test => sexp-conv run-tests => testsuite/pkcs1-conv-test => pkcs1-conv run-tests => testsuite/nettle-pbkdf2-test => nettle-pbkdf2
(I did not study it in great detail, so I may be wrong about it. But some of the tests seemed to go outside of run-tests. The place to patch seems to be the last script before [compiled] test program is called).
Another workaround may be, provide a run-tests.in, testsuite/sexp-conv-test.in and friends. And then let Autotools patch the path into the scripts with a variable like @nettle_testlibdir@.
Jeff