The suffix .so is common in unix for shared library.
However, with Mac OS the following error occurs
Traceback (most recent call last):
File "serval/src/serval.py", line 39, in <module>
import cspline as spl
File "serval/src/cspline.py", line 22, in <module>
_cbspline = np.ctypeslib.load_library(os.path.join(os.path.dirname(__file__), 'cbspline'), '.')
File ".../site-packages/numpy/ctypeslib.py", line 155, in load_library
raise OSError("no file with expected extension")
OSError: no file with expected extension
On Mac OS python -c "from numpy.distutils.misc_util import get_shared_lib_extension; print(get_shared_lib_extension())" results in .dylib.
Including the suffix .so explicitly seems to solve the problem.
Since the purpose of np.ctypeslib.load_library is mainly to find the suffix, is not used anymore, just ctypes.cdll or ctypes.CDLL might be used.
The readme suggests compiling with
The suffix
.so
is common in unix for shared library. However, with Mac OS the following error occursCurrently, np.ctypeslib.load_library is used in https://github.com/mzechmeister/serval/blob/1542d0b267bea08b13a807aebf20374675946494/src/cspline.py#L22 which guesses the extension in
https://github.com/numpy/numpy/blob/92ebe1e9a6aeb47a881a1226b08218175776f9ea/numpy/ctypeslib.py#L130 and finally uses
ctypes.cdll
in L150.On Mac OS
python -c "from numpy.distutils.misc_util import get_shared_lib_extension; print(get_shared_lib_extension())"
results in.dylib
.Including the suffix
.so
explicitly seems to solve the problem. Since the purpose of np.ctypeslib.load_library is mainly to find the suffix, is not used anymore, justctypes.cdll
orctypes.CDLL
might be used.