#35756 cmake: De-duplicate libraries where possible

full analysis

https://github.com/bitcoin/bitcoin/pull/35756 · hebasto · +23/-2 in 3 files, 2 commits · labels: Build system

Goal

  • Deduplicate link libraries to eliminate duplicate-library warnings from Apple's linker
  • Enable treating linker warnings as fatal errors in macOS Guix release builds

This pull request sets CMake policies CMP0156 and CMP0179 to NEW when supported (CMake 3.31+), enabling linker library deduplication to silence Apple ld duplicate-library warnings. It also updates the macOS Guix build scripts to pass -Wl,-fatal_warnings, bringing macOS release builds in line with other platforms where linker warnings are treated as errors.

Problem: Apple's linker emits warnings when static libraries are repeated on the link line, which previously prevented enabling fatal linker warnings on Darwin release builds in Guix.

Category: Build and CI (#12 of 55)

P3 · cleanup

  • P3 because it aligns macOS release builds with Linux and Windows by treating linker warnings as errors
  • Hardens Darwin releases against unexpected linker anomalies

Treating Darwin linker warnings as fatal errors hardens macOS release builds against unexpected linker anomalies, aligning them with existing Linux and Windows Guix build practices. Author noted: 'extending the Guix warnings-as-errors treatment to Darwin... is blocked on the ignoring duplicate libraries warnings this PR silences.'

Membership: Modifies top-level CMakeLists.txt policies and macOS Guix build scripts.

Factors: security/stability 1, bug 0, performance 0, user value 0, leverage 1

Reviewability: Ready

  • Ready to review
  • Small patch with passing CI and reviewer feedback incorporated

The patch is small, cleanly rebased, passes CI, and incorporates reviewer feedback with provided Guix build hashes.

Author status: active, responded to reviewer feedback with updated commits and Guix hashes

Resolved concerns:

  • Reviewer asked why macOS Guix warnings-as-errors wasn't included directly if that was the motivation; author added it in an updated commit (fanquake)

Agreement: Positive

  • Positive sentiment with no remaining objections
  • Suggested including the macOS Guix flag change directly, which author added (fanquake)

Positive; author incorporated reviewer feedback and no objections remain.

fanquake asked about previous PR differences and suggested including the Guix flag change directly; hebasto obliged, and no objections were raised.

  • fanquake asked: 'Why not do that here, if that is the motivation?'
  • hebasto updated the PR with commit e6c1483832 and provided Guix hashes

Review verdicts (DrahtBot): 0

Files

12 lines under test/bench/ci.

  • CMakeLists.txt +13/-0
  • contrib/guix/libexec/build_macos.sh +5/-1
  • contrib/guix/libexec/build_macos_gui.sh +5/-1

Card

This PR enables CMake policies CMP0156 and CMP0179 on CMake 3.31+ to deduplicate libraries on link lines and silences Darwin linker warnings about duplicate libraries. It also adds -Wl,-fatal_warnings to macOS Guix build scripts, bringing them in line with other targets where linker warnings fail the build. Author incorporated reviewer feedback to bundle the Guix change directly, and macOS Guix hashes were supplied. Review is ready and unblocked.

Data

dossier JSON · extract JSON · model openrouter/google/gemini-3.8-flash, generated 2026-09-17T16:20, confidence high, input hash 8bd9ce9e43e0ada1