Error with compiling v0.16.3 on WSL (Windows) #14280

issue molxyz opened this issue on September 20, 2018
  1. molxyz commented at 2:39 PM on September 20, 2018: none

    Trying to compile bitcoin v0.16.3 on WSL (Ubuntu Bionic installed on Windows 10). Here are the steps I've done before hitting a compiling error:

    sudo apt update sudo apt upgrade sudo apt install build-essential libtool autotools-dev automake pkg-config bsdmainutils curl git sudo apt install g++-mingw-w64-x86-64 sudo update-alternatives --config x86_64-w64-mingw32-g++

    At this point the guide says, "Note that for WSL the Bitcoin Core source path MUST be somewhere in the default mount file system, for example /usr/src/bitcoin, AND not under /mnt/d/. If this is not the case the dependency autoconf scripts will fail. This means you cannot use a directory that located directly on the host Windows file system to perform the build."

    So instead of installing bitcoin in /home/username/bitcoin like I normally would, this time I put bitcoin in /usr/src/bitcoin which I'm guessing should not make any difference. So here are my next steps:

    cd /usr/src sudo git clone https://github.com/bitcoin/bitcoin.git PATH=$(echo "$PATH" | sed -e 's/:/mnt.*//g') cd depends sudo make HOST=x86_64-w64-mingw32

    NOW... the compiling stops here with this error message:

    
        cp "bin.v2/libs/thread/build/gcc-mingw-7.3/release/binary-format-pe/link-static/runtime-link-static/target-os-windows/threadapi-win32/threading-multi/libboost_thread_win32-mt-s.a"  "stage/lib/libboost_thread_win32-mt-s.a"
    
    ...updated 126 targets...
    Staging boost...
    Performing configuration checks
    
        - 32-bit                   : no  (cached)
        - 64-bit                   : yes (cached)
        - arm                      : no  (cached)
        - mips1                    : no  (cached)
        - power                    : no  (cached)
        - sparc                    : no  (cached)
        - x86                      : yes (cached)
        - symlinks supported       : yes (cached)
    
    Component configuration:
    
        - atomic                   : not building
        - chrono                   : building
        - container                : not building
        - context                  : not building
        - coroutine                : not building
        - coroutine2               : not building
        - date_time                : not building
        - exception                : not building
        - fiber                    : not building
        - filesystem               : building
        - graph                    : not building
        - graph_parallel           : not building
        - iostreams                : not building
        - locale                   : not building
        - log                      : not building
        - math                     : not building
        - metaparse                : not building
        - mpi                      : not building
        - program_options          : not building
        - python                   : not building
        - random                   : not building
        - regex                    : not building
        - serialization            : not building
        - signals                  : not building
        - system                   : building
        - test                     : building
        - thread                   : building
        - timer                    : not building
        - type_erasure             : not building
        - wave                     : not building
    
    /bin/sh: 2: cp: Invalid argument
    ...failed updating 1 target...
    funcs.mk:242: recipe for target '/usr/src/bitcoin/depends/work/staging/x86_64-w64-mingw32/boost/1_64_0-005ef50df7b/.stamp_staged' failed
    make: *** [/usr/src/bitcoin/depends/work/staging/x86_64-w64-mingw32/boost/1_64_0-005ef50df7b/.stamp_staged] Error 1```
    
    EDIT:  I forgot to mention this WSL Ubuntu is a new fresh install.  I kept having errors trying to compile 0.16.3 so I uninstalled and reinstalled this WSL Ubuntu from MS store. 
    Distributor ID: Ubuntu
    Description:    Ubuntu 18.04.1 LTS
    Release:        18.04
    Codename:       bionic
    
  2. ken2812221 commented at 3:16 PM on September 20, 2018: contributor

    Actually this document is really old. It was written when WSL only has root user. For now, /home/username/bitcoin should be better than /usr/src/bitcoin. Could you try to re-compile it at your home directory again and see if it would work?

  3. molxyz commented at 3:57 PM on September 20, 2018: none

    @ken2812221 Hi, thanks for the quick response. Sure, I'm going to try that now. Will let you know.

  4. MarcoFalke commented at 5:00 PM on September 20, 2018: member

    I think you can use the instructions from the master or 0.17.0 branch, since they are updated to bionic. Not sure if the 0.16.* ones are updated.

  5. molxyz commented at 11:02 PM on September 20, 2018: none

    @ken2812221 I got it to pass depends successfully, but when I got to config, it hit another error. This is how I ran the config: CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --enable-debug --prefix=/

    Here are the last lines before the error:

    checking for main in -limm32... yes
    checking for main in -lz ... yes
    checking for library containing png_error ... no
    configure: WARNING: libpng not found. Assuming qt has it built-in
    checking for library containing jpeg_create_decompress ... no
    configure: WARNING: libjpeg not found. Assuming qt has it built-in
    checking for library containing pcre16_exec... no
    configure: WARNING: libpcre16 not found. Assuming qt has it built-in
    checking for library containing hb_ot_tags_from_script ... no
    configure: WARNING: libharfbuzz not found. Assuming qt has it built-in or support is disabled
    checking for main in -lQt5Core   ... yes
    checking for main in -lQt5Gui    ... yes
    checking for main in -lQt5Network... yes
    checking for main in -lQt5Widgets... yes
    checking for main in -lQt5Test... yes
    checking QTest usability... yes
    checking QTest presence... yes
    checking for QTest... yes
    checking for main in -lQt5DBus... yes
    checking QtDBus usability... yes
    checking QtDBus presence... yes
    checking for QtDBus... yes
    checking for static Qt... yes
    checking for Qt >= 5.6... yes
    checking for main in -lQt5PlatformSupport... no
    configure: WARNING: libQt5PlatformSupport not found; bitcoin-qt frontend will not be built
    checking for Qt < 5.4... no
    checking for static Qt plugins: -lqminimal... no
    checking for static Qt plugins: -lqwindows... no
    checking whether to build Bitcoin Core GUI... no (Qt5)
    checking for boostlib >= 1.47.0... yes
    checking whether the Boost::System library is available... yes
    checking for exit in -lboost_system-mt-s... yes
    checking whether the Boost::Filesystem library is available... yes
    checking for exit in -lboost_filesystem-mt-s... yes
    checking whether the Boost::Program_Options library is available... yes
    configure: error: Could not link against boost_filesystem-mt-s !
    
  6. fanquake added the label Windows on Sep 21, 2018
  7. fanquake added the label Build system on Sep 21, 2018
  8. sipsorcery commented at 12:42 PM on September 21, 2018: member

    @molxyz did you use any other options when on your depends make, maybe NO_QT or NO_WALLET? It looks like you're missing the Qt dependency.

    Here's the same snippet from my ~/src/bitcoin$ CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/ --enable-debug which executed successfully on WSL Ubuntu 18.04.

    checking for main in -limm32... yes
    checking for main in -lz ... yes
    checking for library containing jpeg_create_decompress ... no
    configure: WARNING: libjpeg not found. Assuming qt has it built-in
    checking for library containing png_error ... -lqtlibpng
    checking for library containing pcre2_match_16... -lqtpcre2
    checking for library containing hb_ot_tags_from_script ... -lqtharfbuzz
    checking for main in -lQt5Core   ... yes
    checking for main in -lQt5Gui    ... yes
    checking for main in -lQt5Network... yes
    checking for main in -lQt5Widgets... yes
    checking for main in -lQt5Test... yes
    checking QTest usability... yes
    checking QTest presence... yes
    checking for QTest... yes
    checking for main in -lQt5DBus... yes
    checking QtDBus usability... yes
    checking QtDBus presence... yes
    checking for QtDBus... yes
    checking for static Qt... yes
    checking for Qt >= 5.6... yes
    checking for main in -lQt5FontDatabaseSupport... yes
    checking for main in -lQt5EventDispatcherSupport... yes
    checking for main in -lQt5ThemeSupport... yes
    checking for main in -lQt5FbSupport... yes
    checking for main in -lQt5DeviceDiscoverySupport... yes
    checking for main in -lQt5AccessibilitySupport... yes
    checking for Qt < 5.4... no
    checking for static Qt plugins: -lqminimal... yes
    checking for static Qt plugins: -lqwindows... yes
    checking whether -fPIE can be used with this Qt config... yes
    checking for moc-qt5... no
    checking for moc5... no
    checking for moc... /home/aaron/src/bitcoin/depends/x86_64-w64-mingw32/share/../native/bin/moc
    checking for uic-qt5... no
    checking for uic5... no
    checking for uic... /home/aaron/src/bitcoin/depends/x86_64-w64-mingw32/share/../native/bin/uic
    checking for rcc-qt5... no
    checking for rcc5... no
    checking for rcc... /home/aaron/src/bitcoin/depends/x86_64-w64-mingw32/share/../native/bin/rcc
    checking for lrelease-qt5... no
    checking for lrelease5... no
    checking for lrelease... /home/aaron/src/bitcoin/depends/x86_64-w64-mingw32/share/../native/bin/lrelease
    checking for lupdate-qt5... no
    checking for lupdate5... no
    checking for lupdate... /home/aaron/src/bitcoin/depends/x86_64-w64-mingw32/share/../native/bin/lupdate
    checking whether the linker accepts -mwindows... yes
    checking whether to build Bitcoin Core GUI... yes (Qt5)
    checking for boostlib >= 1.47.0... yes
    checking whether the Boost::System library is available... yes
    checking for exit in -lboost_system-mt-s... yes
    checking whether the Boost::Filesystem library is available... yes
    checking for exit in -lboost_filesystem-mt-s... yes
    checking whether the Boost::Thread library is available... yes
    checking for exit in -lboost_thread_win32-mt-s... yes
    checking whether the Boost::Chrono library is available... yes
    checking for exit in -lboost_chrono-mt-s... yes
    checking whether the Boost::Unit_Test_Framework library is available... yes
    checking for dynamic linked boost test... no
    checking for mismatched boost c++11 scoped enums... ok
    checking openssl/crypto.h usability... yes
    checking openssl/crypto.h presence... yes
    
  9. molxyz commented at 3:55 PM on September 21, 2018: none

    @sipsorcery Hi,

    did you use any other options when on your depends make, maybe NO_QT or NO_WALLET? It looks like you're missing the Qt dependency.

    No, I did not. I did it like the guide says: ~/bitcoin/depends$ make HOST=x86_64-w64-mingw32

    And here's my config line: CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --enable-debug --prefix=/
    Just a bit different than yours where I put --enable-debug but that shouldn't be a problem, correct?

    Also, I was able to compile all RC.s of v0.17.0 successfully. I'm just puzzled why there's this error with v0.16.3.

    Thank you for your inputs. Please let me know what I should do. Thank you.

  10. sipsorcery commented at 8:17 PM on September 21, 2018: member

    @molxyz the placement of the --enable-debug parameter won't matter.

    Are you getting the source directly from the github repo and then using something like git checkout -b v0.16.3 v0.16.3?

  11. molxyz commented at 9:45 PM on September 21, 2018: none

    @sipsorcery Not exactly. I did git checkout v0.16.3 , it shouldn't be any different, right?

  12. molxyz commented at 5:54 AM on September 22, 2018: none

    @sipsorcery I got bitcoin recompiled successfully using git checkout -b v0.16.3 but guess what... It actually compiled the master version, you might want to check yours. Here's what I got:

    $ git show commit 920c090f63f4990bf0f3b3d1a6d3d8a8bcd14ba0 (HEAD -> v0.16.3, origin/master, origin/HEAD, master)

    The actuall commit for v0.16.3 is 49e34e288005a5b144a642e197b628396f5a0765, thanks to achow101 who told me about this. At this point I think I'll just grab the binaries from bitcoincore.org.

    Thanks, everyone.

  13. sipsorcery commented at 3:03 PM on September 22, 2018: member

    @molxyz your git command created a new branch based on master rather than creating a new branch based off the v0.16.3 tag.

    You can check by using git log and the top commit should be:

    commit 49e34e288005a5b144a642e197b628396f5a0765 (HEAD -> v0.16.3, tag: v0.16.3)
    Author: Wladimir J. van der Laan <laanwj@gmail.com>
    Date:   Tue Sep 18 01:55:09 2018 +0200
    
        doc: Update manpages for 0.16.3
    
        Tree-SHA512: e631405dd03438ac4b5fae5ed2fc0cb061e4cb7092ab068dd99b7c3001c95d166224f50af759454dbf47a2954409ac62c1232988918dd6650213918b853aea2d
    
  14. molxyz commented at 5:34 PM on September 23, 2018: none

    @sipsorcery Ah.. I thought you had a typo when you said this:

    Are you getting the source directly from the github repo and then using something like git checkout -b v0.16.3 v0.16.3?

    So I only ran the compiler with git checkout -b v0.16.3 and got the master commit as the result. Another lesson learned about git... :D

    I deleted this bitcoin dir altogether and downloaded it again, then ran it with git checkout -b v0.16.3 v0.16.3 as you suggested. I can see this time I got the branch 0.16.3 and not the master. HOWEVER, another error popped up, here's the last few lines of that error:

      CXX      libbitcoin_util_a-utilstrencodings.o
      CXX      libbitcoin_util_a-utiltime.o
      AR       libbitcoin_util.a
      CXX      wallet/libbitcoin_wallet_a-crypter.o
      CXX      wallet/libbitcoin_wallet_a-db.o
      CXX      wallet/libbitcoin_wallet_a-feebumper.o
      CXX      wallet/libbitcoin_wallet_a-fees.o
      CXX      wallet/libbitcoin_wallet_a-init.o
      CXX      wallet/libbitcoin_wallet_a-rpcdump.o
      CXX      wallet/libbitcoin_wallet_a-rpcwallet.o
      CXX      wallet/libbitcoin_wallet_a-wallet.o
    /usr/bin/x86_64-w64-mingw32-as: wallet/libbitcoin_wallet_a-wallet.o: too many sections (35062)
    {standard input}: Assembler messages:
    {standard input}: Fatal error: can't write 86 bytes to section .text of wallet/libbitcoin_wallet_a-wallet.o: 'File too big'
    /usr/bin/x86_64-w64-mingw32-as: wallet/libbitcoin_wallet_a-wallet.o: too many sections (35062)
    {standard input}: Fatal error: can't close wallet/libbitcoin_wallet_a-wallet.o: File too big
    Makefile:6366: recipe for target 'wallet/libbitcoin_wallet_a-wallet.o' failed
    make[2]: *** [wallet/libbitcoin_wallet_a-wallet.o] Error 1```
    
  15. sipsorcery commented at 6:26 PM on September 23, 2018: member

    @molxyz that looks like a toolchain or operating system problem.

    Does your output match the below?

    $ x86_64-w64-mingw32-as --version
    GNU assembler (GNU Binutils) 2.30
    Copyright (C) 2018 Free Software Foundation, Inc.
    This program is free software; you may redistribute it under the terms of
    the GNU General Public License version 3 or later.
    This program has absolutely no warranty.
    This assembler was configured for a target of `x86_64-w64-mingw32'.
    

    Other than that you could try updating the build chain again with:

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

    Failing that the last resort would be to uninstall and reinstall the Ubuntu 18.04 app from the Windows Store.

  16. molxyz commented at 6:59 PM on September 23, 2018: none

    @sipsorcery It's strange that x86_64-w64-mingw32-as is not in my directory for x86_64-w64-mingw32 or anywhere. find bitcoin/ -name '*x86_64-w64-mingw32-as*' results nothing. I'm going to do what you're suggesting. Thank you.

  17. molxyz commented at 1:17 AM on September 25, 2018: none

    @sipsorcery I'm very happy to let you know that I got v0.16.3 compiled successfully! Thanks for all your help.

    A few things still confuse me and I've spent almost a whole day thinking why I did this same thing before but it didn't work but it works now. All I did like you told me, reinstalled all the tool chains, but when I did that it said "already installed". Then I did ~/bitcoin$ git clean -dfx, after that continued the compiling and it went successfully. But I did try this before couple days ago and it didn't work.

    Also, on my computer I have these installed:
    C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin C:\MinGW\x86_64-w64-mingw32\bin Do you think these might have interfered with the Mingw compiler on WSL? I don't think they did but I'm not so sure.
    On my WSL Ubuntu the assembler is in directory /usr/bin/x86_64-w64-mingw32-as and its location on windows is in this root directory for linux:: C:\Users\username\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\usr\bin which is totally separate, but I'm just wondering if somehow WSL got confused by trying to use the compiler in windows directory and that was why it didn't work for several days?

    Another confusion was in between this mess I could get v0.17.0rc4 compiled, which added more to the mystery. I thought I should let you know just in case you need more information to figure there might be some issue with WSL.

    Thank you very much for your help.

  18. molxyz commented at 11:12 PM on October 2, 2018: none

    OK... Tried to compile v0.14.3 and v0.15.2 the same way I compiled v0.16.3 but got the same error again with something about can't write 86 bytes to section .text of wallet/libbitcoin_wallet_a-wallet.o: 'File too big'... So I searched for more answers by googling... Doesn't seem very much help from Microsoft.. I then uninstalled the app. Rebooted. Tried to purge ubuntu completely from C:\Windows\System32> Ubuntu clean (It said, "Ubuntu does not exist in the system" or something like that)... Rebooted again. Tried to purge Ubuntu again. Rebooted again. (And it seems rebooting a lot helped to purge away the old troublesome bash elements or something I have no clue!!!)

    Then I installed the Ubuntu app, and since then everything seems to be working great! However, I am considering to have the real Unbuntu 18 installed on its own hardware. WSL is a fun idea to have on Windows but that's it, just a fun idea.

    Thanks, devs, I'm closing this issue.

  19. molxyz closed this on Oct 2, 2018

  20. rebroad commented at 8:54 AM on March 1, 2020: contributor

    I suspect it was the --enable-debug that caused the error. You probably removed this option when someone said it didn't matter, and that's why it worked afterwards.

  21. michelvankessel commented at 8:23 PM on November 7, 2020: none

    @rebroad I agree, because I always compiled it successfully. Now I try to use --enable-debug and I get the File Too Big error.

    /usr/bin/x86_64-w64-mingw32-as: libbitcoin_server_a-main.o: too many sections (47933) {standard input}: Assembler messages: {standard input}: Fatal error: can't write 104 bytes to section .text of libbitcoin_server_a-main.o: 'File too big' /usr/bin/x86_64-w64-mingw32-as: libbitcoin_server_a-main.o: too many sections (47933) {standard input}: Fatal error: can't close libbitcoin_server_a-main.o: File too big Makefile:5546: recipe for target 'libbitcoin_server_a-main.o' failed make[2]: *** [libbitcoin_server_a-main.o] Error 1 make[2]: *** Waiting for unfinished jobs.... /usr/bin/x86_64-w64-mingw32-as: wallet/libbitcoin_wallet_a-wallet.o: too many sections (35441) {standard input}: Assembler messages: {standard input}: Fatal error: can't write 104 bytes to section .text of wallet/libbitcoin_wallet_a-wallet.o: 'File too big' /usr/bin/x86_64-w64-mingw32-as: wallet/libbitcoin_wallet_a-wallet.o: too many sections (35441)

    Is it possible to compile it with the --enable-debug flag on WSL?

  22. MarcoFalke locked this on Feb 15, 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: 2026-04-17 03:14 UTC

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