Closed ryandesign closed 10 months ago
My preliminary patch is:
--- tests/Makefile.am.orig 2023-10-14 12:27:15.000000000 -0500
+++ tests/Makefile.am 2024-01-16 02:35:24.000000000 -0600
@@ -89,6 +89,7 @@
export prefix=$(prefix); \
export sysconfdir=$(sysconfdir); \
export bindir=$(bindir); \
+ export libdir=$(libdir); \
export abs_srcdir=$(abs_srcdir); \
export DIFF=$(DIFF); \
export PATH_CONVERT=$(PATH_CONVERT); \
--- tests/run-test.orig 2023-04-12 12:28:24.000000000 -0500
+++ tests/run-test 2024-01-16 01:55:41.000000000 -0600
@@ -105,6 +105,7 @@
cd ..
${MAKE} install DESTDIR="$test_dir"
export PATH="$test_dir/$bindir:$PATH"
+export DYLD_LIBRARY_PATH="$test_dir/$libdir"
cd "$test_dir"
# Set up paper configuration
however that only fixes eight of the tests. Six of the remaining tests are failing due to #35; for the final eight failures, I'm not sure of the cause yet.
Thanks very much for filing this issue and trying to fix it.
I'm a bit puzzled, because CI runs the tests on macOS, and they pass. Could you possibly look at .github/workflows/c-cpp.yml
and see if there's anything I do there (no "tricks" that I can see) that would make a difference? In particular, did you configure with --enable-relocatable
?
Right, you're using --enable-relocatable
which makes the problem go away.
I'm intentionally not using that flag.
Ah, that makes sense. In that case, I'd be happy to merge your patch above, as it's simple and a step towards running the tests on all platforms without --enable-relocatable
, which would be an improvement.
Ok, I submitted a PR for it, which will close this issue, and I'll file a new issue for the remaining test failures since they seem to have a different cause.
All tests fail on macOS:
because your test programs link with libpaper.dylib by the absolute path where it will eventually be installed but it has not been installed there yet:
and if it did exist at that location you wouldn't want to use it because it could be a different version than the one you just built and your test programs might not be compatible with that version of the library.
To use the just-built version of the library in your tests, you must set the
DYLD_LIBRARY_PATH
environment variable to the path of the directory where libpaper.dylib is located in the build tree so that the test programs can find it. You must set it right at the point where you run the programs that link with the library; you cannot set it from a higher-level script or Makefile because DYLD environment variables are not passed to subprocesses.Your programs and library are built with libtool which provides you with wrapper scripts which handle this for you but your test suite ignores those wrapper scripts and instead uses
make install
to install the software to a temporary location and run it from there, at which point it becomes your responsibility to setDYLD_LIBRARY_PATH
to make that possible.