Skip to content

Commit 028e017

Browse files
committed
Fix orjson dylib relocation by forcing source compilation
The issue was that orjson (a transitive dependency) was being installed as a pre-built wheel from PyPI, which doesn't have sufficient header padding for Homebrew's bottle relocation process. Solution: 1. Install all dependencies normally (including wheels) 2. Force-reinstall orjson from source with LDFLAGS set 3. Use --no-deps to avoid reinstalling dependencies This ensures orjson is compiled with -Wl,-headerpad_max_install_names which provides the necessary header space for brew test-bot to successfully relocate the dylib during bottling.
1 parent d302bd2 commit 028e017

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

packaging/homebrew/mfc.rb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,26 @@ def install
3131
# Cantera has CMake compatibility issues when building from source with newer CMake versions
3232
system venv/"bin/pip", "install", "cantera==3.1.0"
3333

34-
# Set LDFLAGS to ensure Python C extensions (like orjson) are compiled with enough
34+
# Set LDFLAGS to ensure Python C extensions are compiled with enough
3535
# header padding for Homebrew's bottle relocation process
3636
# This fixes "Failed changing dylib ID" errors during bottling
3737
ENV.append "LDFLAGS", "-Wl,-headerpad_max_install_names"
38+
ENV.append "CFLAGS", "-Wl,-headerpad_max_install_names"
39+
ENV.append "CXXFLAGS", "-Wl,-headerpad_max_install_names"
3840

3941
# Install MFC Python package and dependencies into venv
4042
# Use editable install (-e) to avoid RECORD file issues when venv is symlinked at runtime
41-
# Most dependencies use pre-built wheels; only packages with C extensions will be compiled
43+
# Most dependencies use pre-built wheels initially
4244
# Keep toolchain in buildpath for now - mfc.sh needs it there
4345
system venv/"bin/pip", "install", "-e", buildpath/"toolchain"
4446

47+
# Force-reinstall packages with C extensions from source with proper LDFLAGS
48+
# This ensures they have correct header padding for bottle relocation
49+
# orjson is a transitive dependency that comes from pre-built wheels without proper padding
50+
# --no-deps prevents reinstalling dependencies, only the target package
51+
system venv/"bin/pip", "install", "--no-binary", ":all:", "--force-reinstall",
52+
"--no-deps", "orjson"
53+
4554
# Create symlink so mfc.sh uses our pre-installed venv
4655
mkdir_p "build"
4756
ln_sf venv, "build/venv"

0 commit comments

Comments
 (0)