Skip to content

Build on libmongoc 2.0–2.2 (Ubuntu 26.04) and drop the misleading apt hint - #32

Merged
taplin merged 1 commit into
mainfrom
support-libmongoc-2.2
Oct 4, 2026
Merged

taplin merged 1 commit into
mainfrom
support-libmongoc-2.2

Conversation

@taplin

@taplin taplin commented Oct 4, 2026

Copy link
Copy Markdown
Collaborator

Two Linux installation problems, intended for a 4.0.2 patch release.

1. 4.0.1 doesn't compile against libmongoc 2.2 (Ubuntu 26.04 LTS)

Ubuntu 26.04's libmongoc-dev is 2.2.2. 4.0.1 calls bson_append_array_unsafe_begin, which libbson only added in 2.3.0; the same release deprecated bson_append_array_begin. A small PerfectCBSON shim now uses BSON_CHECK_VERSION(2, 3, 0) to call whichever this libbson has. The result builds warning-free on 2.3+ and still works on 2.0–2.2.

2. The apt install hint was misleading

When libmongoc is missing, SwiftPM printed apt-get install libmongoc-dev from the package's providers:. On Ubuntu 24.04, the base of the official swift:*-noble images, and on Debian 13, that installs libmongoc 1.x, which 4.x can't use. SwiftPM's hint can't vary by release, so the apt provider is removed and the Homebrew one, which is correct, stays. The READMEs (English and Chinese) now list which distributions' packages work:

Distribution libmongoc-dev
Ubuntu 26.04 LTS+ 2.2+ apt works
Debian forky / sid 2.5 apt works
Ubuntu 24.04, Debian 13 and older 1.x build from source

CI

There's a new linux-apt job: the swift:6.4-resolute container with libmongoc from plain apt (2.2.2). It tests the oldest supported libmongoc and the README's apt instructions.

Testing

Full suite (36 tests):

  • libmongoc 2.2.2 on Linux, built from the release tarball; this PR's new CI job covers the apt package itself;
  • libmongoc 2.5.5 on macOS (Xcode 27.0) and on Linux.

No warnings on 2.5.5.

🤖 Generated with Claude Code

4.0.1 failed to compile against libmongoc 2.2.2 (Ubuntu 26.04 LTS's
libmongoc-dev): bson_append_array_unsafe_begin only exists from libbson
2.3, which also deprecated bson_append_array_begin. A PerfectCBSON shim
now picks whichever this libbson has, so builds stay warning-free on
2.3+ and work on 2.0-2.2.

SwiftPM's apt provider hint said `apt-get install libmongoc-dev`, which
installs 1.x on Ubuntu 24.04 (the swift:*-noble images) and Debian 13.
It can't vary by release, so it's removed; the README now lists which
distributions' packages are new enough.

CI gains an Ubuntu 26.04 job using apt's libmongoc (2.2.2), the oldest
supported version. Full suite passes on 2.2.2 (Linux) and 2.5.5 (macOS,
Linux).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@taplin
taplin merged commit cf6120f into main Oct 4, 2026
6 checks passed
@taplin
taplin deleted the support-libmongoc-2.2 branch October 4, 2026 14:56
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