Skip to content

cbcbox macOS libraries are killed on load #428

Description

@ghackebeil

@h-g-s: I'm requesting a fix in your cbcbox repo, but I can't open a pull request or issue against it due to it being a fork, so I'm doing that here.

I've only verified this behavior on on macOS 26.7 (arm64), but it seems that cbcbox 2.935 dies as soon as its bundled OpenBLAS is loaded:

python -c 'import cbcbox, ctypes, os; ctypes.CDLL(os.path.join(cbcbox.cbc_lib_dir(), "libopenblas.0.dylib"))'

Exit 137, no traceback. Model(solver_name="CBC") dies the same way, because libCbc.dylib pulls that library in.

The problem seems to be that setup.py runs install_name_tool and then strip -x on the bundled binaries. Both invalidate the linker's signature, and nothing re-signs afterwards. codesign -dv on the shipped library reports flags=0x20002(adhoc,linker-signed).

Signing after both steps seems to fix the issue:

codesign --force --sign - <path>

The signature then becomes flags=0x2(adhoc), and the library loads.

Here's a patch to setup.py: ghackebeil/cbcbox@39243b2

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions