cbcbox macOS libraries are killed on load

Open Beginner friendly
#428 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
macos, python
Domain
build-system

Research direction

Start in setup.py, where install_name_tool and strip -x process the bundled macOS libraries. Reproduce the failure with the provided ctypes command, then verify that the shipped OpenBLAS and CBC libraries load successfully after packaging; confirm with codesign -dv and the Model(solver_name="CBC") path.

Written by the indexing model from the issue text.

Description

@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: https://github.com/ghackebeil/cbcbox/commit/39243b2e30a2a71a28120db4c660d6b6d69d2284

Dominant language
Linear Programming
Stars
601
Forks
108
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from coin-or/python-mip

All issues in coin-or/python-mip

Similar issues

More Build System issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.