creachadair / imath

Arbitrary precision integer and rational arithmetic library
Other
129 stars 20 forks source link

gmp-compat-test does not work on macOS #26

Closed creachadair closed 5 years ago

creachadair commented 5 years ago

Repro:

make distclean gmp-compat-test

Expected: tests run and, ideally, pass.

Observed:

Running gmp-compat unit tests
Printing progress after every 100,000 tests
make -C tests/gmp-compat-test TESTS="-p 100000 random.tests"
./genctest.py imath > imath_test.c
cc -fPIC -I../..   -c -o imath_test.o imath_test.c
gcc -shared -I../.. -L../.. -limath -o imath_test.so imath_test.o
./genctest.py gmp > gmp_test.c
cc -fPIC -I../..   -c -o gmp_test.o gmp_test.c
gcc -shared -lgmp -o gmp_test.so gmp_test.o
./genpytest.py > wrappers.py
./runtest -p 100000 random.tests
Traceback (most recent call last):
  File "runtest.py", line 94, in <module>
    imath_test_so = ctypes.cdll.LoadLibrary("imath_test.so")
  File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ctypes/__init__.py", line 434, in LoadLibrary
    return self._dlltype(name)
  File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ctypes/__init__.py", line 356, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(imath_test.so, 6): Library not loaded: libimath.so
  Referenced from: /Users/michael/Documents/software/imath/tests/gmp-compat-test/imath_test.so
  Reason: image not found
make[1]: *** [runtest] Error 1
make: *** [gmp-compat-test] Error 2

This is probably some silly path flag issue. I merged a bunch of icky GMP changes without really paying attention and should probably go back and disentangle that stuff into a contrib directory.

creachadair commented 5 years ago

Recapping 56c40f4: For whatever reason, macOS doesn't respect LD_LIBRARY_PATH, but wants to use DYLD_LIBRARY_PATH instead. Once I fixed that, everything seems to work again.