Skip to content

macOS arm64 build fails: mongo-c-driver's lld-linker TRY_COMPILE probe rejected by Xcode clang #50

Description

@rustyconover

Summary

While building this extension as part of the DuckDB community extensions program (via the haybarn-community-extensions fork's CI), the macOS arm64 build fails. It's not your extension's own C++ code — it's the vcpkg-managed mongo-c-driver dependency's build-time linker probe — but flagging it here since it blocks your macOS build and you control the pinned mongo-c-driver version.

Error

CMake Error at src/libmongoc/CMakeLists.txt:453 (TRY_COMPILE):
  Failed to configure test project build system.
...
/usr/bin/cc -fPIC -fuse-ld=lld -arch arm64 -mmacosx-version-min=11.0 ... -o cmTC_cb38d
clang: error: invalid linker name in argument '-fuse-ld=lld'
ninja: build stopped: subcommand failed.

error: building mongo-c-driver:arm64-osx-release failed with: BUILD_FAILED

Full failing job: https://github.com/Query-farm-haybarn/haybarn-community-extensions/actions/runs/33027261113 (MacOS osx_arm64 leg; Linux and Windows build fine)

Root cause

mongo-c-driver's own CMake (src/libmongoc/CMakeLists.txt:453) does a TRY_COMPILE to detect lld-linker support by passing -fuse-ld=lld to the host compiler. On this runner, that resolves to Apple's Xcode clang, which doesn't recognize the bare lld linker name (Apple's clang only accepts a handful of built-in linker names; a real lld binary isn't on PATH/wired up the way it is on Linux). The TRY_COMPILE fails outright, which cascades into "Failed to configure test project build system" and aborts the whole mongo-c-driver vcpkg build before it even gets to compiling.

Since mongo-c-driver version is pinned via this extension's vcpkg.json/vcpkg_commit, a version bump (or a vcpkg overlay port patch) is the practical lever here even though the bug itself lives upstream in mongo-c-driver.

Suggested fix

  • Check if a newer mongo-c-driver release has fixed/removed this lld-detection TRY_COMPILE for macOS, and bump the pinned version if so, or
  • Add a small vcpkg portfile patch/overlay that skips the lld probe (or passes a linker name Xcode's clang actually understands) on osx triplets.

Thanks for maintaining this extension — happy to help verify a fix if useful!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions