depends: hard-code necessary c(xx)flags rather than setting them per-host #32584

pull fanquake wants to merge 1 commits into bitcoin:master from fanquake:depends_hard_code_flags changing 7 files +16 −14
  1. fanquake commented at 9:33 am on May 22, 2025: member

    The per-host flag variables hold platform-specific defaults that are ignored when flag environment variables are set, so it was wrong for them to contain -std options relied on by package definitions.

    Additionally, these flags (-pipe and -std=xx) will no longer be passed into the CMake build, meaning less duplication in the build summary.

    Pulled out of #31920.

  2. DrahtBot commented at 9:33 am on May 22, 2025: contributor

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

    Code Coverage & Benchmarks

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

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK ryanofsky, theuni, achow101
    Concept ACK hebasto

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  3. fanquake added the label DrahtBot Guix build requested on May 22, 2025
  4. hebasto commented at 10:28 am on May 22, 2025: member
    Concept ACK.
  5. maflcko commented at 12:08 pm on May 22, 2025: member

    The per-host flag values now represent the mandatory flags that cannot be overridden by the environment. Additionally, these flags (-pipe and -std=xx) will no longer be passed into the CMake build.

    Would be nice to explain this with commands to test and observe the difference in behavior. This would make it easier to understand the goals and test them.

  6. hebasto commented at 2:21 pm on May 22, 2025: member

    My Guix build:

     0aarch64
     17a5858e3364998675e06a2bec330a6fb9f619613a9228a568b5c98cba873460f  guix-build-0275825f7ace/output/aarch64-linux-gnu/SHA256SUMS.part
     2a8b08f5f246ca97ae26bf9142355797f82d3f1e7eb2ffbc1b7d78f35c4c0cd4d  guix-build-0275825f7ace/output/aarch64-linux-gnu/bitcoin-0275825f7ace-aarch64-linux-gnu-debug.tar.gz
     392cbdec0549173a3e3a90ac81ad2dac98d9758a76efe12a6d205cc1265f9f701  guix-build-0275825f7ace/output/aarch64-linux-gnu/bitcoin-0275825f7ace-aarch64-linux-gnu.tar.gz
     4c7915b68fdfa3fb68e78d6264f36ddca591204578d8f3d857c3d322a17522439  guix-build-0275825f7ace/output/arm-linux-gnueabihf/SHA256SUMS.part
     555777a80adf1abf9e39cac043e5736279b67b67dc8dac2a3c37a19cb37e71e54  guix-build-0275825f7ace/output/arm-linux-gnueabihf/bitcoin-0275825f7ace-arm-linux-gnueabihf-debug.tar.gz
     61ecff64fb689fdf879de55a5a702fdcf9e35617f012a40f989e1365304745ae3  guix-build-0275825f7ace/output/arm-linux-gnueabihf/bitcoin-0275825f7ace-arm-linux-gnueabihf.tar.gz
     7644d8e2e1b5cd4316703c6fa78d65a3ea575a31e1f24938efbf02eaadaf1bbc4  guix-build-0275825f7ace/output/arm64-apple-darwin/SHA256SUMS.part
     8e4fa5170eaf6b0dbc792f33bc163d8ba22b0a05c0bd1b1e225bc50ad48448720  guix-build-0275825f7ace/output/arm64-apple-darwin/bitcoin-0275825f7ace-arm64-apple-darwin-codesigning.tar.gz
     99684c05d427446218e72f40340f65680f8e2b1a06496b7ab3f65181daf432a9b  guix-build-0275825f7ace/output/arm64-apple-darwin/bitcoin-0275825f7ace-arm64-apple-darwin-unsigned.tar.gz
    10a9b892fa30ef9e02c9066635bd7768a13c3971ec0035d13c0857a8c837af2170  guix-build-0275825f7ace/output/arm64-apple-darwin/bitcoin-0275825f7ace-arm64-apple-darwin-unsigned.zip
    11b085ac19b1eac59497975bccbe4997b772a224c27c527376950590ce86b8ef82  guix-build-0275825f7ace/output/dist-archive/bitcoin-0275825f7ace.tar.gz
    127da262d6ac77a64fc5c3a550c6b72dd9dd93a923cbf3045edc4696eb4e1af043  guix-build-0275825f7ace/output/powerpc64-linux-gnu/SHA256SUMS.part
    135eef5b5c79b26f3f8ad3243637ca238b5e43f55f369375312ab186dc29213e7b  guix-build-0275825f7ace/output/powerpc64-linux-gnu/bitcoin-0275825f7ace-powerpc64-linux-gnu-debug.tar.gz
    143a5f90e01e28fa920954bc551594936d359f0009033172d218cb31bd6842138b  guix-build-0275825f7ace/output/powerpc64-linux-gnu/bitcoin-0275825f7ace-powerpc64-linux-gnu.tar.gz
    15ed6ce026a6ae7a22dfcdc7f9c8c2ab4df33f665562b65924633288fa9b19f7e8  guix-build-0275825f7ace/output/riscv64-linux-gnu/SHA256SUMS.part
    16205569f39bc41d0b70206f08dbafae994afaedce32c2dd79972c9775dc916dd8  guix-build-0275825f7ace/output/riscv64-linux-gnu/bitcoin-0275825f7ace-riscv64-linux-gnu-debug.tar.gz
    1790f23ce8f6498992b55069b5c8f616adfb9b5061bb301fee31f2e4ebc7912741  guix-build-0275825f7ace/output/riscv64-linux-gnu/bitcoin-0275825f7ace-riscv64-linux-gnu.tar.gz
    184628de0d41b2a2fceddc115e66a54455cdd0eea61118c841ac9ba0dc789cf3c6  guix-build-0275825f7ace/output/x86_64-apple-darwin/SHA256SUMS.part
    19e851467d91e4d0ccccd3a93e3b34a76eb1c7df22c5167014ee7273f9ea78b481  guix-build-0275825f7ace/output/x86_64-apple-darwin/bitcoin-0275825f7ace-x86_64-apple-darwin-codesigning.tar.gz
    207e933ca4b5598f50d7c981f4c555965b383469c15a138c426c3151626de676b4  guix-build-0275825f7ace/output/x86_64-apple-darwin/bitcoin-0275825f7ace-x86_64-apple-darwin-unsigned.tar.gz
    2103fe5fc86d56a1a88f5b50e2da2fad4c72449ae3f6922aa7366cd15e730f4b89  guix-build-0275825f7ace/output/x86_64-apple-darwin/bitcoin-0275825f7ace-x86_64-apple-darwin-unsigned.zip
    2211de70c37658da525c7c24d9230ac56256c081446bd1db4adab6daa5bc4f44d6  guix-build-0275825f7ace/output/x86_64-linux-gnu/SHA256SUMS.part
    23b9afb4e4991e07d33b221be4b3e8dbbafa97cd9ea32d86750d0badb507545ff0  guix-build-0275825f7ace/output/x86_64-linux-gnu/bitcoin-0275825f7ace-x86_64-linux-gnu-debug.tar.gz
    24b52d43b67ff116532f7570ea370328f769058cb1b98e61bc4458ad9ea61816b6  guix-build-0275825f7ace/output/x86_64-linux-gnu/bitcoin-0275825f7ace-x86_64-linux-gnu.tar.gz
    257a226edf53b81befd0f88897894dd379d5ff646d8e39e24d8d9cbadb349d2f71  guix-build-0275825f7ace/output/x86_64-w64-mingw32/SHA256SUMS.part
    26eeb512d3fa02d381eb440b91eeb7c59498021181a6d59c7f4b6e2a7836e7b913  guix-build-0275825f7ace/output/x86_64-w64-mingw32/bitcoin-0275825f7ace-win64-codesigning.tar.gz
    27f90557e9ec12797544e46ce487ea615c0034963e570e67ddace85fafdb654455  guix-build-0275825f7ace/output/x86_64-w64-mingw32/bitcoin-0275825f7ace-win64-debug.zip
    28b5aef6dbcc804ede4750c0975b3936df16dc855f41b867044207893a09facc0e  guix-build-0275825f7ace/output/x86_64-w64-mingw32/bitcoin-0275825f7ace-win64-setup-unsigned.exe
    29ca9d189c66eb2b4f4f56f93272fd09ba2bf8d46dc68217782163020d2071c81e  guix-build-0275825f7ace/output/x86_64-w64-mingw32/bitcoin-0275825f7ace-win64-unsigned.zip
    
  7. DrahtBot commented at 2:04 am on May 23, 2025: contributor

    Guix builds (on x86_64) [untrusted test-only build, possibly unsafe, not for production use]

    File commit 35bf3f88398da0211cece0a29da4de001e34a4dd(master) commit 21d855af47ee4cbcd038c588529566779181fc32(pull/32584/merge)
    *-aarch64-linux-gnu-debug.tar.gz c35cf51a398c92df... a22608e4225637a7...
    *-aarch64-linux-gnu.tar.gz 82d0798dfae78051... 2f2705212ffa1c69...
    *-arm-linux-gnueabihf-debug.tar.gz df45940210e7d3b8... 34ac31537a9af3d6...
    *-arm-linux-gnueabihf.tar.gz f8999c6256936417... 68c1e4ec2a247131...
    *-arm64-apple-darwin-codesigning.tar.gz e33513a263389b7c... 81bf7cd522670770...
    *-arm64-apple-darwin-unsigned.tar.gz 7c5a453513ec0850... f47233df5c83e4cf...
    *-arm64-apple-darwin-unsigned.zip d57eb714e111132b... e3dfe76fc44c05c2...
    *-powerpc64-linux-gnu-debug.tar.gz 5467ae49d1d3c68c... a7456d49c6dd2915...
    *-powerpc64-linux-gnu.tar.gz 76f667e56592f732... 398f77f8f5877965...
    *-riscv64-linux-gnu-debug.tar.gz 29c6f37babe24e24... 433a3a360708e910...
    *-riscv64-linux-gnu.tar.gz 4ac255dfa3f295c6... 750d33b88fd4db35...
    *-x86_64-apple-darwin-codesigning.tar.gz 1fab8a669d4b58c9... 1ca27635a9338e0e...
    *-x86_64-apple-darwin-unsigned.tar.gz abbbc7b484711bc7... 55a3db7ba7c8e60d...
    *-x86_64-apple-darwin-unsigned.zip d748d4548ea33f6c... df58b83819fa4ba3...
    *-x86_64-linux-gnu-debug.tar.gz 8fc1e04b90d920df... 0f1bab24f73b0f1f...
    *-x86_64-linux-gnu.tar.gz 7831f9973e845882... bcf9e56695d9437a...
    *.tar.gz eaf62bd30c82aab0... 2f988f8cbb8e698d...
    SHA256SUMS.part 9ca1bc71bda735df... f2b33615e84e95d3...
    guix_build.log 810be13f8c3ecc43... 21055af7dd4549f6...
    guix_build.log.diff 716ad18d12ece0ad...
  8. DrahtBot removed the label DrahtBot Guix build requested on May 23, 2025
  9. DrahtBot added the label Build system on May 23, 2025
  10. fanquake commented at 1:25 pm on May 30, 2025: member

    Would be nice to explain this with commands to test and observe the difference in behavior. This would make it easier to understand the goals and test them.

    Sure. On master (4b1d48a6866b24f0ed027334c6de642fc848d083):

    0# flags in C(XX)FLAGS
    1make -C depends print-linux_CFLAGS
    2linux_CFLAGS=-pipe -std=c11
    3make -C depends print-linux_CXXFLAGS
    4linux_CXXFLAGS=-pipe -std=c++20
    

    Libevent depends build:

    0 make -C depends libevent
    1# base cflags (-pipe -std=c11) present in libevent build
    2-- CMAKE_C_FLAGS:            -I/root/ci_scratch/depends/x86_64-pc-linux-gnu/include -D_GNU_SOURCE -D_FORTIFY_SOURCE=3 -pipe -std=c11 -O2 -fdebug-prefix-map=/root/ci_scratch/depends/work/build/x86_64-pc-linux-gnu/libevent/2.1.12-stable-1afae5fc856=/usr -fmacro-prefix-map=/root/ci_scratch/depends/work/build/x86_64-pc-linux-gnu/libevent/2.1.12-stable-1afae5fc856=/usr -Wall -Wextra -Wno-unused-parameter -Wstrict-aliasing -Wstrict-prototypes -fno-strict-aliasing -Wmissing-prototypes -Winit-self -Wmissing-field-initializers -Wdeclaration-after-statement -Waddress -Wnormalized=id -Woverride-init -Wlogical-op -Wwrite-strings
    

    CMake configure:

    0# duplicated -std=c++20, -pipe
    1C++ compiler flags .................... -m64 -pipe -std=c++20 -O2 -O2 -g -std=c++20 -fPIC -fno-extended-identifiers -fdebug-prefix-map=/root/ci_scratch/src=. -fmacro-prefix-map=/root/ci_scratch/src=. -fstack-reuse=none -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -Wstack-protector -fstack-protector-all -fcf-protection=full -fstack-clash-protection -Wall -Wextra -Wformat -Wformat-security -Wvla -Wredundant-decls -Wdate-time -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Woverloaded-virtual -Wsuggest-override -Wimplicit-fallthrough -Wunreachable-code -Wbidi-chars=any -Wundef -Wno-unused-parameter
    2Linker flags .......................... -pipe -std=c++20 -O2 -O2 -g -fstack-reuse=none -fstack-protector-all -fcf-protection=full -fstack-clash-protection -Wl,-z,relro -Wl,-z,now -Wl,-z,separate-code -fPIE -pie
    

    With this PR:

    0# flags no-longer in C(XX)FLAGS
    1make -C depends print-linux_CFLAGS
    2linux_CFLAGS=
    3make -C depends print-linux_CXXFLAGS
    4linux_CXXFLAGS=
    

    Libevent depends build:

    0 make -C depends libevent
    1# base cflags still present in libevent build
    2-- CMAKE_C_FLAGS:            -I/root/ci_scratch/depends/x86_64-pc-linux-gnu/include -D_GNU_SOURCE -D_FORTIFY_SOURCE=3  -O2 -pipe -std=c11 -fdebug-prefix-map=/root/ci_scratch/depends/work/build/x86_64-pc-linux-gnu/libevent/2.1.12-stable-ce229553a77=/usr -fmacro-prefix-map=/root/ci_scratch/depends/work/build/x86_64-pc-linux-gnu/libevent/2.1.12-stable-ce229553a77=/usr -Wall -Wextra -Wno-unused-parameter -Wstrict-aliasing -Wstrict-prototypes -fno-strict-aliasing -Wmissing-prototypes -Winit-self -Wmissing-field-initializers -Wdeclaration-after-statement -Waddress -Wnormalized=id -Woverride-init -Wlogical-op -Wwrite-strings
    

    CMake configure

    0cmake -B build --toolchain /root/ci_scratch/depends/x86_64-pc-linux-gnu/toolchain.cmake
    1# flags no-longer being passed through. 
    2# No more duplicated -std=c++20, -pipe removed
    3C++ compiler flags .................... -m64 -O2 -O2 -g -std=c++20 -fPIC -fno-extended-identifiers -fdebug-prefix-map=/root/ci_scratch/src=. -fmacro-prefix-map=/root/ci_scratch/src=. -fstack-reuse=none -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -Wstack-protector -fstack-protector-all -fcf-protection=full -fstack-clash-protection -Wall -Wextra -Wformat -Wformat-security -Wvla -Wredundant-decls -Wdate-time -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Woverloaded-virtual -Wsuggest-override -Wimplicit-fallthrough -Wunreachable-code -Wbidi-chars=any -Wundef -Wno-unused-parameter
    4Linker flags .......................... -O2 -O2 -g -fstack-reuse=none -fstack-protector-all -fcf-protection=full -fstack-clash-protection -Wl,-z,relro -Wl,-z,now -Wl,-z,separate-code -fPIE -pie
    
  11. fanquake force-pushed on May 30, 2025
  12. fanquake commented at 3:47 pm on May 30, 2025: member

    Guix Build:

     0c118e9965e3dc46a58e78ca4bb1573bf799d10b0a5a33c978ed5873801ded1e4  guix-build-51f6aa8ac47b/output/aarch64-linux-gnu/SHA256SUMS.part
     1abe0a4b2fee4bc928b73a0d8bfaeb7441a45afc01147f71ec76339844fa1a502  guix-build-51f6aa8ac47b/output/aarch64-linux-gnu/bitcoin-51f6aa8ac47b-aarch64-linux-gnu-debug.tar.gz
     2444bccc99b7a8910b62aef674ac9a0249f895c78ed19268017651eefeef5abd2  guix-build-51f6aa8ac47b/output/aarch64-linux-gnu/bitcoin-51f6aa8ac47b-aarch64-linux-gnu.tar.gz
     3ec1a9597e32d60a8588b5ac75b5f37cde90275f0dc1eeaf5a68310b43a5a3c84  guix-build-51f6aa8ac47b/output/arm-linux-gnueabihf/SHA256SUMS.part
     490ae5ac3137e4644791f2e2c330df1c305552ba7346efec23fa5e343ac0500d2  guix-build-51f6aa8ac47b/output/arm-linux-gnueabihf/bitcoin-51f6aa8ac47b-arm-linux-gnueabihf-debug.tar.gz
     5e850814b9773ae89047db6ce8132ed4729152cce42bbd8afbc8135baac9428f9  guix-build-51f6aa8ac47b/output/arm-linux-gnueabihf/bitcoin-51f6aa8ac47b-arm-linux-gnueabihf.tar.gz
     6f0f35d08337a1cf6a2ec49d5c1ba763ef43e8bd742534f7ef2fb713e48241cd9  guix-build-51f6aa8ac47b/output/arm64-apple-darwin/SHA256SUMS.part
     75254245b0788ef0e14e263f4c95bb0495ea164350e5818d3cba8a3cb96716194  guix-build-51f6aa8ac47b/output/arm64-apple-darwin/bitcoin-51f6aa8ac47b-arm64-apple-darwin-codesigning.tar.gz
     84dc618aeccd57ea4cca4ba75b451e80ef2edcc198011c608042708ee7400472d  guix-build-51f6aa8ac47b/output/arm64-apple-darwin/bitcoin-51f6aa8ac47b-arm64-apple-darwin-unsigned.tar.gz
     98c70722ad7f6112a9d95d8ba631c6e18060b967290d53d5dadda030b941267c1  guix-build-51f6aa8ac47b/output/arm64-apple-darwin/bitcoin-51f6aa8ac47b-arm64-apple-darwin-unsigned.zip
    10cdaa7a6bf8f86e72414688c8c28f9156e29bf4a4a7435193bea52358e48d9b28  guix-build-51f6aa8ac47b/output/dist-archive/bitcoin-51f6aa8ac47b.tar.gz
    11d413725fca363d8f375ee5c1db233ccf6e96fd847b0ae63a1a6dfde59f98695b  guix-build-51f6aa8ac47b/output/powerpc64-linux-gnu/SHA256SUMS.part
    123b685610b39a2e01665eed76e688871d8079533ebcfbbc0fe9b8f4fd69fe6114  guix-build-51f6aa8ac47b/output/powerpc64-linux-gnu/bitcoin-51f6aa8ac47b-powerpc64-linux-gnu-debug.tar.gz
    13771c426dc6bffba8f17cb092653c85a3554d92e4e5b892cc69370aa1ed50115b  guix-build-51f6aa8ac47b/output/powerpc64-linux-gnu/bitcoin-51f6aa8ac47b-powerpc64-linux-gnu.tar.gz
    1484a66c1a4661e98dea9fe871e333ea19812687e6910639d69be3b9e6cc252f35  guix-build-51f6aa8ac47b/output/riscv64-linux-gnu/SHA256SUMS.part
    15a94bfe4984fe5171963962a73bd5b5239a5c725fc264510f034cb7a63fee1cd6  guix-build-51f6aa8ac47b/output/riscv64-linux-gnu/bitcoin-51f6aa8ac47b-riscv64-linux-gnu-debug.tar.gz
    16d1e8c64b66854a29882d3e12b6f28f8f9b4737ccbf285f40d252854d2b960771  guix-build-51f6aa8ac47b/output/riscv64-linux-gnu/bitcoin-51f6aa8ac47b-riscv64-linux-gnu.tar.gz
    17b6fbe77174f73b544c21720631b0b1b7b387c3e635159f9ca9cb6cdeedbde76a  guix-build-51f6aa8ac47b/output/x86_64-apple-darwin/SHA256SUMS.part
    18c2895950434f8b946ec9ab380659104e5c763d07f353263d5b5d889de4385be8  guix-build-51f6aa8ac47b/output/x86_64-apple-darwin/bitcoin-51f6aa8ac47b-x86_64-apple-darwin-codesigning.tar.gz
    19645547eaaf9b37adbba3efca9387db9a50238dbc079853a0d40bd75565313e89  guix-build-51f6aa8ac47b/output/x86_64-apple-darwin/bitcoin-51f6aa8ac47b-x86_64-apple-darwin-unsigned.tar.gz
    20b1ab6fd7a47c495bd5f18411f3d9ce4f2820e3f0ce2826fe40cdf8f05c42a99e  guix-build-51f6aa8ac47b/output/x86_64-apple-darwin/bitcoin-51f6aa8ac47b-x86_64-apple-darwin-unsigned.zip
    215361f2e3f6c980579c663f9bebef8a60c5c939a8f70dacd8fc9d3a9dd6b94ba3  guix-build-51f6aa8ac47b/output/x86_64-linux-gnu/SHA256SUMS.part
    2292f47e0af06207c53904f4ff4f3ff7dad2636e3d0c38bad5fb01ab434aca5d9b  guix-build-51f6aa8ac47b/output/x86_64-linux-gnu/bitcoin-51f6aa8ac47b-x86_64-linux-gnu-debug.tar.gz
    23a18b3d0c2143879b59caafc8f09e999ab4d9435c665d091f49ba612f572cbfa9  guix-build-51f6aa8ac47b/output/x86_64-linux-gnu/bitcoin-51f6aa8ac47b-x86_64-linux-gnu.tar.gz
    24f0c361e3efdbd799cbeb91e7423e9de5ee09f83a93c6857365b8ac1a4670a6ed  guix-build-51f6aa8ac47b/output/x86_64-w64-mingw32/SHA256SUMS.part
    257d0341bf264916c96d8816f923affa37908d8b4a5ada3d4b276d2450ca874788  guix-build-51f6aa8ac47b/output/x86_64-w64-mingw32/bitcoin-51f6aa8ac47b-win64-codesigning.tar.gz
    268d150336eb837673c964d3c9d2137ad9e475f1c6db457b7a845d3277b5a29d1b  guix-build-51f6aa8ac47b/output/x86_64-w64-mingw32/bitcoin-51f6aa8ac47b-win64-debug.zip
    27f437f7403b6958d991d1f7d4d5f5b611cc2e3e245335b6bf5cf5b33aeff8a1cf  guix-build-51f6aa8ac47b/output/x86_64-w64-mingw32/bitcoin-51f6aa8ac47b-win64-setup-unsigned.exe
    282b06924fe6e5f20a1a2993e63198584278be0407e312c392f6be0240d4a52f1d  guix-build-51f6aa8ac47b/output/x86_64-w64-mingw32/bitcoin-51f6aa8ac47b-win64-unsigned.zip
    
  13. ryanofsky approved
  14. ryanofsky commented at 4:14 pm on June 2, 2025: contributor

    Code review ACK 51f6aa8ac47b7b5412553af2e7152d250a858d0d. This seems like a good change that deduplicates host definitions, and removes nonsensical inclusion of -std in host options rather than package options, since c/c++ standard versions should not vary by host.


    IIUC, this change is mostly just a refactoring. For example, it rearranges the libevent flags shown by make print-libevent_cflags from:

    0libevent_cflags=-pipe -std=c11 -O2 -fdebug-prefix-map=...
    

    to:

    0libevent_cflags= -O2 -pipe -std=c11 -fdebug-prefix-map=...
    

    It also no longer adds -pipe and -std options to the cmake toolchain file used by the bitcoin build. But those options had effect anyway because they just duplicated cmake’s own flags.


    This change does have a practical effect if flag environment variables are set. For example it changes CFLAGS=CUSTOM make print-libevent_cflags output from:

    0libevent_cflags=CUSTOM  -fdebug-prefix-map=...
    

    to

    0libevent_cflags=CUSTOM  -pipe -std=c11 -fdebug-prefix-map=...
    

    so setting custom flags no longer discards the -pipe -std=c11 options, which seems good for -std and maybe less good for -pipe, but probably fine.


    I did find PR & commit description somewhat confusing. The first sentence “The per-host flag values now represent the mandatory flags that cannot be overridden by the environment” seems wrong because settting CFLAGS in the environment does override the host linux_CFLAGS value (this is easy to test with make print-libevent_cflags) due to the logic in:

    https://github.com/bitcoin/bitcoin/blob/1c6602399be6de0148938a3fd7b51e6c48b985d2/depends/hosts/default.mk#L31-L37

    Which only appends the linux_CFLAGS value to x86_64_linux_CFLAGS on line 35 if the CFLAGS value on line 31 is unset.

    So maybe the sentence should say something like “The per-host flag variables hold platform-specific defaults that are ignored when flag environment variables are set, so it was wrong for them to contain -std options relied on by package definitions.”

    It could be nice generally to make the PR description less abstract and try to describe the practical effects it has, and what it is intending to do.

  15. DrahtBot requested review from hebasto on Jun 2, 2025
  16. depends: hard-code necessary c(xx)flags rather than setting them per-host
    The per-host flag variables hold platform-specific defaults that are ignored
    when flag environment variables are set, so it was wrong for them to contain
    -std options relied on by package definitions.
    
    Additionally, these flags (-pipe and -std=xx) will no longer be passed into
    the CMake build, meaning less duplication in the build summary.
    
    Pulled out of #31920.
    9954d6c833
  17. fanquake force-pushed on Jul 29, 2025
  18. fanquake commented at 10:15 am on July 29, 2025: member
    @ryanofsky made some changes to try and address your feedback.
  19. ryanofsky approved
  20. ryanofsky commented at 11:29 am on July 29, 2025: contributor
    Code review ACK 9954d6c833381a44e1ea34d182ffe4d61b65d2ba. No changes since last review other than improving the commit message. Change overall makes sense because it deduplicates host definitions, stops dropping -std flags from package builds when custom CFLAGS/CXXFLAGS environment variables are set, and stops passing duplicate flags to cmake that have no effect.
  21. fanquake commented at 2:01 pm on July 29, 2025: member

    Guix Build (aarch64):

     0d7dcb667b0d801e51490f677fe08be66ba635df93085d0479dcd00443b93bbf2  guix-build-9954d6c83338/output/aarch64-linux-gnu/SHA256SUMS.part
     1296a26bd69bc458e5a5953876703c664bf760f24ed93c61a43b418522c5c8e3a  guix-build-9954d6c83338/output/aarch64-linux-gnu/bitcoin-9954d6c83338-aarch64-linux-gnu-debug.tar.gz
     2118a81b7e941929f2d95d426e2b2a5d698b90f381819fc68572f5ec06d05b825  guix-build-9954d6c83338/output/aarch64-linux-gnu/bitcoin-9954d6c83338-aarch64-linux-gnu.tar.gz
     324d45e2b4e2d09a29b08ae8597b620a7ac657bfd4ee43dc7f8a371bd9b6b9a11  guix-build-9954d6c83338/output/arm-linux-gnueabihf/SHA256SUMS.part
     4208d0671a44751aaadad7a9a65756e0e7b92c2e1d44a462a479bd5d42129c543  guix-build-9954d6c83338/output/arm-linux-gnueabihf/bitcoin-9954d6c83338-arm-linux-gnueabihf-debug.tar.gz
     553bddbb6abf554a14dea629ea962e17db86ba4e86c1de74dd146e5ad2c70bc07  guix-build-9954d6c83338/output/arm-linux-gnueabihf/bitcoin-9954d6c83338-arm-linux-gnueabihf.tar.gz
     681420ef9f0bd51bf9d96e39d4093550b12e668226cf1c536c31020bafe48e81d  guix-build-9954d6c83338/output/arm64-apple-darwin/SHA256SUMS.part
     7b3293d37d063d589724975b4da12314f71c1fac22bf08690a79296d48057f62c  guix-build-9954d6c83338/output/arm64-apple-darwin/bitcoin-9954d6c83338-arm64-apple-darwin-codesigning.tar.gz
     89b28cbf6d8bcd7871dfbc2e1783dcbfb98a10624cd70a89f9534abf58a16d50e  guix-build-9954d6c83338/output/arm64-apple-darwin/bitcoin-9954d6c83338-arm64-apple-darwin-unsigned.tar.gz
     993bec960a74cecd9820618423fb2166db82d3b0558108fbdc5bde0bffc87019f  guix-build-9954d6c83338/output/arm64-apple-darwin/bitcoin-9954d6c83338-arm64-apple-darwin-unsigned.zip
    1052cb86ee94ad7c3500c8bce15ad99c81bd4d6df838e25f9a40f5e58ed6934da3  guix-build-9954d6c83338/output/dist-archive/bitcoin-9954d6c83338.tar.gz
    117b5f18f3b805ca0fb91a8394b9848d8d8961152f888e09e741412ec1ec0f681b  guix-build-9954d6c83338/output/powerpc64-linux-gnu/SHA256SUMS.part
    12a02963535304002b9f243e7867163a2574ed67797043d4f9ab834b02ec0b42e3  guix-build-9954d6c83338/output/powerpc64-linux-gnu/bitcoin-9954d6c83338-powerpc64-linux-gnu-debug.tar.gz
    137ba5fd240e748a51d8bf96034501b42bb17066f0ab37304de40a97f9aa74def3  guix-build-9954d6c83338/output/powerpc64-linux-gnu/bitcoin-9954d6c83338-powerpc64-linux-gnu.tar.gz
    14eeea9d6d6f65b17f56fa0c828bce80e5b75895c89976ff751cef653feeffad74  guix-build-9954d6c83338/output/riscv64-linux-gnu/SHA256SUMS.part
    15debc8334f914062b32aa8587831f6ff5ee62c0e47718c773110d36f730462069  guix-build-9954d6c83338/output/riscv64-linux-gnu/bitcoin-9954d6c83338-riscv64-linux-gnu-debug.tar.gz
    1633bb5d3f89f4eed67fc5dbe0123002d089c026f5dd5a2d4946c09a29d05b654e  guix-build-9954d6c83338/output/riscv64-linux-gnu/bitcoin-9954d6c83338-riscv64-linux-gnu.tar.gz
    1735c75687c542b300eb0a135ca042b44e76c6857271193ff874d58c626466343e  guix-build-9954d6c83338/output/x86_64-apple-darwin/SHA256SUMS.part
    180c3cd5ac202382de581b3a3d7bdae8cbe8140abb169046e9d5e187e7926bae6c  guix-build-9954d6c83338/output/x86_64-apple-darwin/bitcoin-9954d6c83338-x86_64-apple-darwin-codesigning.tar.gz
    195b103619180837f66bb78bdee721ee43f5cb136a4d29f46bdc71564dc9b8ad4c  guix-build-9954d6c83338/output/x86_64-apple-darwin/bitcoin-9954d6c83338-x86_64-apple-darwin-unsigned.tar.gz
    20d31986c8aad00a9ad15d9118338e962a91b9f9d01e889ea1098345962876074f  guix-build-9954d6c83338/output/x86_64-apple-darwin/bitcoin-9954d6c83338-x86_64-apple-darwin-unsigned.zip
    213b6f644f9328fd3b15fca810d63d1a026c51ff20e26dc886feb27b4457629a80  guix-build-9954d6c83338/output/x86_64-linux-gnu/SHA256SUMS.part
    222760e4cbb5fc08c475d1f975a01245442b03f7e06e4775c60eb98777e609e994  guix-build-9954d6c83338/output/x86_64-linux-gnu/bitcoin-9954d6c83338-x86_64-linux-gnu-debug.tar.gz
    236383ef2a8dd083324647b87cb0d65fdb82a9603c7145ff116ee210d2a5431aee  guix-build-9954d6c83338/output/x86_64-linux-gnu/bitcoin-9954d6c83338-x86_64-linux-gnu.tar.gz
    241fa7c2e217473f7306061473319deafc9f4b70fb45c7a6ac196da6ae81a981f8  guix-build-9954d6c83338/output/x86_64-w64-mingw32/SHA256SUMS.part
    250eae1f6129dec68d531a5d02ca91e420e6c8a7f411e9e47e3cd04479f9b4d985  guix-build-9954d6c83338/output/x86_64-w64-mingw32/bitcoin-9954d6c83338-win64-codesigning.tar.gz
    262f38a57a5ca2def7b2f0298a8f38e51528e77ef194e763488538da02e7296bac  guix-build-9954d6c83338/output/x86_64-w64-mingw32/bitcoin-9954d6c83338-win64-debug.zip
    274ac3facb227516381629e0169e11f6e1d68b0ffedb4a0cc0d8524431dd5f3271  guix-build-9954d6c83338/output/x86_64-w64-mingw32/bitcoin-9954d6c83338-win64-setup-unsigned.exe
    28db61a847feb0b2de0bb54c59bcb49b1da2bded0cab20bb3d53e88ca771e9bf52  guix-build-9954d6c83338/output/x86_64-w64-mingw32/bitcoin-9954d6c83338-win64-unsigned.zip
    
  22. DrahtBot added the label CI failed on Jul 29, 2025
  23. DrahtBot removed the label CI failed on Jul 30, 2025
  24. fanquake requested review from theuni on Jul 30, 2025
  25. theuni approved
  26. theuni commented at 5:58 pm on July 30, 2025: member
    ACK 9954d6c833381a44e1ea34d182ffe4d61b65d2ba
  27. achow101 commented at 8:53 pm on July 30, 2025: member
    ACK 9954d6c833381a44e1ea34d182ffe4d61b65d2ba
  28. achow101 merged this on Jul 30, 2025
  29. achow101 closed this on Jul 30, 2025

  30. fanquake deleted the branch on Jul 31, 2025

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: 2025-08-01 09:13 UTC

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