Skip to content

Commit 702166d

Browse files
committed
Fix Cantera build issue: use pre-built wheel for Cantera, compile MFC deps from source
Cantera 3.1.0 has CMake compatibility issues when building from source with CMake 4.x (tries to build old yaml-cpp that requires CMake < 3.5). Solution: Use hybrid approach: - Install Cantera from pre-built wheel (doesn't need custom LDFLAGS) - Set LDFLAGS and compile MFC toolchain dependencies from source with --no-binary :all: to ensure orjson and other C extensions have proper header padding for bottle relocation This allows bottles to be created while avoiding the Cantera build failure.
1 parent 5ac2000 commit 702166d

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

packaging/homebrew/mfc.rb

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,21 @@ def install
2727
system Formula["[email protected]"].opt_bin/"python3.12", "-m", "venv", venv
2828
system venv/"bin/pip", "install", "--upgrade", "pip", "setuptools", "wheel"
2929

30+
# Install Cantera from PyPI using pre-built wheel (complex package, doesn't need custom flags)
31+
# Cantera has CMake compatibility issues when building from source with newer CMake versions
32+
system venv/"bin/pip", "install", "cantera==3.1.0"
33+
3034
# Set LDFLAGS to ensure Python C extensions (like orjson) are compiled with enough
3135
# header padding for Homebrew's bottle relocation process
3236
# This fixes "Failed changing dylib ID" errors during bottling
3337
ENV.append "LDFLAGS", "-Wl,-headerpad_max_install_names"
3438

35-
# Force pip to compile from source (not use pre-built wheels) to ensure
36-
# our LDFLAGS are applied. Pre-built wheels don't have proper header padding.
37-
pip_install_args = ["--no-binary", ":all:"]
38-
39-
# Install Cantera from PyPI (required dependency for MFC build)
40-
system venv/"bin/pip", "install", *pip_install_args, "cantera==3.1.0"
41-
4239
# Install MFC Python package and dependencies into venv
40+
# Force compilation from source (--no-binary :all:) to ensure our LDFLAGS are applied
41+
# Pre-built wheels don't have proper header padding for bottle relocation
4342
# Keep toolchain in buildpath for now - mfc.sh needs it there
4443
# Use editable install (-e) to avoid RECORD file issues when venv is symlinked at runtime
45-
system venv/"bin/pip", "install", *pip_install_args, "-e", buildpath/"toolchain"
44+
system venv/"bin/pip", "install", "--no-binary", ":all:", "-e", buildpath/"toolchain"
4645

4746
# Create symlink so mfc.sh uses our pre-installed venv
4847
mkdir_p "build"

0 commit comments

Comments
 (0)