networkit icon indicating copy to clipboard operation
networkit copied to clipboard

Building a wheel on macOS arm64 creates x86_64 libraries

Open fabratu opened this issue 2 years ago • 0 comments

For macOS Sonoma and AppleClang 15.X (maybe also older versions), a wheel build of NetworKit creates x86_64 libraries per default, even if invoked on an arm64 machine.

Example:

CXX=c++ python -m pip wheel . --wheel-dir=dist --no-deps
pip install dist/networkit-11.0-cp310-cp310-macosx_14_0_arm64.whl

python -c 'import networkit'
ImportError: ***/site-packages/networkit/[graph.cpython-310-darwin.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

This can be mitigated by properly set OSX_ARCHITECTURES in CMake:

SET(CMAKE_OSX_ARCHITECTURES "arm64")

Better would be even to build an universal wheel in case of an arm64 platform or forced by parameter (on CI systems).

fabratu avatar Jan 31 '24 05:01 fabratu