Cross-compile for Windows on Ubuntu 16.04 LTS usually fails using instructions from /doc/build-windows.md #12533

issue Willtech openend this issue on February 25, 2018
  1. Willtech commented at 6:21 am on February 25, 2018: contributor

    Here is the entire process on Ubuntu 16.04 LTS.

    Usually, on all of my previous attempts, the first make has failed. This time I did enable update during install which I have not done previously. Why this should make any difference when we run sudo apt update and sudo apt upgrade is a mystery and I do not think it changed anything.

    Note that usually make HOST=x86_64-w64-mingw32 fails early.

    I followed all steps in /doc/build-windows.md, but contancenate the apt install commands.

    I do not believe that sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu zesty universe" does what is expected on its own and this may be the source of an issue since the whole purpose of enabling this repo is to get the zesty version of Mingw-w64 due to a bug. The following sudo apt update command responds with errors about the repo not having a release file and, separately sudo apt upgrade is not always successful. I have observed elsewhere that repo mirrors are not always in perfect sync and suspect the same here.

    Then, sudo update-alternatives --config x86_64-w64-mingw32-g++ usually fails with a ’no alternatives’ response but not this time, so I selected POSIX as instructed. I did previously run sudo apt update several times after sudo apt upgrade failed before running it again. I suspect this failure is why the first make command fails and probably means previous steps need to be revisited.

    There seems to possibly be some intermittent repo issues.

    Also note, this time I checked out the v0.16.0rc4 tag into a new branch rather than just building on top of master. I do not know what else this changed. Apparently there have been some more recent dependancy change that were breaking make. See Issue #12515

    The first obvious issue during the process is that the previous update-alternatives ... command usually fails, and preceding that, the issue with sudo apt update.

    Step 1

    Step 2

    Step 3

    Step 4

    Step 5

    Step 6

    Step 7

    Step 8

    Step 9

    Step 10

    Step 11

    Step 12

    Step 13

    >sudo apt install build-essential libtool autotools-dev automake pkg-config bsdmainutils curl git g++-mingw-w64-x86-64 software-properties-common
    >sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu zesty universe"
    >sudo apt update #this posts errors in response
    >sudo apt upgrade #this failed
    >sudo apt update #this posts errors in response
    >sudo apt update #this posts errors in response
    >sudo apt upgrade #succeeded this time
    >sudo update-alternatives --config x86_64-w64-mingw32-g++ #this usually fails with no alternate
    >cd /usr/src
    >sudo git clone https://github.com/bitcoin/bitcoin.git
    >sudo chmod -R a+rw bitcoin
    >git checkout v0.16.0rc4 -b v16rc4
    >PATH=$(echo "$PATH" | sed -e 's/:\ mnt.*//g')
    >cd depends
    >make HOST=x86_64-w64-mingw32 #this usually fails early
    

    Step 14

    >cd ..
    >./autogen.sh
    

    Step 15

    >CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/
    

    Step 16

    >make
    

    The compiled executable using this procedure operated correctly on Windows 10 64-bit with limited testing. (without crashing as indicated in the mingw bug footnote in build-windows.md) Minor nit that the default proxy port on the compiled version v0.16.0rc4 has %2 for the value in the gui.

    This process needs to be debugged for reliable operation and the documents updated.

    I will post an update with further results but expect, if eventually successful, the compiled Windows executables will fail due to the bug and the repo not taking (nope, all three main executables worked on 64-bit Windows 10 without crashing..):

    a bug in the 64 bit Mingw-w64 cross compiler packaged for WSL/Ubuntu Xenial 16.04 that causes two of the bitcoin executables to crash shortly after start up.

    I was going to post the entire console output for debugging but the scrollback isn’t long enough and I lost everything early after running the first make command.

  2. Willtech commented at 11:20 am on February 27, 2018: contributor

    There have been some more recent dependancy changes that were breaking make when building from master. See Issue #12515

    Since build-windows.md needs to be updated, may I suggest a careful revision. Yes, no, not the build doc’s problem if the host platform has issues at times with the required steps but it may be worth noting what requires careful attention or, what output a success should give. Personally, I do not make the assumption that a noted step can simply be blindly keyed without regard to the response but, apparently, some do that.

  3. ken2812221 commented at 11:30 am on February 27, 2018: contributor
    It’s a bug caused by https://github.com/ccache/ccache/issues/229, so just wait them release ccache 3.4.2.Before then, just install zlib1g-dev.
  4. fanquake closed this on Mar 14, 2018

  5. Willtech commented at 4:21 am on March 17, 2018: contributor
    I do not know that the failure can be blamed on the referenced issue since nowhere did I install zlib1g-dev but nonetheless I believe that the doc build-windows.md has now been updated in v0.16.0.
  6. MarcoFalke locked this on Sep 8, 2021

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-10-05 01:12 UTC

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