Skip to content

build: build every static library for the deployment target the app ships - #2965

Merged
datlechin merged 9 commits into
mainfrom
fix/static-libs-deployment-target
Sep 17, 2026
Merged

datlechin merged 9 commits into
mainfrom
fix/static-libs-deployment-target

Conversation

@datlechin

Copy link
Copy Markdown
Member

The app deploys to macOS 13.0 and every static library it links was built for 14.0. The linker said so 121 times per build and nobody saw it, because the app passes -Wl,-w.

How it got here

#2874 dropped the app to 13.0. Five build scripts held their own copy of 14.0 and none of them moved, so the libraries kept targeting the version the app had left behind. A library built for a newer OS than the binary linking it is not a warning the toolchain invents: it means the archive may reference symbols that do not exist on the deployment target, and nothing catches it before a 13.0 user runs it.

What this changes

scripts/lib/deployment-target.sh is the one place the target is read, and it reads it from project.yml rather than restating it. Five scripts (lib/macos.sh, build-cassandra.sh, build-dameng.sh, build-duckdb.sh, build-freetds.sh, create-openssl-dylibs.sh) source it instead of holding a constant. scripts/ci/check-deployment-target.sh fails the build if a new one hardcodes a version, and runs in Repo Hygiene.

Every archive is rebuilt: 60 of them, all now minos 13.0, published to libs-v1 with the checksums in this branch.

Two things the rebuild turned up that are not deployment-target changes but come with it:

  • libpq's generated header. configure writes PG_INT64_TYPE long int on this platform; the committed header said long long int. Swift imports long as Int and long long as Int64, so the two spellings are the same 64 bits to C and a different type to Swift, and the driver stopped compiling. Configure's answer is the correct one for LP64 and scripts/ios/build-libpq-ios.sh already writes it, so the header now matches what a rebuild produces and the two timeout constants in LibPQPluginConnection are typed pg_usec_time_t instead of Int64. They compile under either spelling now, so the next rebuild cannot break them again.
  • libmongoc picked up snappy. CMake found Homebrew's snappy and linked it, and the new archive carried three undefined symbols (_snappy_compress, _snappy_max_compressed_length, _snappy_uncompress) that the shipped one had zero of. That is a plugin that loads on this machine and fails on every other. -DENABLE_SNAPPY=OFF pins it; verified back to zero.

Also here: build-libmongoc.sh takes a CMake 3 through CMAKE_BIN because CMake 4.4.3 cannot configure mongo-c-driver at all (The warning category "error -DCMAKE_CXX_LINK_EXECUTABLE=..." is not known; 1.30.11 carries the same TRY_COMPILE line, so a version bump is not the way out), and a library build can stage into another LIBS_DIR so a rebuild can be checked before it replaces the working copy. That staging is what caught the snappy regression.

Not in the archive, fixed anyway

Two more things were building for 14.0 and neither is a .a:

  • The OpenSSL dylibs (Libs/dylibs/). download-libs.sh builds these locally from the verified static libs, so they are not published and CI gets 13.0 for free once these archives land. create-openssl-dylibs.sh now reads the shared target.
  • The Dameng Rust bridge (Native/, outside Libs/). Rebuilt; reports 11.0 and 13.0, no 14.0.

Verification

Measured on this branch with the rebuilt libraries in place:

before after
built for newer 'macOS' version warnings 121 0
  • TablePro scheme: BUILD SUCCEEDED.
  • CassandraDriver, MongoDBDriver, DuckDBDriver, MSSQLDriver, DamengDriver: all BUILD SUCCEEDED. Between them and the app that links every one of the 15 library families.
  • The AllPlugins aggregate stops in oracle-nio on unknown attribute 'usableFromInlinenonisolated', a @TaskLocal macro expansion in the Xcode-beta toolchain. Pre-existing and unrelated: it reproduces at two different pinned oracle-nio revisions and on branches that share no code. The five plugins above were built individually for that reason.

@datlechin
datlechin merged commit afed2ad into main Sep 17, 2026
4 of 7 checks passed
@datlechin
datlechin deleted the fix/static-libs-deployment-target branch September 17, 2026 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant