Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Windows Subsystem For Linux" for master not work #11549

Closed
AngelTs opened this issue Oct 23, 2017 · 16 comments
Closed

"Windows Subsystem For Linux" for master not work #11549

AngelTs opened this issue Oct 23, 2017 · 16 comments
Labels

Comments

@AngelTs
Copy link

AngelTs commented Oct 23, 2017

angel@DESKTOP-37ER0D7:/mnt/c/$ABC$/bitcoin/depends$ make HOST=x86_64-w64-mingw32
sha256sum: '/mnt/c/$/bitcoin/depends/patches/zeromq/9114d3957725acd34aa8b8d011585812f3369411.patch': No such file or directory
sha256sum: '/mnt/c/$/bitcoin/depends/patches/zeromq/9e6745c12e0b100cd38acecc16ce7db02905e27c.patch': No such file or directory
sha256sum: '/mnt/c/$/bitcoin/depends/patches/qt/mac-qmake.conf': No such file or directory
sha256sum: '/mnt/c/$/bitcoin/depends/patches/qt/mingw-uuidof.patch': No such file or directory
sha256sum: '/mnt/c/$/bitcoin/depends/patches/qt/pidlist_absolute.patch': No such file or directory
sha256sum: '/mnt/c/$/bitcoin/depends/patches/qt/fix-xcb-include-order.patch': No such file or directory
sha256sum: '/mnt/c/$/bitcoin/depends/patches/qt/fix_qt_pkgconfig.patch': No such file or directory
Configuring native_ccache...
/bin/sh: 1: Syntax error: "(" unexpected
funcs.mk:242: recipe for target '/mnt/c/BCbitcoin/depends/work/build/x86_64-w64-mingw32/native_ccache/3.3.4-e6d1b7b6109/./.stamp_configured' failed
make: *** [/mnt/c/BCbitcoin/depends/work/build/x86_64-w64-mingw32/native_ccache/3.3.4-e6d1b7b6109/./.stamp_configured] Error 2

@NicolasDorier
Copy link
Contributor

Take a look at #11438

You also probably need to run PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g')

@AngelTs
Copy link
Author

AngelTs commented Oct 23, 2017

I made each step in https://github.com/bitcoin/bitcoin/blob/master/doc/build-windows.md including "PATH=$(echo "$PATH" | sed -e 's/:/mnt.*//g')" without success.

@donaloconnor
Copy link
Contributor

donaloconnor commented Oct 23, 2017

I reckon it's related to the $ABC$ path. Can you drop the $'s in your folder name.

I tested even doing a CD to a path like that and it failed without it being escaped:

donal@DESKTOP-XXX:/$ cd /mnt/c/$ABC$
bash: cd: /mnt/c/$: No such file or directory
donal@DESKTOP-XXX:/$ cd /mnt/c/\$ABC\$
donal@DESKTOP-XXX:/mnt/c/$ABC$$

@sipsorcery
Copy link
Member

Working steps for WSL are available here. Be sure to take note of the way the Ubunutu packages are being installed (Zesty packages onto Xenial). It gets the bitcoin build working but it may break other things.

@NicolasDorier
Copy link
Contributor

it seems @donaloconnor is correct, if so, it seems that PATH=$(echo "$PATH" | sed -e 's/:/mnt.*//g') did not stripped this path correctly? is the sed wrong?

@donaloconnor
Copy link
Contributor

That only strips the PATH environment variables. It could be and likely that it's to do with the current working dir that's used.

@NicolasDorier
Copy link
Contributor

ah indeed I missed the fact his bitcoin code was in this folder.

@AngelTs
Copy link
Author

AngelTs commented Oct 24, 2017

I resolve the problem as rename directory "bitcoin-master" to "bitcoin" from master zip and move it into the root of C.
Now I am trying to resolve the next errors during compilation. I will write the right and consecutive steps when I achieve success, but the steps in original tutorial are not correct, at least for my system.
And the hole process to compile something simple as bitcoin should be very simple, but it is dramatically hard. Just compare with UE4 with millions of code-lines and even then with so easy compilation procedure in VS and windows. Complexity of the code in UE4 is fare, fare bigger than bitcoin.

@NicolasDorier
Copy link
Contributor

NicolasDorier commented Oct 24, 2017

@AngelTs welcome to linux world, where you build plane out of wooden sticks, because you don't trust anything bigger. ;)

I plan in the future to make a simple docker file which setup a reproductible build environment which can work on windows every time. It is what I am using on my side, too much problem otherwise.

@sipsorcery
Copy link
Member

@AngelTs what's the compilation error?

Note that the current tutorial states building on Ubuntu 16.04 (which is what gets installed with WSL) is broken. Either see my instructions above to work around it or build on Ubuntu 14 or 17.

@AngelTs
Copy link
Author

AngelTs commented Oct 24, 2017

