From 617ff6eb4f429e117a9bc81378487d94e57503c0 Mon Sep 17 00:00:00 2001 From: wolfgitpr <133209402+wolfgitpr@users.noreply.github.com> Date: Sat, 21 Nov 2026 10:46:27 +0800 Subject: [PATCH] ci(macos): build the static configuration, the only place Apple's ar rules are exercised Every leg in every job built the DEFAULT configuration, and the default here is BUILD_SHARED_LIBS=ON -- a shared build never runs `ar`. The archive rules in CMakeLists.txt's reproducible-build block are set for `GNU|Clang` (AppleClang matches) and spell `ar qcD` / `qD`, while CMAKE_AR on macOS is cctools `ar`, whose getopt accepts only abcdilLmopqrSsTtuVvx6: `D` reached usage() and exited 1, so every static build on macOS failed at the archive step with nothing in this repository positioned to see it. vcpkg is what found it (its macOS triplets set VCPKG_LIBRARY_LINKAGE static, and vcpkg_cmake_configure passes -DBUILD_SHARED_LIBS=OFF); PR #14 moved the two rules into the existing `if (NOT APPLE)`, merged as 974c504 on 2026-11-21. This leg is what keeps them there. BUILD-ONLY, for the reason the floor leg above already carries: static + the full CTest suite has never run on macOS, and a first run that mixed "the archive rule broke again" with "static tests were never wired on Apple" would answer neither question. Turning the tests on is its own change, after this leg has been green once. Evidence run for this commit: `python -B tools/check_parsable.py --require` -> exit 0 (ci.yml parses with yaml.safe_load, 12 files checked). What could NOT be run: the leg itself -- there is no macOS toolchain on the machine this was written on, so its first CI run is its first evidence, and it is not coverage until that run says so. What would make it red: reverting dd36b92, which is how the failure reads (`ar: illegal option -- D`, from cctools usage()). --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af0e2c9..7aef006 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -248,6 +248,32 @@ jobs: - name: Verify the wheel's binary surface run: bash python/tools/ci_macos_verify.sh python/dist/cpp_pinyin2-*.whl + # THE STATIC CONFIGURATION, and the only leg in this file that builds it on Apple. + # + # WHY IT EXISTS (2026-11-21): every other leg of every job builds the DEFAULT configuration, and the + # default here is `BUILD_SHARED_LIBS=ON` -- a shared build never runs `ar`, so the archive rules in + # `CMakeLists.txt`'s reproducible-build block were exercised on Linux and MinGW only. They are set for + # `GNU|Clang`, which AppleClang matches, and they spell `ar qcD` / `qD`; CMAKE_AR on macOS is cctools + # `ar`, whose option parser accepts only `abcdilLmopqrSsTtuVvx6`, so `D` reached `usage()` and exited 1 + # and EVERY static build on macOS failed at the archive step with nothing in this file to see it. + # vcpkg is what found it (its macOS triplets are `VCPKG_LIBRARY_LINKAGE static`); PR #14 moved the two + # rules into the existing `if (NOT APPLE)`, merged 2026-11-21. This leg is what keeps them there. + # + # BUILD-ONLY on purpose, for the same reason the floor leg above is: static + the full CTest suite has + # never run on macOS, and a first run that mixed "the archive rule broke again" with "static tests were + # never wired on Apple" would answer neither question. Turn the tests on as its own change, once this + # leg has run green at least once. + # + # UNVERIFIED when written: no macOS toolchain on the machine this was written on, and nothing had run + # it when the change landed. Do not read it as coverage until a run says so. + - name: Build the static configuration (Apple's ar has no `D` modifier -- see PR #14) + run: | + cmake -S . -B build-static \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS=OFF \ + -DCPP_PINYIN2_BUILD_TESTS=OFF + cmake --build build-static --config Release -j $(sysctl -n hw.logicalcpu) + # Windows Job windows: runs-on: windows-latest