depends: Use CC_FOR_BUILD for config.guess #29963

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:240425-guess-cc changing 1 files +1 −1
  1. hebasto commented at 7:01 pm on April 25, 2024: member

    On the master branch @ 3c88eac28e8984893746caebb313dc3b2fca90db, consider the following commands in the depends subdirectory:

    0$ make print-build HOST=i686-pc-linux-gnu CC="clang -m32"
    1build=x86_64-pc-linux-gnu
    2$ make print-host HOST=i686-pc-linux-gnu CC="clang -m32"
    3host=i686-pc-linux-gnu
    

    The printed variable values are expected.

    However, switching the CC variable context from Makefile to the shell environment breaks expectations:

    0$ CC="clang -m32" make print-build HOST=i686-pc-linux-gnu
    1build=i686-pc-linux-gnu
    2$ CC="clang -m32" make print-host HOST=i686-pc-linux-gnu
    3host=i686-pc-linux-gnu
    

    This PR fixes this issue.

  2. hebasto added the label Build system on Apr 25, 2024
  3. DrahtBot commented at 7:01 pm on April 25, 2024: 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/29963.

    Reviews

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

    Conflicts

    No conflicts as of last run.

  4. hebasto referenced this in commit 370c4e9161 on Apr 25, 2024
  5. theuni commented at 7:20 pm on April 25, 2024: member
    Where/why is this an issue?
  6. hebasto referenced this in commit 727cc73bcc on Apr 25, 2024
  7. hebasto commented at 7:27 pm on April 25, 2024: member

    Where/why is this an issue?

    I faced this issue during my work on the CMake staging branch when the CC environment variable was defined by the CI – https://github.com/hebasto/bitcoin/actions/runs/8822538616/job/24220973382.

    The log shows no cross-compiling, but it is cross-compiling to i686-pc-linux-gnu.

  8. theuni commented at 9:01 pm on April 25, 2024: member
    Surely this isn’t the only place env vars like this would cause issues? Feels like a cat-and-mouse game.
  9. maflcko commented at 8:11 am on April 26, 2024: member

    The log shows no cross-compiling, but it is cross-compiling to i686-pc-linux-gnu.

    Can you link to the exact lines in the log that show “no cross-compiling”.

  10. hebasto commented at 9:29 am on April 26, 2024: member

    The log shows no cross-compiling, but it is cross-compiling to i686-pc-linux-gnu.

    Can you link to the exact lines in the log that show “no cross-compiling”.

    https://github.com/hebasto/bitcoin/actions/runs/8822538616/job/24220973382#step:14:245:

    0Cross compiling ....................... FALSE
    

    Please note that that was a PR branch from the CMake migration project. That branch detects cross-compiling basing on host and build values when building with depends.

  11. fanquake commented at 9:51 am on April 26, 2024: member

    Surely this isn’t the only place env vars like this would cause issues? Feels like a cat-and-mouse game.

    Yea, as-is this doesn’t seem like a great fix, and may just break other things?

    A better diff might be something like:

     0diff --git a/depends/Makefile b/depends/Makefile
     1index 005d9696fb..091511758d 100644
     2--- a/depends/Makefile
     3+++ b/depends/Makefile
     4@@ -51,7 +51,7 @@ FALLBACK_DOWNLOAD_PATH ?= https://bitcoincore.org/depends-sources
     5 C_STANDARD ?= c11
     6 CXX_STANDARD ?= c++20
     7 
     8-BUILD = $(shell ./config.guess)
     9+BUILD = $(shell CC_FOR_BUILD=$CC ./config.guess)
    10 HOST ?= $(BUILD)
    11 PATCHES_PATH = $(BASEDIR)/patches
    12 BASEDIR = $(CURDIR)
    

    which would at least be using the option that is meant to be used for this.

  12. hebasto force-pushed on Apr 26, 2024
  13. hebasto commented at 10:05 am on April 26, 2024: member

    A better diff might be something like: … which would at least be using the option that is meant to be used for this.

    I agree. Implemented.

    Thanks!

  14. hebasto renamed this:
    depends: Do not consider `CC` environment variable for detecting system
    depends: Use `CC_FOR_BUILD` for `config.guess `
    on Apr 26, 2024
  15. theuni commented at 12:47 pm on April 26, 2024: member

    However, switching the CC variable context from Makefile to the shell environment breaks expectations

    Arguably that’s because this wasn’t intended to be supported :)

    I suppose this fix is reasonable, though supporting env vars like this seems quite brittle.

  16. hebasto referenced this in commit 21bee57cb6 on Apr 30, 2024
  17. hebasto referenced this in commit 516ecf1c8e on May 2, 2024
  18. hebasto referenced this in commit 729632c54f on May 2, 2024
  19. fanquake commented at 3:37 pm on May 31, 2024: member
    Is this still an issue given recent CMake changes?
  20. hebasto commented at 10:10 am on June 3, 2024: member

    Is this still an issue given recent CMake changes?

    Yes. Tested with the master branch @ 80bdd4b6beb878c95478b5623c9f9ff0b948ad57.

    And this PR still fixes it.

  21. DrahtBot added the label CI failed on Jun 18, 2024
  22. DrahtBot removed the label CI failed on Jun 18, 2024
  23. DrahtBot added the label CI failed on Sep 10, 2024
  24. DrahtBot removed the label CI failed on Sep 14, 2024
  25. achow101 requested review from fanquake on Oct 15, 2024
  26. achow101 requested review from theuni on Oct 15, 2024
  27. fanquake commented at 4:03 pm on October 24, 2024: member
    @hebasto can you rebase this?
  28. hebasto force-pushed on Oct 24, 2024
  29. hebasto commented at 4:08 pm on October 24, 2024: member

    @hebasto can you rebase this?

    Rebased.

  30. fanquake added the label DrahtBot Guix build requested on Oct 24, 2024
  31. DrahtBot commented at 9:54 am on October 25, 2024: contributor

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

    File commit 74fb19317aec6d5156e12da6be63e59e0cc99770(master) commit 8cf6a3aeaf20437a714b6c2b6f817cd57d8cff09(master and this pull)
    SHA256SUMS.part ad80f9275f7592f5... 60cfbff26d3ac855...
    *-aarch64-linux-gnu-debug.tar.gz e3f077c9e2efe42c... 1611c2fc3615b36a...
    *-aarch64-linux-gnu.tar.gz 84c5837e967a705e... e0db625be9859af1...
    *-arm-linux-gnueabihf-debug.tar.gz 198436220bbb764e... 8115f020abf2acf7...
    *-arm-linux-gnueabihf.tar.gz 8ab9ee456035f028... fb518d26a6936a6c...
    *-arm64-apple-darwin-unsigned.tar.gz 5f3493c8841e7000... 41229727f60b73c3...
    *-arm64-apple-darwin-unsigned.zip 53586205b08dae04... 377fcbf11713b0cb...
    *-arm64-apple-darwin.tar.gz 9bc61a1a9c494690... 19cf2e7611080487...
    *-powerpc64-linux-gnu-debug.tar.gz d736c35074e1ab00... cba9b8d9e094dee0...
    *-powerpc64-linux-gnu.tar.gz dc3411d9d8e023d0... 60d275915f058dbe...
    *-riscv64-linux-gnu-debug.tar.gz 14f550c7e6be73cb... f881035b90972ed6...
    *-riscv64-linux-gnu.tar.gz a5ce20b057de5651... b063b32fa7b6c2d8...
    *-x86_64-apple-darwin-unsigned.tar.gz 0a5aeae59a745fdd... ee329307733e0a36...
    *-x86_64-apple-darwin-unsigned.zip c17d6c147152032f... 3098eb653ffa25a8...
    *-x86_64-apple-darwin.tar.gz eb310f282a01918f... 21a73422bd7b32f1...
    *-x86_64-linux-gnu-debug.tar.gz 788598dd19a44259... c470987123553747...
    *-x86_64-linux-gnu.tar.gz 6b13f937a5601c35... 57a8a8062bb61dc7...
    *.tar.gz d344eb18d56160d8... e059bb50c284f19f...
    guix_build.log baf52e47221c27f4... 57984899bf58d2f5...
    guix_build.log.diff df4e8b61eda9235c...
  32. DrahtBot removed the label DrahtBot Guix build requested on Oct 25, 2024
  33. hebasto commented at 5:00 pm on October 29, 2024: member

    My Guix build:

     0aarch64
     1a2d14a22db6670a4f33aa4a7f9bd04d45cb861993b51670c4c950bf98f68864f  guix-build-707d65ba0d74/output/aarch64-linux-gnu/SHA256SUMS.part
     271d45a6c783b287a3369503b34ef08a42b5c4a2c8c2f636cf4665574e4f2f0ac  guix-build-707d65ba0d74/output/aarch64-linux-gnu/bitcoin-707d65ba0d74-aarch64-linux-gnu-debug.tar.gz
     33f5fb049c4347d25c091ec4412dfb3a9a6488a28aad2cca7bd52d822ff6b5f0f  guix-build-707d65ba0d74/output/aarch64-linux-gnu/bitcoin-707d65ba0d74-aarch64-linux-gnu.tar.gz
     4bb8a6a2aa57ea0d7e26523bd0d9bfd32416c31e3e0f7f1facc237f70c1528b16  guix-build-707d65ba0d74/output/arm-linux-gnueabihf/SHA256SUMS.part
     5abd7c08544aaf6c1c3538a8cdd551eec9e545eac0f2fdaf036d1cf99e6e62933  guix-build-707d65ba0d74/output/arm-linux-gnueabihf/bitcoin-707d65ba0d74-arm-linux-gnueabihf-debug.tar.gz
     6c1a542509b91945b679e520ff398bee9c3d66e94a3a1c356209b88290ae1202e  guix-build-707d65ba0d74/output/arm-linux-gnueabihf/bitcoin-707d65ba0d74-arm-linux-gnueabihf.tar.gz
     7c383ab8414f738ac152cfbc8c273bb224593854d605ecd3317f9d4485c672aa1  guix-build-707d65ba0d74/output/arm64-apple-darwin/SHA256SUMS.part
     89321290cd61e8c11aa46fa68130011362cc2d0a4d6d89520294f255c2de90dde  guix-build-707d65ba0d74/output/arm64-apple-darwin/bitcoin-707d65ba0d74-arm64-apple-darwin-unsigned.tar.gz
     953e9e64ae7f34c19b56528245554a90005ef25af28ef5971eaecb002c821d87c  guix-build-707d65ba0d74/output/arm64-apple-darwin/bitcoin-707d65ba0d74-arm64-apple-darwin-unsigned.zip
    101012af184f40d376e3807ee07f4c12b67a1ccaf43ee469d36b0cb4d2d989a53c  guix-build-707d65ba0d74/output/arm64-apple-darwin/bitcoin-707d65ba0d74-arm64-apple-darwin.tar.gz
    11e725088b69b7f8e1332e488bf0950f1f39ccbb70c632b73dd6548a55861a8efa  guix-build-707d65ba0d74/output/dist-archive/bitcoin-707d65ba0d74.tar.gz
    12881cc54f072595aee80e3e6557ff69d273e212ff5b9dec01eab2b26b15f5ae7a  guix-build-707d65ba0d74/output/powerpc64-linux-gnu/SHA256SUMS.part
    1300937e24253737195ddea04e2305c2e1eebff95152409b23ad39aa645cbd5787  guix-build-707d65ba0d74/output/powerpc64-linux-gnu/bitcoin-707d65ba0d74-powerpc64-linux-gnu-debug.tar.gz
    144fae317645f9b1ea003b6c6002e00bd4700bbe4be5b24d40f831c68d5cacc595  guix-build-707d65ba0d74/output/powerpc64-linux-gnu/bitcoin-707d65ba0d74-powerpc64-linux-gnu.tar.gz
    151db9cd63de6253f01f8ea816847040bf8784c9f8033acc88d52a0b6e5a77dfd4  guix-build-707d65ba0d74/output/riscv64-linux-gnu/SHA256SUMS.part
    16529314421f8301cf3fe88369c647858f73dff06a0f3710bcaa4d9cd4ba54d90b  guix-build-707d65ba0d74/output/riscv64-linux-gnu/bitcoin-707d65ba0d74-riscv64-linux-gnu-debug.tar.gz
    17dbe7d077b7707d04f8b90860064a449b84c0869b8e8ba628e5756e80127153a3  guix-build-707d65ba0d74/output/riscv64-linux-gnu/bitcoin-707d65ba0d74-riscv64-linux-gnu.tar.gz
    1851f2978456c02a6449028a6734e4affcc55002dac2222d546447279eda6aa4ba  guix-build-707d65ba0d74/output/x86_64-apple-darwin/SHA256SUMS.part
    1990f77b77a538820591efc724416936a601ead4a3eba02fd10e119fa8c6ad01da  guix-build-707d65ba0d74/output/x86_64-apple-darwin/bitcoin-707d65ba0d74-x86_64-apple-darwin-unsigned.tar.gz
    20ed0971cf057ccb95712822e39d111bb921e735115a494ae6e0160ec5b84fdb2e  guix-build-707d65ba0d74/output/x86_64-apple-darwin/bitcoin-707d65ba0d74-x86_64-apple-darwin-unsigned.zip
    21a513a1b3cf4a013539a0948e5da007a1574880ccf2df528741ede6107729b465  guix-build-707d65ba0d74/output/x86_64-apple-darwin/bitcoin-707d65ba0d74-x86_64-apple-darwin.tar.gz
    220c2030f3ccfbcbf4c1cb410f854802ad6126e9283a57709e980396b5f7c6241c  guix-build-707d65ba0d74/output/x86_64-linux-gnu/SHA256SUMS.part
    237a0343c42277c10f6bd833c63d6ea1bbfb19ee99e2c77dc06b07b702a7336396  guix-build-707d65ba0d74/output/x86_64-linux-gnu/bitcoin-707d65ba0d74-x86_64-linux-gnu-debug.tar.gz
    247dfc7bc9c6b301e8d51001d8a23077e318ee15d6582d45a0d173bc0269b83eb2  guix-build-707d65ba0d74/output/x86_64-linux-gnu/bitcoin-707d65ba0d74-x86_64-linux-gnu.tar.gz
    2581d60661f8d1bede83b1c2e1784455bdf0356fca6c3b072c1b3bd75a9a8c3b30  guix-build-707d65ba0d74/output/x86_64-w64-mingw32/SHA256SUMS.part
    264a714fafca490232218f2ceb85ff624995f850b71517908e687c6fca0ec6474a  guix-build-707d65ba0d74/output/x86_64-w64-mingw32/bitcoin-707d65ba0d74-win64-debug.zip
    273a47127b553e573d23422917d1c0f13901737089c3c4284c8d8814a196821fa2  guix-build-707d65ba0d74/output/x86_64-w64-mingw32/bitcoin-707d65ba0d74-win64-setup-unsigned.exe
    28b6b3a834a5356034f31564688b1b2d21da2929fe29b6d5c4ae4489b820e2798e  guix-build-707d65ba0d74/output/x86_64-w64-mingw32/bitcoin-707d65ba0d74-win64-unsigned.tar.gz
    29ee775c94af00706762fa29c827baf93afbd68a075298b062213bce391cc2f043  guix-build-707d65ba0d74/output/x86_64-w64-mingw32/bitcoin-707d65ba0d74-win64.zip
    
  34. hebasto commented at 9:42 am on February 10, 2025: member

    @theuni

    However, switching the CC variable context from Makefile to the shell environment breaks expectations

    Arguably that’s because this wasn’t intended to be supported :)

    I suppose this fix is reasonable, though supporting env vars like this seems quite brittle.

    There are testing environments, such as OSS-Fuzz, that rely on a project’s build system to support environment variables.

  35. DrahtBot added the label Needs rebase on Feb 12, 2025
  36. depends: Use `CC_FOR_BUILD` for `config.guess`
    Co-authored-by: Michael Ford <fanquake@gmail.com>
    38d13e68e2
  37. hebasto force-pushed on Feb 12, 2025
  38. hebasto commented at 12:32 pm on February 12, 2025: member
    Rebased to resolve the conflict with the merged bitcoin/bitcoin#30584.
  39. DrahtBot removed the label Needs rebase on Feb 12, 2025
  40. hebasto commented at 3:17 pm on February 12, 2025: member

    My Guix build:

     0aarch64
     1ab623f96d21b9651618ccd3dd1dd547494ecbe199cf1146dfebde4d02cd141a4  guix-build-38d13e68e276/output/aarch64-linux-gnu/SHA256SUMS.part
     21f70c006d53d319ebbfb915a909419d5084489e527c8cf24369f113c96705251  guix-build-38d13e68e276/output/aarch64-linux-gnu/bitcoin-38d13e68e276-aarch64-linux-gnu-debug.tar.gz
     3ae9eb92cdd2eee116bd48199ee9d8093082f58ce158badd47aaaa3cd044d2d9a  guix-build-38d13e68e276/output/aarch64-linux-gnu/bitcoin-38d13e68e276-aarch64-linux-gnu.tar.gz
     431c6976e87e9d1e87759ab3057f2c75eb5ed824e0a986a8317dd7b9bcd0d8fa7  guix-build-38d13e68e276/output/arm-linux-gnueabihf/SHA256SUMS.part
     52a3ac0e4368c9d83419539db88a886e4f49ad93e67bf6bcc78d88c4118ab40c7  guix-build-38d13e68e276/output/arm-linux-gnueabihf/bitcoin-38d13e68e276-arm-linux-gnueabihf-debug.tar.gz
     62a5e990b3c3c236bcfe720d526dbf2a319d15eba81591d280aad15c746511bb9  guix-build-38d13e68e276/output/arm-linux-gnueabihf/bitcoin-38d13e68e276-arm-linux-gnueabihf.tar.gz
     7c5d8de4a45ed34f3cce046a540421fc05ab0f98937479afe279f645522e5d961  guix-build-38d13e68e276/output/arm64-apple-darwin/SHA256SUMS.part
     8f12c6ca851f7f1bc88ed8f31aa87cf10aad84974eceab20e463de91ef3508142  guix-build-38d13e68e276/output/arm64-apple-darwin/bitcoin-38d13e68e276-arm64-apple-darwin-unsigned.tar.gz
     90e03be196c8d5a40e0fd8cfa397e19f0d61f14fb8ff2ab50bf90a06289b2362d  guix-build-38d13e68e276/output/arm64-apple-darwin/bitcoin-38d13e68e276-arm64-apple-darwin-unsigned.zip
    10c3705df317214be53b9360f91ca9a4c1721c6bb4dad75cc348afb19d3f5c3858  guix-build-38d13e68e276/output/arm64-apple-darwin/bitcoin-38d13e68e276-arm64-apple-darwin.tar.gz
    11db57e79fd0d357b99d8d4e762806933ac93d464f19f66b050c9cbe5f52250ab6  guix-build-38d13e68e276/output/dist-archive/bitcoin-38d13e68e276.tar.gz
    12c221715291996b44d6f4b23afb9add05987d50936d0f52fda64d5ee8410b3806  guix-build-38d13e68e276/output/powerpc64-linux-gnu/SHA256SUMS.part
    133c5f3605d0905db76d79fdb84732e0966847c49e0ce0bf676e21c8ba57a1043f  guix-build-38d13e68e276/output/powerpc64-linux-gnu/bitcoin-38d13e68e276-powerpc64-linux-gnu-debug.tar.gz
    14b7766749323a62b282f01de85877921e957db7c1b59a051d2a1b10c17e8c54c0  guix-build-38d13e68e276/output/powerpc64-linux-gnu/bitcoin-38d13e68e276-powerpc64-linux-gnu.tar.gz
    151d2fd609475244b702a3a945f4cf65bbf1ebd1bcabdcd1f8189581255a4ed699  guix-build-38d13e68e276/output/riscv64-linux-gnu/SHA256SUMS.part
    16c4f08e1f730f89084a05c56ff1eca2962ac1ca83add1cc65ef46fc4a93fd0ea2  guix-build-38d13e68e276/output/riscv64-linux-gnu/bitcoin-38d13e68e276-riscv64-linux-gnu-debug.tar.gz
    1712a1f93c3bb5aaff41cd9ecb4bf4fe6e09cb251befa06c2d3832706bc6a87d97  guix-build-38d13e68e276/output/riscv64-linux-gnu/bitcoin-38d13e68e276-riscv64-linux-gnu.tar.gz
    18bc6ab43d9046cccb70fcef4782395bcc71ca0039ab0c63fdd60fbe9de0d0a573  guix-build-38d13e68e276/output/x86_64-apple-darwin/SHA256SUMS.part
    19aa844cf3c1cec314bd7035845cedadc1240aa7dc77b6510f85735d464f5f84d5  guix-build-38d13e68e276/output/x86_64-apple-darwin/bitcoin-38d13e68e276-x86_64-apple-darwin-unsigned.tar.gz
    2043d30e0027c18a7aeb439b13b6761373cb53984500b3e99ebb82cac2d7fb11ca  guix-build-38d13e68e276/output/x86_64-apple-darwin/bitcoin-38d13e68e276-x86_64-apple-darwin-unsigned.zip
    21a4ee31178b1746245f27ed77a61c928f1df39ff916fb83193828666b364a3849  guix-build-38d13e68e276/output/x86_64-apple-darwin/bitcoin-38d13e68e276-x86_64-apple-darwin.tar.gz
    22f01cff25baea72e8a2ddfeab7e1d04023cfc99176072e6446aebd59cb501dc18  guix-build-38d13e68e276/output/x86_64-linux-gnu/SHA256SUMS.part
    239dfcf2c386ea4821425449ff1244aa26b83c70b6fa36767de26be48ff98d069e  guix-build-38d13e68e276/output/x86_64-linux-gnu/bitcoin-38d13e68e276-x86_64-linux-gnu-debug.tar.gz
    24755689356c0838578db1b7fe61f2b0727e8cdddccd015a7f69188174149a981a  guix-build-38d13e68e276/output/x86_64-linux-gnu/bitcoin-38d13e68e276-x86_64-linux-gnu.tar.gz
    25b0f47c75baea43007e7cf8469634121086068cb6658107a46faef2e0b2f7d64c  guix-build-38d13e68e276/output/x86_64-w64-mingw32/SHA256SUMS.part
    26b6a07fc34dc3c50ae4804aebfbfcfdd05f553e80df73dfa9de78790e5f395250  guix-build-38d13e68e276/output/x86_64-w64-mingw32/bitcoin-38d13e68e276-win64-debug.zip
    27154d6cb011f475b21c0941a568662ada35654cff20d05fd0cd4dd28214e8c169  guix-build-38d13e68e276/output/x86_64-w64-mingw32/bitcoin-38d13e68e276-win64-setup-unsigned.exe
    28ca2708afbadea82d840a69885d5b5f6f233b32ff5b512e20b5f34c7e51c18875  guix-build-38d13e68e276/output/x86_64-w64-mingw32/bitcoin-38d13e68e276-win64-unsigned.tar.gz
    29e7c0ece29c932db0747bfa5e7924b9553c1dd18e21f5c066f58d33ecb1e8b5c3  guix-build-38d13e68e276/output/x86_64-w64-mingw32/bitcoin-38d13e68e276-win64.zip
    
  41. theuni commented at 6:55 pm on February 12, 2025: member

    I don’t understand this change. It seems setting CC_FOR_BUILD to CC is exactly the opposite of what we want to do? @hebasto’s original change makes more sense to me:

    0BUILD = $(shell env --unset CC ./config.guess)
    

    That ignores what’s set in CC when detecting the native platform, which seems like the correct behavior to me.

    What was your intention with this patch, @fanquake ?

  42. DrahtBot added the label CI failed on Jul 3, 2025
  43. DrahtBot removed the label CI failed on Jul 3, 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-07-05 15:13 UTC

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