Repository navigation
ci: make the macOS .app self-contained - #36
Merged
Merged
Conversation
Every package job named its artifacts F2Dock--<sha>-..., with no version:
F2Dock--b1998273-macos-arm64.zip
The metadata step looked for a line starting with VERSION, which is how
libcvc's multi-line project() is written. F2Dock's is one line,
`project(F2Dock VERSION 2.1.0 LANGUAGES C CXX)`, so nothing matched and
VERSION was empty. That predates the move to cvcpkg (0883fd3 has the same
line) and would have shipped release assets named F2Dock--linux-x86_64.*.
All six jobs, in ci.yml and release.yml, now take the version from the
project() call with sed -E, which macOS's BSD sed, GNU sed and Git for
Windows' sed all accept. Checked against the CRLF CMakeLists.txt: 2.1.0,
with no trailing carriage return.
The .app / .dmg / .zip shipped an empty Contents/Frameworks. The packaging
step only copied dylibs that otool showed by an absolute path matching
libfftw. The default build no longer links FFTW, and everything F2Dock
does link from the cvcpkg prefix is an @rpath/ reference with no LC_RPATH
left after install:
F2Dock.app/Contents/MacOS/F2Dock
@rpath/libcvc.3.dylib
@rpath/libboost_thread.1.86.0.dylib
... 18 more
so F2Dock could not start on any machine without that prefix. (GB-Rerank,
FilterOutput and F2DockServer link only the OS's libraries.)
.github/scripts/macos-bundle-app.sh walks the executables' load commands
transitively and copies every non-OS library into Contents/Frameworks:
* under its real, versioned name, with the other names it is reached by
as symlinks to that one copy, as in the prefix;
* a .framework (freetype links @rpath/png.framework/Versions/1.6.44/png)
is copied whole, so its reference resolves unchanged;
* anything that resolves outside the cvcpkg prefix is an error, not
something to bundle;
* each executable gets an @executable_path/../Frameworks rpath and loses
any absolute one, and every file it changes is re-signed ad hoc, since
arm64 macOS kills a binary whose signature no longer verifies.
.github/scripts/macos-check-app.sh fails the job if any reference in the
bundle still leads outside it and the OS. With --run it also launches
each executable from the unpacked .zip, with the build's prefix moved
aside, no DYLD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH=/usr/lib and
DYLD_PRINT_LIBRARIES on, and requires each to reach main() and print,
loading images only from the bundle and the OS. dyld binds every linked
library before main(), so that covers the whole closure. perl (the
timeout) runs before env, because macOS strips DYLD_* from SIP-protected
binaries such as /usr/bin/perl and /usr/bin/env.
The executables now move from Resources/bin to Contents/MacOS instead of
being copied, so the .app no longer carries a second, unfixed copy.
ci.yml's package-macos and release.yml's macos job run the same steps.
Exercised off macOS with llvm-otool-18 / llvm-install-name-tool-18 on the
.zip from CI run 42292607979 and the macos/arm64 prefix: 142 libraries
(83 MB) bundled, and the static check passes on all 146 Mach-O files. It
fails on the unbundled .app, and the bundler fails naming the library
when one is removed from the prefix. The --run check needs macOS and
runs in CI.
The first macOS run of the check bundled 142 libraries, passed the static
check, and ran F2Dock from the unpacked .zip with the prefix moved aside:
run: F2Dock --version -> exit 0, 143 images from the bundle: F2Dock 2.1.0
The other three failed on the check's own mistakes, not the bundle's:
FAIL: F2DockServer died with signal 127
FAIL: FilterOutput died with signal 127
FAIL: GB-Rerank printed nothing
F2DockServer and FilterOutput `return -1` from main, which is exit status
255, and a shell's $? cannot tell that from 128 + 127. GB-Rerank's error
goes to stderr after a blank line, and the check only read the first line.
The binary now runs under a small perl wrapper that forks, waits, and
writes how the child ended -- "exit N", "signal N" or "timeout" -- to a
status file, so only a real signal or timeout fails. The output check
takes the first non-blank line. perl still comes before env, so the
DYLD_* settings reach the binary under test.
Checked on Linux: exit 255, exit 1, exit 0, signals 9, 11 and 15, and a
timeout are each reported as such.
This was referenced Nov 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The macOS
.app/.dmg/.zipthatpackage / macos(ci.yml) and themacosrelease job build shipped an emptyContents/Frameworks, so F2Dock could not start on any machine that lacks the build's cvcpkg prefix. Follow-up to #35.Why it was empty
The packaging step copied only dylibs that
otool -Lshowed by an absolute path matchinglibfftw. Since #35 the default build does not link FFTW. Everything F2Dock does link from the prefix is an@rpath/reference, and noLC_RPATHis left aftercmake --install. From the.zipof run 42292607979:GB-Rerank, FilterOutput and F2DockServer link only the OS's libraries (xmlrpc is static), so only F2Dock was affected. Linux was fixed in #35, which bundles every library
lddresolves from the prefix into the tarball. Windows already copies every DLL in the prefix.What changes
.github/scripts/macos-bundle-app.sh APP PREFIXwalks the executables' load commands transitively and copies every non-OS library intoContents/Frameworks..frameworkis copied whole, symlinks and_CodeSignatureincluded, so its reference resolves unchanged. freetype links@rpath/png.framework/Versions/1.6.44/png./usr/localcannot slip in.@executable_path/../Frameworksand lose any absolute rpath. Every file whose load commands change is re-signed ad hoc, because arm64 macOS kills a binary whose signature no longer verifies. With today's prefix only the executables change; no dylib needs rewriting..github/scripts/macos-check-app.sh APP [--run]checks the result.MacOS/and inFrameworks/(walked recursively) is either the OS's (/usr/lib,/System) or an@rpath/name present inFrameworks.--run: it launches each executable from the unpacked.zip, with the build's prefix moved aside, noDYLD_LIBRARY_PATH,DYLD_FALLBACK_LIBRARY_PATH=/usr/libandDYLD_PRINT_LIBRARIES=1. Each must reachmain()and print, without a dyld error or a signal, and every image dyld loads must come from the bundle or the OS.F2Dock --versionprints its version; the others print their usage and start nothing. dyld binds every linked library beforemain(), so this covers the whole closure.perl(the timeout) runs beforeenv: macOS stripsDYLD_*when launching SIP-protected binaries such as/usr/bin/perland/usr/bin/env, soenvhas to be the last thing to set them.package-macosand release.yml'smacosjob run the same steps. A new step, "Check the .zip runs without the build's prefix", does the--runcheck on the artifact as shipped. The executables now move fromResources/bintoContents/MacOSinstead of being copied, so the.appno longer carries a second, unfixed copy of each.244ef7b, separate: every package job named its artifactsF2Dock--<sha>-…with no version. The metadataawklooked for a line starting withVERSION, and F2Dock'sproject()is a single line. This predates Licence hygiene: add LICENSE, header the unheadered files, quarantine the GPL modules #35 (0883fd3has the same line) and would have produced release assets namedF2Dock--linux-x86_64.*. All six jobs now read the version fromproject()withsed -E, which BSD, GNU and Git-for-Windows sed all accept.Verification
Off macOS, with
llvm-otool-18/llvm-install-name-tool-18(signing stubbed out), on the real.zipfrom run 42292607979 and themacos/arm64cvcpkg prefix:png.frameworkwhole.app.appCI ships today@rpath/libcvc.3.dyliband the restlibgmp.10.dylibremoved from the prefixF2Dock loads @rpath/libgmp.10.dylib, which is not in <prefix>shellcheckon both scripts--run,codesignand BSDsedneed macOS; they are exercised in CI, below.CI
Run 42339527146 at
4609f28: all 10 jobs green. Frompackage / macos, on the.zipunpacked fresh, with/Users/runner/work/_temp/f2dock-depsmoved aside:Artifacts now carry the version:
F2Dock-2.1.0-8ac0bb29-macos-arm64.dmg.The first run (42317485460, at
7d90e32) failed in "Check the .zip runs without the build's prefix", on mistakes in the check rather than in the bundle. F2Dock passed then too. F2DockServer and FilterOutputreturn -1, exit status 255, which a shell's$?cannot tell from a signal; GB-Rerank's message follows a blank line, which the check read as no output.4609f28runs each binary under a perl wrapper that reports the real wait status (exit, signal or timeout) and takes the first non-blank line. Checked on Linux against exit 255 / 1 / 0, signals 9, 11 and 15, and a timeout.Not done here
.appnow ships about 140 third-party dylibs, among them gmp / mpfr (LGPL-3.0), ImageMagick, gRPC / abseil, HDF5 and assimp, without their licence texts. The cvcpkg bundles mostly do not install them: onlyeigenandlibiglhaveshare/licenses/. The same gap already exists for the Windows.zip(every prefix DLL) and the Linux tarball (Licence hygiene: add LICENSE, header the unheadered files, quarantine the GPL modules #35). Fixing it belongs in the cvcpkg recipes, after which these packaging steps can copyshare/licenses/along.@loader_path/python3.11/site-packages/PIL/.dylibs, and two libjpeg-turbo libraries carry the builder's temporary install path. Neither can point inside a user's machine, so this is left alone, but the recipes should not be emitting them..apphas noInfo.plistand is signed ad hoc only, so it is a directory of binaries rather than a proper bundle, and a downloaded copy is quarantined by Gatekeeper. That has not changed.