Skip to content

[Bug] macOS ARM64 wheel 0.2.4 fails to load libSpinQInterface due to $ORIGIN rpath #17

Description

@aaaabang

Bug: macOS ARM64 wheel 0.2.4 fails to load libSpinQInterface due to $ORIGIN rpath

Environment

  • OS: macOS
  • Architecture: Apple Silicon (ARM64)
  • Python: 3.10
  • SpinQit: 0.2.4
  • Installation: PyPI wheel
  • Wheel: spinqit-0.2.4-cp310-cp310-macosx_13_0_arm64.whl

Problem

After installing SpinQit 0.2.4 from PyPI, importing the package fails with:

ImportError: dlopen(.../spinq_backends.cpython-310-darwin.so, 0x0002):
Library not loaded: @rpath/libSpinQInterface_darwin_arm_64.dylib

The required dynamic library is actually included in the installed package:

spinqit/
├── spinq_backends.cpython-310-darwin.so
└── libSpinQInterface_darwin_arm_64.dylib

However, otool shows that the extension uses $ORIGIN as its LC_RPATH:

$ otool -l spinq_backends.cpython-310-darwin.so | grep -A3 LC_RPATH

cmd LC_RPATH
cmdsize 24
path $ORIGIN (offset 12)

The dependency is:

$ otool -L spinq_backends.cpython-310-darwin.so

@rpath/libSpinQInterface_darwin_arm_64.dylib

Verification with the original PyPI wheel

I also downloaded the original PyPI wheel directly using:

pip download --only-binary=:all: --no-deps spinqit==0.2.4

After extracting the wheel, the same $ORIGIN rpath is present in the original wheel:

spinqit-0.2.4-cp310-cp310-macosx_13_0_arm64.whl

LC_RPATH
    path $ORIGIN

The wheel contains both:

spinqit/spinq_backends.cpython-310-darwin.so
spinqit/libSpinQInterface_darwin_arm_64.dylib

Workaround

The import succeeds if I manually add the spinqit directory to DYLD_LIBRARY_PATH:

export DYLD_LIBRARY_PATH="$PWD/.venv/lib/python3.10/site-packages/spinqit:$DYLD_LIBRARY_PATH"

After that:

python -c "import spinqit"

works successfully.

Expected behavior

Since libSpinQInterface_darwin_arm_64.dylib is included in the same package directory as spinq_backends.cpython-310-darwin.so, I would expect the wheel to load the library without requiring users to manually configure DYLD_LIBRARY_PATH.

Could you please confirm whether the $ORIGIN LC_RPATH in the macOS ARM64 wheel is intentional?

If not, could the wheel be rebuilt with the appropriate macOS relative library path, such as @loader_path?

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions