Skip to content

Python shared library loading is broken on MacOS #196

@acruise

Description

@acruise

When I install regopy in my project, on an Intel mac, it drops both Linux and MacOS shared libraries:

$ ls -lart .venv/lib/python3.12/site-packages/regopy/librego_shared*
-rwxr-xr-x   1 alex  staff  14628328 Oct 27 10:30 librego_shared.dylib
-rwxr-xr-x   1 alex  staff  11993784 Oct 27 10:30 librego_shared.so

Unfortunately, in this code, regopy tries to load the .so file just because it exists, rather than checking which OS it's running on first, so I get this delightfully Google-sparse error message:

OSError: dlopen(.../.venv/lib/python3.12/site-packages/regopy/librego_shared.so, 0x0006): tried: '.../.venv/lib/python3.12/site-packages/regopy/librego_shared.so' (slice is not valid mach-o file), '/System/Volumes/Preboot/Cryptexes/OS/.../.venv/lib/python3.12/site-packages/regopy/librego_shared.so' (no such file), '.../.venv/lib/python3.12/site-packages/regopy/librego_shared.so' (slice is not valid mach-o file)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions