Closed nullus closed 1 year ago
In principle I'm ok with the addition but I'm curious why you need that for a successful macOS arm64 installation. What's the error when running the following as shown in the README?
git clone https://github.com/letmaik/rawpy
cd rawpy
pip install numpy cython
pip install .
There's no error when running the process above, but there was back when I first needed this package (Dec 2022), and it is also my preference in the case where I'm manually installing.
Of course native M1 wheels will remove the need for manual installs!
Building using the suggested method results in an .so linked to the .dylib in external/ directory:
otool -L .venv/lib/python3.11/site-packages/rawpy/_rawpy.cpython-311-darwin.so
.venv/lib/python3.11/site-packages/rawpy/_rawpy.cpython-311-darwin.so:
/Users/nullus/src/rawpy/external/LibRaw-cmake/build/install/lib/libraw_r.23.dylib (compatibility version 23.0.0, current version 23.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
Which breaks if the build is cleaned/moved:
Python 3.11.4 (main, Jun 20 2023, 17:23:00) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import rawpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/nullus/src/rawpy/.venv/lib/python3.11/site-packages/rawpy/__init__.py", line 5, in <module>
import rawpy._rawpy
ImportError: dlopen(/Users/nullus/src/rawpy/.venv/lib/python3.11/site-packages/rawpy/_rawpy.cpython-311-darwin.so, 0x0002): Library not loaded: /Users/nullus/src/rawpy/external/LibRaw-cmake/build/install/lib/libraw_r.23.dylib
Referenced from: <05D6F88B-D3C5-3C54-AD71-89A2A14954F9> /Users/nullus/src/rawpy/.venv/lib/python3.11/site-packages/rawpy/_rawpy.cpython-311-darwin.so
Reason: tried: '/Users/nullus/src/rawpy/external/LibRaw-cmake/build/install/lib/libraw_r.23.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/nullus/src/rawpy/external/LibRaw-cmake/build/install/lib/libraw_r.23.dylib' (no such file), '/Users/nullus/src/rawpy/external/LibRaw-cmake/build/install/lib/libraw_r.23.dylib' (no such file), '/usr/local/lib/libraw_r.23.dylib' (no such file), '/usr/lib/libraw_r.23.dylib' (no such file, not in dyld cache)
Got it, yeah you'd have to run delocate-wheel
to bundle the dylib: delocate-wheel dist/*.whl
. That's what's happening in CI. I'll merge the PR since it's useful and doesn't break anything.
I made this modification locally to support using the system libraw on macOS, which I installed via Homebrew.
At the time builds on macOS arm64 were breaking (still no wheels available), and this was a quick way for me to get the package installed. I prefer using a shared library anyway, but that might just be me.
Presented here with minimal changes. If you want it let me know what else is required