Here is THE STEPPER [for Ubuntu 16.04.3 LTS]:
1.
bash
2.
sudo apt-get install build-essential libtool autotools-dev automake pkg-config bsdmainutils curl
sudo apt-get install g++-mingw-w64-x86-64 mingw-w64-x86-64-dev
sudo apt-get update
sudo apt-get update --fix-missing
sudo apt-get install gcc
sudo apt-get install g++
sudo apt-get install libtool
sudo apt-get install pkg-config
sudo apt-get install libdb4.8++
sudo apt-get install libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev
sudo apt-get install libevent-dev
sudo apt-get install automake
sudo apt-get install libssl-dev
close bash
3.
Rename "bitcoin-master" directory to "bitcoin" and move it to root of C
4.
bash
cd bitcoin
5.
To prevent the error "configure: error: libdb_cxx headers missing, Bitcoin Core requires this library for wallet functionality (--disable-wallet to disable wallet functionality)"
Get db4.8 source, compile and install; #3686
wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz
tar -xzvf db-4.8.30.NC.tar.gz
cd db-4.8.30.NC/build_unix
../dist/configure --enable-cxx
make
sudo make install
6.
cd ../..
PATH=$(echo "$PATH" | sed -e 's/:/mnt.*//g')
cd depends
make HOST=x86_64-w64-mingw32
cd ..
./autogen.sh
./configure CPPFLAGS="-I/usr/local/BerkeleyDB.4.8/include -O2" LDFLAGS="-L/usr/local/BerkeleyDB.4.8/lib"
make
7.
[optional]
make install DESTDIR=/mnt/c/workspace/bitcoin
8.
[optional]
c:\workspace\bitcoin\usr\local\bin>bash -c "./bench_bitcoin"

---------------------------------------------------------------------------------------------------------
Conclusion question:
How this method (WSL) can produce standalone exe(s) for windows???
(You need to start bash and then the program in win: c:\workspace\bitcoin\usr\local\bin>bash -c "ls -ls")
Maybe it can't???
---------------------------------------------------------------------------------------------------------

@donaloconnor
Copy link
Contributor

donaloconnor commented Oct 24, 2017

This method does not cross compile for native Windows (so no exe).
There is an open PR with Visual Studio projects by @sipsorcery that's a WIP: #11526

Edit: sorry what I said here is 100% incorrect. Mind else where :)

@sipsorcery
Copy link
Member

sipsorcery commented Oct 24, 2017

@AngelTs I think you've awry somewhere. There's no need to separately install all the dependencies. The make script in the depends directory does that.

The detailed steps below repeatedly work for me on Ubuntu for Windows (aka WSL) including as recently as a few hours ago.

  • sudo apt install g++-mingw-w64-x86-64
  • sudo apt install software-properties-common
  • sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu zesty universe"
  • sudo apt update
  • sudo apt upgrade
  • sudo update-alternatives --config x86_64-w64-mingw32-g++ # Set the default mingw32 g++ compiler option to posix.
  • cd /usr/src
  • sudo git clone https://github.com/bitcoin/bitcoin.git
  • sudo chmod -R a+rw bitcoin
  • PATH=$(echo "$PATH" | sed -e 's/:/mnt.*//g') # strip out problematic Windows %PATH% imported var
  • cd bitcoin/depends
  • make HOST=x86_64-w64-mingw32
  • cd ..
  • ./autogen.sh
  • CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix=/
  • make
  • sudo make install
  • Copy binaries to Windows and check execution:
    • /bin/bitcoind.exe (e.g. test: mkdir bitcoind;./bitcoind.exe -printtoconsole -regtest -datadir=./bitcoind)
    • /bin/bitcoin-cli.exe
    • /bin/bitcoin-tx.exe
    • /bin/test_bitcoin.exe
    • /bin/bench_bitcoin.exe
    • /bin/bitcoin-qt.exe
    • /bin/test_bitcoin-qt.exe
    • /include/bitcoinconsensus.h
    • /lib/libbitcoinconsesnsus.a
    • /lib/libbitcoinconsesnsus.dll.a

@rebroad
Copy link
Contributor

rebroad commented Nov 8, 2017

This has been fixed by #11438 so I think it can be closed.

@fanquake
Copy link
Member

Closing now that #11438 has been merged. If you're still having issues, can you comment in #11685.

@ashishchandr70
Copy link

Here is THE STEPPER [for Ubuntu 16.04.3 LTS]:
./autogen.sh
./configure CPPFLAGS="-I/usr/local/BerkeleyDB.4.8/include -O2" LDFLAGS="-L/usr/local/BerkeleyDB.4.8/lib"
make

While running "./configure", for those, like me, who have Boost installed in a non standard location (i.e. not under /usr/local/) don't forget to use the --with-boost= and --with-boost-libdir=<BOOST ROOT DIR/stage/lib>. FYI, these two directories are output to the screen once Boost is built successfully.

@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants