Instructions for compiling Bitcoin Core missing steps or otherwise not compiling bitcoin for windows in linux #12515

issue number9387 openend this issue on February 23, 2018
  1. number9387 commented at 6:00 am on February 23, 2018: none

    I downloaded Oracle VM to run Linux on my windows computer to compile a windows executable of bitcoin core. I’ve had many errors and spent over the last 24 hours downloading, building, and overall troubleshooting to no avail. Considering the number of errors I experienced I think the steps may need to be re-examined when running a fresh install of Linux. (I have linux version 16.04). If there are certain “intuitive” steps that were left out, as someone not that familiar with linux, I am likely unaware of them.

    Some specific issues I’ve run into:

    1. https://askubuntu.com/questions/91815/how-to-install-software-or-upgrade-from-an-old-unsupported-release is required, per the download instructions, to build this, but even following the instructions on this page results in errors

    2. funcs.mk:242: recipe for target ‘/home/a/bitcoin/depends/work/build/x86_64-w64-mingw32/zeromq/4.2.2-58b9134cfdf/./.stamp_configured’ failed

    compilation terminated. …failed gcc.compile.c++ bin.v2/libs/filesystem/build/gcc-mingw-6.2.1/release/binary-format-pe/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi/operations.o… …skipped <pbin.v2/libs/filesystem/build/gcc-mingw-6.2.1/release/binary-format-pe/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi>libboost_filesystem-mt-s.a(clean for lack of <pbin.v2/libs/filesystem/build/gcc-mingw-6.2.1/release/binary-format-pe/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi>operations.0… …skipped <pbin.v2/libs/filesystem/build/gcc-mingw-6.2.1/release/binary-format-pe/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi>libboost_filesystem-mt-s.a for lack of <pbin.v2/libs/filesystem/build/gcc-mingw-6.2.1/release/binary-format-pe/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi>operations.o… …skipped <pstage/lib> libboost_filesystem-mt-s-.a for lack of <pbin.v2/libs/filesystem/build/gcc-mingw-6.2.1/release/binary-format-pe/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi>libboost_filesystem-mt-s.a…. …failed updating 1 target… …skipped 3 targets… funcs.mk:242: recipe for target ‘/home/a/a/bitcoin/depends/work/build/i686-w64-mingw32/boost/1_64_0-e638125fff0/./.stamp_built’ failed make: ***[/home/a/a/bitcoin/depends/work/build/i686-w64-mingw32/boost/1_64_0-e638125fff0/./.stamp_built] Error 1

  2. MarcoFalke commented at 2:33 pm on February 23, 2018: member
  3. number9387 commented at 3:04 pm on February 23, 2018: none
    Those are the “steps” I was referencing that did not result in a successful build.
  4. MarcoFalke commented at 5:44 pm on February 23, 2018: member

    https://askubuntu.com/questions/91815/how-to-install-software-or-upgrade-from-an-old-unsupported-release is required, per the download instructions, to build this, but even following the instructions on this page results in errors

    Ubuntu 16.04 is not end-of-life. I am pretty sure you don’t need that. Potentially your version of Ubuntu 16.04 is messed up and you could start by wiping the vm and starting all over again. Basically, it should work by just copy pasting the commands into the vm.

  5. sipsorcery commented at 11:02 pm on February 23, 2018: member

    What does your VM give for the Linux Standard Base command?

    lsb_release -a

    I was one of the ones that contributed some minor updates to the Windows build document and I successfully tested the build on:

    • Bare metal with Ubuntu 16.04.3 LTS,
    • VMWare (12.5.7) Virtual Machine with Ubuntu 16.04.3 LTS,
    • Windows Ubuntu application (aka Windows Subsystem for Linux) with Ubuntu 16.04.3 LTS.

    In your case the build seems to have bombed out building the Boost dependency. That’s an unusual place to fail and I’d recommend checking your VM has sufficient disk space.

  6. number9387 commented at 1:16 am on February 24, 2018: none
    I will wipe it and try again. I am using Oracle VM Virtual Box and downloading a linux iso from ubuntu.com to install it. There should be plenty of room (100gb fixed storage).
  7. number9387 commented at 1:53 am on February 24, 2018: none

    Okay, installed ubuntu 17.10.1 and told to download all updates. Fresh Oracle VM Virtual Box install, I downloaded the ubuntu ISO from ubuntu.com. I typed

    sudo apt install build-essential libtool autotools-dev automake pkg-config bsdmainutils curl git

    Per the instructions for Ubuntu version 17 I typed:

    sudo update-alternatives –config x86_64-w64-mingw32-g++

    Terminal responded there was no “alternative”.

    Then typed:

    git clone https://github.com/bitcoin/bitcoin.git

    Worked.

    Then typed:

    cd bitcoin

    Then:

    PATH=$(echo “$PATH” | sed -e ’s/:/mnt.*//g’) # strip out problematic Windows %PATH% imported var

    Response was nothing. typed:

    cd depends

    which changed folders

    Then typed:

    make HOST=x86_64-w64-mingw32

    It did a lot of work, then it stated, after “snprintf.c” appeared to finish,

    make[1]: *** No rule to make target ‘zlib/adler32.o’, needed by ‘zlib/libz.a’. Stop. make[1]: Leaving directory ‘/home/a/bitcoin/depends/work/build/x86_64-w64-mingw32/native_ccache/3.4.1-21245b6733e’ funcs.mk:242: recipe for target ‘/home/a/bitcoin/depends/work/build/x86_64-w64-mingw32/native_cache/3.4.1-21245b6733e/./.stamp_built’ failed make: *** [/home/a/bitcoin/depends/work/build/x86_64-w64-mingw32/native_ccache/3.4.1-21245b6733e/./.stamp_built] Error 2

    I typed lsb_release -a and got:

    No LSB modules are available Distributor ID: Ubuntu Description: Ubuntu 17.10 Release: 17.10 Codename: artful

  8. wwg2018new commented at 3:31 am on February 24, 2018: none
    @sipsorcery the Windows release binaries cannot excute,but can excute in VMWare (12.5.7) Virtual Machine with Ubuntu 16.04.3 LTS。
  9. sipsorcery commented at 4:44 am on February 24, 2018: member
    @wwg2018new Not sure what you mean? If you’re doing a cross compile build for Windows then the binaries will only execute on a Windows OS and not on Linux.
  10. Willtech commented at 7:12 am on February 24, 2018: contributor

    That same document it says:

    Ubuntu Trusty 14.04 is recommended…

    I think you are lucky it works on newer versions of Ubuntu at all, e.g. Ubuntu 16.04.3 LTS, sometimes those required versions for build are hard fixed.

  11. achow101 commented at 7:18 am on February 24, 2018: member

    @number9387 Did you do:

    sudo apt install g++-mingw-w64-x86-64
    

    From what you have posted, that seems to be missing, but it is an important step.


    I don’t think the instructions are lacking in any way. If you follow them to the word, it will work, I have tested it before in a clean VM.

  12. number9387 commented at 7:19 am on February 24, 2018: none
    @achow101 Well the steps state that’s just the general usage, and gave the specific step for the version of Ubuntu I was using. Either way, I did do that too. It changed nothing. Same result.
  13. achow101 commented at 7:20 am on February 24, 2018: member
    It does not say that is general usage, it says that is common usage, which means you have to do that regardless of the version you run. Once you do that, you need to do the update-alternatives step again.
  14. number9387 commented at 7:25 am on February 24, 2018: none
    @achow101 I am wiping the VM and will start over again from scratch to ensure no variations will alter my results and I will use your instruction.
  15. achow101 commented at 7:28 am on February 24, 2018: member

    Do the following commands exactly (as in copy and paste them into your terminal). Note that they are taken directly from the documentation.

    0sudo apt install build-essential libtool autotools-dev automake pkg-config bsdmainutils curl git g++-mingw-w64-x86-64
    1sudo update-alternatives --config x86_64-w64-mingw32-g++
    2git clone https://github.com/bitcoin/bitcoin.git
    3cd bitcoin
    4cd depends
    5make HOST=x86_64-w64-mingw32
    6cd ..
    7./autogen.sh # not required when building from tarball
    8CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/
    9make
    
  16. wwg2018new commented at 7:32 am on February 24, 2018: none

    @achow101 sudo apt install build-essential libtool autotools-dev automake pkg-config bsdmainutils curl git g++-mingw-w64-x86-64 sudo update-alternatives –config x86_64-w64-mingw32-g++ git clone https://github.com/bitcoin/bitcoin.git cd depends make HOST=x86_64-w64-mingw32 cd .. ./autogen.sh # not required when building from tarball CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure –prefix=/ make

    make install DESTDIR=/mnt/c/workspace/bitcoin then not exe file

  17. number9387 commented at 7:34 am on February 24, 2018: none

    @achow101 Will do. Though I saw through it, the documentation does technically miss the “cd bitcoin” before “cd depends”.

    It would seem the only thing I misunderstood was the phrase “common usage” and the need to use that line at that point in the sequence regardless of the ubuntu version.

  18. achow101 commented at 7:35 am on February 24, 2018: member
    @wwg2018new Your question does not make any sense whatsoever. @number9387 Hmm, indeed, that command is missing.
  19. wwg2018new commented at 7:43 am on February 24, 2018: none
    @achow101 I want to compile Bitcoin Core in windows. I failed with this command
  20. achow101 commented at 7:45 am on February 24, 2018: member
    Failed in what way? Did make fail? Did it produce non-windows binaries?
  21. number9387 commented at 7:46 am on February 24, 2018: none
    @wwg2018new The instructions provided are not for compiling within windows unless you are running Linux in a virtual machine. If you are trying to compile Bitcoin Core in just straight Windows, the instructions here are not for that.
  22. wwg2018new commented at 7:50 am on February 24, 2018: none
    @number9387 I am running Linux in a virtual machine; i use build_windows_note
  23. wwg2018new commented at 7:51 am on February 24, 2018: none
    @number9387 I want to compile bitcoin in Windows ,how?
  24. wwg2018new commented at 7:54 am on February 24, 2018: none
    @achow101 I want to compile bitcoin in Windows ,how?
  25. number9387 commented at 7:55 am on February 24, 2018: none
    @wwg2018new If you’re looking for help doing that you should probably start another thread for that.
  26. number9387 commented at 11:21 am on February 24, 2018: none
    @achow101 I followed your instructions, same exact result, as before, on the “make HOST=x86_64-w64-mingw32” step.
  27. Willtech commented at 8:50 pm on February 24, 2018: contributor

    I have just tried this on a new install of Ubuntu 16.04 LTS.

    I am not convinced that sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu zesty universe" does what is expected on its own, there are errors on the following step when I run sudo apt update.

    Running sudo update-alternatives --config x86_64-w64-mingw32-g++ replies no alternatives.

    I have followed the instructions to the letter, even cloning into /usr/src/ and running chmod.

    make HOST=x86_64-w64-mingw32 fails.

    I will reboot the vm back to fresh later and gather all the output.

  28. number9387 commented at 0:19 am on February 25, 2018: none

    Just tried it again with a fresh VM install of Ubuntu 14.04.5. Same result. I didn’t update 14.04.5 at all to ensure it didn’t change the version number.

    Still complains about

    “No rule to make target zlib/adler32.o', needed by zlib/libz.a'”

  29. Willtech commented at 2:31 am on February 25, 2018: contributor
    @number9387 No, make fails. Yes, I did sudo apt update then sudo apt upgrade.
  30. number9387 commented at 2:42 am on February 25, 2018: none

    @number9387 No, make fails. Yes, I did sudo apt update then sudo apt upgrade. @Willtech I don’t understand. Or if it even matters and or to what degree. I’m not familiar with the significances of all the terms. If stating that “make is what is failing” is the better way of putting it, then okay. I’ll go for that. I just want to compile this thing.

  31. achow101 commented at 3:31 am on February 25, 2018: member
    @number9387 I think the problem is unrelated to build instructions or commands. This looks more like an issue with the build system itself and possibly some package version or dependency issues.
  32. Willtech commented at 4:12 am on February 25, 2018: contributor
    @achow101 note that sudo update-alternatives --config x86_64-w64-mingw32-g++ also fails with a no alternatives response.
  33. mrhuke commented at 4:15 am on February 25, 2018: none

    Failed at the same step funcs.mk:242: recipe for target ‘/home/a/a/bitcoin/depends/work/build/i686-w64-mingw32/boost/1_64_0-e638125fff0/./.stamp_built’ failed

    Running ubuntu app in windows 10 Tried upgrading to Zesty does not work Tried starting over several times and does not work

  34. achow101 commented at 4:15 am on February 25, 2018: member

    @Willtech The no alternatives response was because @number9387 did not install the mingw package. He said that even after he installed it that it still failed with the same error.

    I was able to reproduce this in two clean VMs, one Ubuntu 14.04 and the other 17.10. However I am not able to reproduce it on my own machine (Ubuntu 17.10).

  35. Willtech commented at 4:17 am on February 25, 2018: contributor
    @achow101 Not from the attempt by @number9387, from my attempt. I did install the mingw package if that is what is in the build-windows.md document.
  36. Willtech commented at 4:24 am on February 25, 2018: contributor
    @achow101 To save confusion I will open a new issue - I was attempting to replicate this issue and didn’t want to duplicate the thread.
  37. achow101 commented at 5:01 am on February 25, 2018: member

    Ok, I’ve identified the issue. It is because one of the dependencies recently had a version bump which now appears to be a problem. @number9387 @Willtech You should be able to fix the current issue of make: *** No rule to make target 'zlib/adler32.o', needed by 'zlib/libz.a'. Stop. by doing the following:

    sudo apt install zlib1g-dev
    git clean -fdx
    

    Then try the make command from inside the depends folder and it should get past where it was stopping before.

  38. number9387 commented at 5:46 am on February 25, 2018: none

    sudo apt install zlib1g-dev definitely installed something.

    subsequent command git clean -fdx responds with fatal: Not a git repository (or any of the parent directories): .git

    Attempt to make produced same result as before.

  39. achow101 commented at 6:11 am on February 25, 2018: member

    You need to do git clean -fdx from inside the bitcoin folder (although it should work from inside bitcoin/depends too).

    Alternatively, delete the folders named work, built, sources and x86_64-w64-mingw32 inside the depends folder.

  40. Willtech commented at 7:07 am on February 25, 2018: contributor

    @achow101 That explains why make is so far working when I this time checked out tag v0.16.0rc4 before building. Still issue with bug in the 64 bit Mingw-w64 cross-compiler that I don’t think is upgraded to zesty version. Will see.

    Also, I usually get no option to select POSIX version. See #12533

  41. number9387 commented at 7:15 am on February 25, 2018: none
    @willtech I’m currently, apparently, successfully compiling Bitcoin Core as a result of @achow101’s help. I too, have experienced a lack of an option to select POSIX, including this particular time, yet its still working.
  42. Willtech commented at 7:24 am on February 25, 2018: contributor
    If you are using Ubuntu 16.04 and you haven’t successfully got the zesty version of the 64 bit Mingw-w64 cross-compiler then your compiled executables may have issues as noted in the footnotes of build-windows.md
  43. number9387 commented at 7:30 am on February 25, 2018: none
    @Willtech Good point. This particular Ubuntu variation I’m using is 14.04.5. Guess I’ll see soon enough.
  44. number9387 commented at 8:33 am on February 25, 2018: none
    Well, I just copied the Bitcoin-qt.exe to windows, and it opened and took over the folder for my normal installation w/o a problem. No errors. It does claim This is a pre-release test build - use at your own risk - do not use for mining or merchant applications, which is disheartening, but either way, it does appear to function just fine! Thanks @achow101
  45. number9387 closed this on Feb 25, 2018

  46. seid123 commented at 0:46 am on November 15, 2019: none
         ^
    

    Makefile:11266: recipe for target ‘bitcoind-bitcoind.o’ failed make[2]: *** [bitcoind-bitcoind.o] Error 1 make[2]: Leaving directory ‘/home/unix/bitcoin/src’ Makefile:14411: recipe for target ‘all-recursive’ failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory ‘/home/unix/bitcoin/src’ Makefile:775: recipe for target ‘all-recursive’ failed make: *** [all-recursive] Error 1

    any one respond this command?

  47. sipsorcery commented at 8:28 am on November 15, 2019: member
    @seid123 this issue is closed. Could you describe your problem in a new issue. You’ll need to provide some minimal information about your OS and build environment. Also there will be some log messages that detail what the error actually was. The console log snippet you’ve pasted only states there’s an error not what it was.
  48. seid123 commented at 6:09 am on November 16, 2019: none
    @sipsorcery on win 10 bitcoin 0.19.0 version
  49. DrahtBot locked this on Dec 16, 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-11-17 15:12 UTC

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