cmake: De-duplicate libraries where possible #35756

pull hebasto wants to merge 2 commits into bitcoin:master from hebasto:260720-link-dedup changing 3 files +23 −2
  1. hebasto commented at 3:47 PM on July 20, 2026: member

    Set the CMP0156 and CMP0179 policies to NEW. CMP0156 de-duplicates libraries on link lines based on linker capabilities; CMP0179 makes this de-duplication keep the first occurrence of static libraries. This silences Apple linker "ignoring duplicate libraries" warnings.

    Both policies are gated on CMP0179, which requires CMake >=3.31, to avoid the intermediate CMake 3.29/3.30 behaviour where only CMP0156 is available. This requirement is satisfied by the current Homebrew package and the Guix build environment. On older versions, the policy guard makes this a no-op.

    The Guix scripts for macOS have been updated to turn linker warnings into errors, as is done for other targets.

  2. hebasto added the label Build system on Jul 20, 2026
  3. DrahtBot commented at 3:47 PM on July 20, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35756.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  4. fanquake commented at 3:53 PM on July 20, 2026: member

    Would be good to clarify what has changed since you last PR'd this: #31504.

  5. fanquake referenced this in commit 1714953eff on Jul 27, 2026
  6. fanquake referenced this in commit 3f70305cf8 on Jul 27, 2026
  7. fanquake referenced this in commit b12a70f330 on Jul 29, 2026
  8. Kino1994 referenced this in commit 1c39296f20 on Aug 2, 2026
  9. cmake: De-duplicate libraries where possible
    Set the CMP0156 and CMP0179 policies to NEW. CMP0156 de-duplicates
    libraries on link lines based on linker capabilities; CMP0179 makes
    this de-duplication keep the first occurrence of static libraries.
    This silences Apple linker "ignoring duplicate libraries" warnings.
    
    Both policies are gated on CMP0179, which requires CMake >=3.31, to
    avoid the intermediate CMake 3.29/3.30 behaviour where only CMP0156
    is available. This requirement is satisfied by the current Homebrew
    package and the Guix build environment. On older versions the policy
    guard makes this a no-op.
    1714370aa6
  10. hebasto force-pushed on Aug 12, 2026
  11. hebasto marked this as ready for review on Aug 12, 2026
  12. hebasto commented at 11:19 AM on August 12, 2026: member

    Would be good to clarify what has changed since you last PR'd this: #31504.

    1. CMake's de-duplication behaviour has stabilised.

    2. There is now a concrete motivation beyond log noise: extending the Guix warnings-as-errors treatment to Darwin (https://github.com/bitcoin/bitcoin/commit/b12a70f330d0ffcc3064ecf2643f8cfe765cf9c8) is blocked on the "ignoring duplicate libraries" warnings this PR silences.

    From #31504 (comment):

    Also not sure. Seems like this was introduced in 3.29, but then the behaviour was changed again 2 versions later in 3.31. Would we be opting into that as well? Then, depending on the version, we'd potentially have CMake behaving 3 different ways at link time.

    Reworked to avoid the intermediate behaviour of CMake 3.29 or 3.30.

  13. fanquake commented at 12:35 PM on August 12, 2026: member

    motivation beyond log noise: extending the Guix warnings-as-errors treatment to Darwin

    Why not do that here, if that is the motivation?

  14. hebasto commented at 6:52 PM on August 12, 2026: member

    My Guix build:

    aarch64
    51d2eb6a07ab8f8640f86c174c4ffd8ba3395240f319bc1b1f026a3f75112a0d  guix-build-1714370aa60c/output/aarch64-linux-gnu/SHA256SUMS.part
    62811ef20daa47fa21cf1b89219c8ba7474cc4744a0b90490719553b22cff67c  guix-build-1714370aa60c/output/aarch64-linux-gnu/bitcoin-1714370aa60c-aarch64-linux-gnu-debug.tar.gz
    ea1f50d429f32cc2069b53733bee3219699ead546e4cd1e82a2a7fe13c4418a0  guix-build-1714370aa60c/output/aarch64-linux-gnu/bitcoin-1714370aa60c-aarch64-linux-gnu.tar.gz
    c09d36b16fc3963c3d2b5d5e818a95d9384b98b29c8aa57db157c0b73d038cf6  guix-build-1714370aa60c/output/arm-linux-gnueabihf/SHA256SUMS.part
    32a3d4d31fc61b97046fbd40c85855bdad3f3a40ba49d6c5cb616b393d610dd4  guix-build-1714370aa60c/output/arm-linux-gnueabihf/bitcoin-1714370aa60c-arm-linux-gnueabihf-debug.tar.gz
    949e6d6f50cd657d3820d38a43a03f4a399619900d83b2a144a6bfcfadf0621a  guix-build-1714370aa60c/output/arm-linux-gnueabihf/bitcoin-1714370aa60c-arm-linux-gnueabihf.tar.gz
    d41e55cbff1bd83a7a93befe90ae0992e22fabac4609eb9b212b04766ff3917b  guix-build-1714370aa60c/output/arm64-apple-darwin/SHA256SUMS.part
    8d7dfe0f999912ee9215c46ac64f79504f78747e03a9b9d7f50584827e995693  guix-build-1714370aa60c/output/arm64-apple-darwin/bitcoin-1714370aa60c-arm64-apple-darwin-codesigning.tar.gz
    65d3ebe8e770ef8f216b548d9763213c2cc62bc61464140c09679df2c71e327e  guix-build-1714370aa60c/output/arm64-apple-darwin/bitcoin-1714370aa60c-arm64-apple-darwin-unsigned.tar.gz
    ba09b45dadd3615cba08c1ba224424c61c3a1cfaf0e092811dba6b0335f0730b  guix-build-1714370aa60c/output/arm64-apple-darwin/bitcoin-1714370aa60c-arm64-apple-darwin-unsigned.zip
    c827be0bbc3491af4ac6fb77698f9ce059df10bfb37e82bcd29d92ea0839574f  guix-build-1714370aa60c/output/dist-archive/bitcoin-1714370aa60c.tar.gz
    a38ff7eb82d693964f78eacbf5b7737ceecbbcfe1b0ff9deda8c8c9776b43adc  guix-build-1714370aa60c/output/powerpc64-linux-gnu/SHA256SUMS.part
    7b072a4bc6cc294a1f4fb1e301c487843f4b14e11f2cca39214d74b195221747  guix-build-1714370aa60c/output/powerpc64-linux-gnu/bitcoin-1714370aa60c-powerpc64-linux-gnu-debug.tar.gz
    258c323f60979aa12918880123fb0055cfd6463a214aea1726b455fd24e8c2ee  guix-build-1714370aa60c/output/powerpc64-linux-gnu/bitcoin-1714370aa60c-powerpc64-linux-gnu.tar.gz
    8849236cff6396f5a6107c708025e217f9bd43e2afe5a96d2839511a89baafeb  guix-build-1714370aa60c/output/riscv64-linux-gnu/SHA256SUMS.part
    1d366aace9e73280b0316b85b346b44ba74e32a95d80e9caa21ba8e03d6c0fd0  guix-build-1714370aa60c/output/riscv64-linux-gnu/bitcoin-1714370aa60c-riscv64-linux-gnu-debug.tar.gz
    ce50a214d555a3a6feca732c8e4bee32c73d218b7d1ef4364cb30e0e76c263db  guix-build-1714370aa60c/output/riscv64-linux-gnu/bitcoin-1714370aa60c-riscv64-linux-gnu.tar.gz
    9ff632f5e22762de053bf126cdcc2ec89b124bba071ab870a94539f660fa83e5  guix-build-1714370aa60c/output/x86_64-apple-darwin/SHA256SUMS.part
    dddbd7d31bc5953bfb80c079f265b1a5354fda24cda848cc4046b960d4dc0390  guix-build-1714370aa60c/output/x86_64-apple-darwin/bitcoin-1714370aa60c-x86_64-apple-darwin-codesigning.tar.gz
    0008eb18e8127afbcae85475cdeccddca454fccd92a5d858641844309e6360c9  guix-build-1714370aa60c/output/x86_64-apple-darwin/bitcoin-1714370aa60c-x86_64-apple-darwin-unsigned.tar.gz
    915d8855291bd858bc7889701e31ecedc6912c050ac0ad3af4d7bb8ecb42467e  guix-build-1714370aa60c/output/x86_64-apple-darwin/bitcoin-1714370aa60c-x86_64-apple-darwin-unsigned.zip
    c5ad5c89a579bdb91aad9dabd6027de3de74f75180bb5df5ef7aff79ff02c79f  guix-build-1714370aa60c/output/x86_64-linux-gnu/SHA256SUMS.part
    c0d21fb66f1a2c9ec6c7a74b46b1fc0e318186ceaeae36c53710300ed52941ae  guix-build-1714370aa60c/output/x86_64-linux-gnu/bitcoin-1714370aa60c-x86_64-linux-gnu-debug.tar.gz
    b02f8276c9b90b9756d4d85caa92030d5319f144eb6b058e4e374423be5b6298  guix-build-1714370aa60c/output/x86_64-linux-gnu/bitcoin-1714370aa60c-x86_64-linux-gnu.tar.gz
    33b17bb9931ec95b9120c05d058a133d2fafa7486c41f7872ef074d4a2964485  guix-build-1714370aa60c/output/x86_64-w64-mingw32/SHA256SUMS.part
    a2d55a0c8bcdb63a452ed6516a8206baf13a8082538fd1ad8ff7194cff362830  guix-build-1714370aa60c/output/x86_64-w64-mingw32/bitcoin-1714370aa60c-win64-codesigning.tar.gz
    e4065ebe5f73c47dc0840a363ad9d82df08c2b29d9de289902b5ca88e275738b  guix-build-1714370aa60c/output/x86_64-w64-mingw32/bitcoin-1714370aa60c-win64-debug.zip
    9e43266ae7175a5e4ba03acbaf64d0821b5b5edf2c0736bd7539a537cc691de2  guix-build-1714370aa60c/output/x86_64-w64-mingw32/bitcoin-1714370aa60c-win64-setup-unsigned.exe
    5316405e88485fd377e85c12b6ac392cd91adc56bad4defde0fc2e2664afe1fa  guix-build-1714370aa60c/output/x86_64-w64-mingw32/bitcoin-1714370aa60c-win64-unsigned.zip
    
  15. guix: Turn macOS linker warnings into errors e6c1483832
  16. hebasto commented at 7:48 PM on August 12, 2026: member

    motivation beyond log noise: extending the Guix warnings-as-errors treatment to Darwin

    Why not do that here, if that is the motivation?

    Thanks! Done.

    My partial Guix build:

    x86_64
    e4328a1acc7be5065d20e4c5efa3668534d78b3c7e1b2a30d7774920bcb78d34  guix-build-e6c1483832e0/output/arm64-apple-darwin/SHA256SUMS.part
    47b69febdd21bcc726ac3d0218382b24f5d9ad3eb2f38843aeb7fa3e97875b42  guix-build-e6c1483832e0/output/arm64-apple-darwin/bitcoin-e6c1483832e0-arm64-apple-darwin-codesigning.tar.gz
    f3bcbddfc773f1237ec2cc580a04c74003517fa9bbe66117fe2d0bb654feefc0  guix-build-e6c1483832e0/output/arm64-apple-darwin/bitcoin-e6c1483832e0-arm64-apple-darwin-unsigned.tar.gz
    9dcc1cc32ba1b3f5dfe0ed111bf101e46fbe5f2016fd90db5f72f45b6ec40524  guix-build-e6c1483832e0/output/arm64-apple-darwin/bitcoin-e6c1483832e0-arm64-apple-darwin-unsigned.zip
    8b128364dcf1aafaa5c246196969680429dc6521a9372c382209363f041ba59d  guix-build-e6c1483832e0/output/dist-archive/bitcoin-e6c1483832e0.tar.gz
    8f283d72c3b2eaa2d50c25f1f0685a6f95eb29538b6666f19c1795adc165c4ec  guix-build-e6c1483832e0/output/x86_64-apple-darwin/SHA256SUMS.part
    9123fc164b57733c258a7ba5e4c299b9522b844315aee91211ced9b12a5fb8b0  guix-build-e6c1483832e0/output/x86_64-apple-darwin/bitcoin-e6c1483832e0-x86_64-apple-darwin-codesigning.tar.gz
    63dc85e4f4a19bb34554ab530aaab60b3beb116c528972818c4f815c3fcc98fd  guix-build-e6c1483832e0/output/x86_64-apple-darwin/bitcoin-e6c1483832e0-x86_64-apple-darwin-unsigned.tar.gz
    ae1f46f2f0bc32ac7f2a8e203ee96965b8b1fe6000ed47b4e22ec45a007ac0ac  guix-build-e6c1483832e0/output/x86_64-apple-darwin/bitcoin-e6c1483832e0-x86_64-apple-darwin-unsigned.zip
    

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-08-31 18:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me