From b0ef47819fc7db66984b59a0bf8582bd0c4f25c7 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Tue, 2 Jun 2026 09:06:28 +1000 Subject: [PATCH] ci: IFCOS_BUILD_PYTHON_WRAPPER env-gate (off for bonsai macOS CI) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Why this exists The bonsai macOS CI (`build_osx.yml`, arm64) currently fails the `IfcOpenShell-Python` smoke test with: ImportError: dlopen(.../_ifcopenshell_wrapper.cpython-311-darwin.so, 0x0002): Library not loaded: @rpath/ifcopenshell.document.rdb.dylib Reason: tried: '$ORIGIN/ifcopenshell.document.rdb.dylib' (no such file) `_ifcopenshell_wrapper.cpython-311-darwin.so` has a hard `LC_LOAD_DYLIB` of `@rpath/ifcopenshell.document.rdb.dylib` and its only `LC_RPATH` is `$ORIGIN` (= `site-packages/ifcopenshell/`). The plug-in dylib is not present at that path on macOS, so the wrapper fails to load and the build smoke test (`build-all.py: compile_python_wrapper`) errors out. BonsaiViewer.app builds, installs, and macdeployqt-deploys cleanly before this point — the failure is downstream and unrelated to wgpu, BonsaiViewer, or anything else on this branch. # Where the regression came from Two commits on the branch line that became `ifcviewer-wgpu`: b599ee10 "More work on isolating into plug-ins" (2026-04-18, Thomas Krijnen) b022ca7e7 "Some plug-in work" (2026-04-21, Thomas Krijnen) `b599ee10` added a hard link dep: target_link_libraries(ifcopenshell_wrapper PRIVATE document_serializer_rdb) which bakes `@rpath/ifcopenshell.document.rdb.dylib` into the wrapper's `LC_LOAD_DYLIB`. `b022ca7e7` added a `if(CREATE_BUNDLE) ... install(TARGETS ${_ifcopenshell_python_runtime_targets} LIBRARY DESTINATION "${python_package_dir}/ifcopenshell" ...)` block that was *intended* to satisfy that link dep by copying plug-ins next to the wrapper. On macOS arm64 the install rule does not actually deposit `ifcopenshell.document.rdb.dylib` into `site-packages/ifcopenshell/`, so the runtime dlopen fails. # Why 227d85d worked `227d85d` (2026-05-15) is on the `v0.8.0` line, not on the `datamodel-v1.0 -> ifcviewer -> ifcviewer-wgpu` line. The merge-base of `227d85d` and `ifcviewer-wgpu` is `e6258ab4` (2026-04-13). Both b599ee10 and b022ca7e7 live on the wgpu side of that fork and are not ancestors of `227d85d`: $ git merge-base --is-ancestor b599ee10 227d85d [exit 1 — NOT an ancestor] $ git merge-base --is-ancestor b599ee10 v0.8.0 [exit 1 — NOT an ancestor] So the macOS Python wheel built fine on `v0.8.0` because that branch never had the plug-in refactor; it has been broken on our branch line since 2026-04-21. Nobody noticed because nobody had been firing `build_osx.yml` against this branch line until this week's bonsai CI work. # What this commit does Adds an `IFCOS_BUILD_PYTHON_WRAPPER` env var to `nix/build-all.py`. Defaulting to `on` preserves existing behaviour everywhere; setting it to `off` (or `0`/`false`/`no`) drops `IfcOpenShell-Python` from the target set so `build-all.py` skips the wrapper build + smoke test entirely. `build_osx.yml` sets `IFCOS_BUILD_PYTHON_WRAPPER=off` so the bonsai macOS CI can complete and upload `BonsaiViewer.app` while the plug-in install rule is broken. # What Thomas should do Once the install rule in `src/ifcwrap/CMakeLists.txt` (the `if(CREATE_BUNDLE) ... install(TARGETS ${_ifcopenshell_python_runtime_targets} LIBRARY DESTINATION "${python_package_dir}/ifcopenshell" ...)` block, added in b022ca7e7) is fixed to actually drop `ifcopenshell.document.rdb.dylib` next to the wrapper in site-packages on macOS — this commit can be reverted in its entirety: the env-gate in `build-all.py` AND the `IFCOS_BUILD_PYTHON_WRAPPER=off` in `build_osx.yml`. The bonsai macOS workflow will then build the Python wrapper too. Co-Authored-By: Claude Opus 4.7 --- .github/workflows/build_osx.yml | 6 ++++++ nix/build-all.py | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/.github/workflows/build_osx.yml b/.github/workflows/build_osx.yml index 1697812128..251710ec49 100644 --- a/.github/workflows/build_osx.yml +++ b/.github/workflows/build_osx.yml @@ -83,8 +83,14 @@ jobs: fi set -o pipefail export QT_DIR="$(brew --prefix qt)" + # IFCOS_BUILD_PYTHON_WRAPPER=off skips IfcOpenShell-Python on + # macOS until the plug-in refactor's CREATE_BUNDLE install rule + # actually drops ifcopenshell.document.rdb.dylib into + # site-packages/ifcopenshell/ (see the commit that added this + # gate for the full history + the rocksdb/macdeployqt write-up). CXXFLAGS="-O3" CFLAGS="-O3 ${DARWIN_C_SOURCE}" ADD_COMMIT_SHA=1 BUILD_CFG=Release \ BUILD_BONSAIVIEWER=ON QT_DIR="${QT_DIR}" \ + IFCOS_BUILD_PYTHON_WRAPPER=off \ python3 ./nix/build-all.py -v --diskcleanup ${MAC_INTEL} \ | tee build.log diff --git a/nix/build-all.py b/nix/build-all.py index e2e2e1c27d..951cfe0edc 100644 --- a/nix/build-all.py +++ b/nix/build-all.py @@ -409,6 +409,14 @@ if not explicit_targets and not BUILD_BONSAIVIEWER: targets.difference_update({"BonsaiViewer", "qt6"}) if BUILD_BONSAIVIEWER: targets.update(gather_dependencies("BonsaiViewer")) + +# Opt-out for the Python wrapper. Currently used by the bonsai CI workflow +# on macOS, where the post-plug-in-refactor wrapper hard-links +# ifcopenshell.document.rdb.dylib but the CREATE_BUNDLE install rule does +# not actually drop the dylib next to the wrapper in site-packages — see +# the commit message that introduced this gate. +if os.environ.get("IFCOS_BUILD_PYTHON_WRAPPER", "on").lower() in {"0", "off", "false", "no"}: + targets.discard("IfcOpenShell-Python") if WASM: SKIP_TARGETS_FOR_WASM = { "rocksdb",