build: Always assume cross compiling for mingw32 hosts #23722

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:211209-yes changing 1 files +6 −1
  1. hebasto commented at 2:51 am on December 9, 2021: member

    This PR fixes cross compiling on systems with both enabled binfmt_misc kernel feature and installed wine-binfmt package:

    0$ cat /proc/sys/fs/binfmt_misc/status
    1enabled
    2$ dpkg -l wine-binfmt
    3Desired=Unknown/Install/Remove/Purge/Hold
    4| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
    5|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
    6||/ Name           Version      Architecture Description
    7+++-==============-============-============-========================================================
    8ii  wine-binfmt    5.0-3ubuntu1 all          Register Wine as the interpreter for Windows executables
    

    On master (f727d814bd8df5a5346c128dd4573e457c1970e1):

    0$ CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure 2>&1 | grep -e 'checking whether we are cross compiling'
    1checking whether we are cross compiling... no
    2checking whether we are cross compiling... no
    

    With this PR:

    0$ CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure 2>&1 | grep -e 'checking whether we are cross compiling'
    1checking whether we are cross compiling... yes
    2checking whether we are cross compiling... yes
    

    Guix build:

    0$ find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
    16b91e005fb0243f5b40470f6bee515b96ee7a05cf8a639a5caa8b967e80b0d25  guix-build-06c8fb66fbc2/output/dist-archive/bitcoin-06c8fb66fbc2.tar.gz
    243759a18e2272ae77cbe268a938746070fa2870ab303ecf727a730f6cc01b580  guix-build-06c8fb66fbc2/output/x86_64-w64-mingw32/SHA256SUMS.part
    37888ccdfc3753949d9a4c018b329dd9a48b62ece3188f428dde666e44319a381  guix-build-06c8fb66fbc2/output/x86_64-w64-mingw32/bitcoin-06c8fb66fbc2-win-unsigned.tar.gz
    4921dae20148bce7ea3973cc034da8186e7a92c7ba6e42a233e62d986ecaac3fd  guix-build-06c8fb66fbc2/output/x86_64-w64-mingw32/bitcoin-06c8fb66fbc2-win64-debug.zip
    5501581fbd32d4fa8371aefa3a8d6610d2e1ac52f261b03e763f14af1d10410d0  guix-build-06c8fb66fbc2/output/x86_64-w64-mingw32/bitcoin-06c8fb66fbc2-win64-setup-unsigned.exe
    65c2c8b53780689253f9de20d30b60dacc82c12ed8a81660ae112e53f675d749a  guix-build-06c8fb66fbc2/output/x86_64-w64-mingw32/bitcoin-06c8fb66fbc2-win64.zip
    

    Fixes bitcoin/bitcoin#22854.

  2. build: Always assume cross compiling for mingw32 hosts
    This change fixes cross compiling on systems with both enabled
    `binfmt_misc` kernel feature and installed `wine-binfmt` package.
    06c8fb66fb
  3. hebasto added the label Windows on Dec 9, 2021
  4. hebasto added the label Build system on Dec 9, 2021
  5. luke-jr changes_requested
  6. luke-jr commented at 2:53 am on December 9, 2021: member
    Concept NACK. Builds performed on Windows are not cross-compiling.
  7. fanquake commented at 2:54 am on December 9, 2021: member
    Concept NACK. #22854 is being solved upstream.
  8. hebasto commented at 3:12 am on December 9, 2021: member

    Concept NACK. Builds performed on Windows are not cross-compiling.

    You mean WSL?

  9. hebasto commented at 3:15 am on December 9, 2021: member

    Concept NACK. #22854 is being solved upstream.

    Is this

    0$ CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure 2>&1 | grep -e 'checking whether we are cross compiling'
    1checking whether we are cross compiling... no
    2checking whether we are cross compiling... no
    

    solved in upstream?

    I mean, does configure recognize cross-compiling correctly?

  10. fanquake commented at 4:05 am on December 9, 2021: member

    Is this solved in upstream? I mean, does configure recognize cross-compiling correctly?

    No, but is that a problem for our usage? After #22854 is solved by pulling in the newer subtree, is there another issue that would be fixed by this change? It’s working around that fact that autotools thinks it’s not cross-compiling because the system is configured to run .exe bins without explicitly calling wine. However if the only consequence is a single incorrect line printed in the configure output, that’s not a huge issue.

    If anything, a better/more generic solution might be to set build_alias, as when build differs from host configure is meant to automatically enter cross-compilation mode.

  11. hebasto commented at 5:01 am on December 9, 2021: member

    Is this solved in upstream? I mean, does configure recognize cross-compiling correctly?

    No, but is that a problem for our usage? After #22854 is solved by pulling in the newer subtree, is there another issue that would be fixed by this change?

    Not knowing another issue does not mean the code is correct, no?

    If anything, a better/more generic solution might be to set build_alias, as when build differs from host configure is meant to automatically enter cross-compilation mode.

    I’ve considered this option while was working on this PR. It does not work.

  12. hebasto commented at 5:04 am on December 9, 2021: member

    Guix builds:

     0$ find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
     1e6d8073fab1aca432aaf1196a06d6d4856b9fb52128a5883b6e7b90cd589b823  guix-build-06c8fb66fbc2/output/aarch64-linux-gnu/SHA256SUMS.part
     294bf8923e1affb7eb9d3e0d3ce9ff659e1cc1da6cb5667a9c640ad92d5aeabe2  guix-build-06c8fb66fbc2/output/aarch64-linux-gnu/bitcoin-06c8fb66fbc2-aarch64-linux-gnu-debug.tar.gz
     3c68c4604ac0c5c7fe3aea379604777097c0e96575aa3e502c7662f96e84cd756  guix-build-06c8fb66fbc2/output/aarch64-linux-gnu/bitcoin-06c8fb66fbc2-aarch64-linux-gnu.tar.gz
     49638f436c6ea4078364bb972957986692484bbb606422cb1ecad465d579dcd88  guix-build-06c8fb66fbc2/output/arm-linux-gnueabihf/SHA256SUMS.part
     5def868c61dc2e02bbd24e4f35823dccc25173f629c4a532ce11cb55a57e92ea2  guix-build-06c8fb66fbc2/output/arm-linux-gnueabihf/bitcoin-06c8fb66fbc2-arm-linux-gnueabihf-debug.tar.gz
     6428e75cef7197c32aaa3c06d960c4cf77c8c83b3239327c329a2bf81a97f2d52  guix-build-06c8fb66fbc2/output/arm-linux-gnueabihf/bitcoin-06c8fb66fbc2-arm-linux-gnueabihf.tar.gz
     76b91e005fb0243f5b40470f6bee515b96ee7a05cf8a639a5caa8b967e80b0d25  guix-build-06c8fb66fbc2/output/dist-archive/bitcoin-06c8fb66fbc2.tar.gz
     8edfe255c4772ef1284ecd5503b59c003e8b1885ba37df632625afc7abc74d38b  guix-build-06c8fb66fbc2/output/powerpc64-linux-gnu/SHA256SUMS.part
     93903d02cddcb9d0c50fdb3b4072a5b47fcb9a809cf82a341db4d076468ffc96b  guix-build-06c8fb66fbc2/output/powerpc64-linux-gnu/bitcoin-06c8fb66fbc2-powerpc64-linux-gnu-debug.tar.gz
    10d99a2a64a3a00daef7b4ee14003b71edf84fb7f350a000a0c10cf3506f2e5acc  guix-build-06c8fb66fbc2/output/powerpc64-linux-gnu/bitcoin-06c8fb66fbc2-powerpc64-linux-gnu.tar.gz
    119c7a33abb80ec11030c95924ee74ccbc53e587403682124b453788522124ad32  guix-build-06c8fb66fbc2/output/powerpc64le-linux-gnu/SHA256SUMS.part
    12390bdf16bf034f0f9a9cb49f7ddf5cf64f8f530c9d361a54f271732997fa97b1  guix-build-06c8fb66fbc2/output/powerpc64le-linux-gnu/bitcoin-06c8fb66fbc2-powerpc64le-linux-gnu-debug.tar.gz
    138973cd75727bc64731150cd5ad780769c9fbde58de86c5832d11fd9192efeb69  guix-build-06c8fb66fbc2/output/powerpc64le-linux-gnu/bitcoin-06c8fb66fbc2-powerpc64le-linux-gnu.tar.gz
    147e7549faee2925fc042a713314d83ba4a0a063aea80389ac578ece4832107f19  guix-build-06c8fb66fbc2/output/riscv64-linux-gnu/SHA256SUMS.part
    15c66fa461b80de17066aaa45acc9d310b369f1df44bed6154c10ed1ef8ac99fa4  guix-build-06c8fb66fbc2/output/riscv64-linux-gnu/bitcoin-06c8fb66fbc2-riscv64-linux-gnu-debug.tar.gz
    16e1f9f1dc905d1c5573f69de1f5c3714bd20d0be369079dc6ba2a3f272ca68e36  guix-build-06c8fb66fbc2/output/riscv64-linux-gnu/bitcoin-06c8fb66fbc2-riscv64-linux-gnu.tar.gz
    177b6e0545dab2a75e7f698736b6c9c861596bdb20adc7189c159e6e93926aee0c  guix-build-06c8fb66fbc2/output/x86_64-apple-darwin19/SHA256SUMS.part
    186d6d935317959521d80baf6c325ad912e671b8a15c1512f3ef4dd4adb0b07bc2  guix-build-06c8fb66fbc2/output/x86_64-apple-darwin19/bitcoin-06c8fb66fbc2-osx-unsigned.dmg
    19500c357077b478f2ec1809b754e0f5a0f8b876070c1136e38198b632ddb53f7c  guix-build-06c8fb66fbc2/output/x86_64-apple-darwin19/bitcoin-06c8fb66fbc2-osx-unsigned.tar.gz
    2041c0e986e692b37813f7504087bb6a984dc5f8ee0060efbbbf49f187631914e2  guix-build-06c8fb66fbc2/output/x86_64-apple-darwin19/bitcoin-06c8fb66fbc2-osx64.tar.gz
    216c2d986e91db9c85e1d82588bc673319d8d8a953b26fc8442d267e733d93d402  guix-build-06c8fb66fbc2/output/x86_64-linux-gnu/SHA256SUMS.part
    22d6ee3a45a3f1241c8779f1d37a397a8f37d60dd8535e14b0779826b6d5aa5ea0  guix-build-06c8fb66fbc2/output/x86_64-linux-gnu/bitcoin-06c8fb66fbc2-x86_64-linux-gnu-debug.tar.gz
    231a6c8b1d3cd5d51029e03825c6193dae03aa00a8191053823b03dba3516501ce  guix-build-06c8fb66fbc2/output/x86_64-linux-gnu/bitcoin-06c8fb66fbc2-x86_64-linux-gnu.tar.gz
    2443759a18e2272ae77cbe268a938746070fa2870ab303ecf727a730f6cc01b580  guix-build-06c8fb66fbc2/output/x86_64-w64-mingw32/SHA256SUMS.part
    257888ccdfc3753949d9a4c018b329dd9a48b62ece3188f428dde666e44319a381  guix-build-06c8fb66fbc2/output/x86_64-w64-mingw32/bitcoin-06c8fb66fbc2-win-unsigned.tar.gz
    26921dae20148bce7ea3973cc034da8186e7a92c7ba6e42a233e62d986ecaac3fd  guix-build-06c8fb66fbc2/output/x86_64-w64-mingw32/bitcoin-06c8fb66fbc2-win64-debug.zip
    27501581fbd32d4fa8371aefa3a8d6610d2e1ac52f261b03e763f14af1d10410d0  guix-build-06c8fb66fbc2/output/x86_64-w64-mingw32/bitcoin-06c8fb66fbc2-win64-setup-unsigned.exe
    285c2c8b53780689253f9de20d30b60dacc82c12ed8a81660ae112e53f675d749a  guix-build-06c8fb66fbc2/output/x86_64-w64-mingw32/bitcoin-06c8fb66fbc2-win64.zip
    
  13. fanquake commented at 8:27 am on December 9, 2021: member

    Not knowing another issue does not mean the code is correct, no?

    If there’s no other issues, then what justification is there for changing the code? I’d rather be conservative, and not change anything, unless something is actively broken. We know what the problem is, configure mis-detecting as not cross-compiling in a very specific circumstance, however it seems that as far as we are aware, this has no effect on our build (after #22854 is solved with the subtree update).

    I’ve considered this option while was working on this PR. It does not work.

    Ok. It’s a shame that doesn’t work. It must only work when you actually pass --build and --host?

  14. real-or-random commented at 9:44 am on December 9, 2021: member

    I really think we should fix that upstream. I hoped to have bitcoin-core/secp256k1#988 ready much earlier but I still expect it to be merged in a few days…

    Ok. It’s a shame that doesn’t work. It must only work when you actually pass –build and –host?

    The generated configure has this snippet: ;)

    0# FIXME: To remove some day.
    1if test "x$host_alias" != x; then
    2  if test "x$build_alias" = x; then
    3    cross_compiling=maybe
    4  elif test "x$build_alias" != "x$host_alias"; then
    5    cross_compiling=yes
    6  fi
    7fi
    

    But yeah, I tend to think we should not bother as long as we don’t see real failures. “Correctness” of the build system is a fuzzy thing, at least when it comes to autotools trying to be compatible with every single environment out there.

  15. hebasto commented at 10:33 am on December 9, 2021: member

    It must only work when you actually pass --build and --host?

    Yes, it works. But only in the standalone bitcoin-core/secp256k1 repo. And it does not work when using a config.site file in which the cross_compiling variable has being set explicitly.

    FWIW, I used this PR approach for the “Win64” job setting in the https://bitcoinbuilds.org.

    Anyway, feel free to close this PR.

  16. fanquake commented at 12:33 pm on December 9, 2021: member

    Anyway, feel free to close this PR.

    Ok. I don’t think this is the direction we want to go. #22854 will be resolved very soon, at which point, as far as I’m aware, this stops being an issue for us.

  17. fanquake closed this on Dec 9, 2021

  18. DrahtBot locked this on Dec 9, 2022

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: 2024-12-22 06:12 UTC

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