neobytes/doc/build-cross.md
Wladimir J. van der Laan 08513bfffd Merge #11437: [Docs] Update Windows build instructions for using WSL and Ubuntu 17.04
696ce46 [Docs] Update Windows build instructions for using WSL and Ubuntu 17.04 (fanquake)
4f890ba Add new step to clean $PATH var by removing /mnt specific Window's %PATH% paths that cause issues with the make system (Donal OConnor)

Pull request description:

  This updates the Windows build documentation with the workaround required to build using Ubuntu 17.04 on WSL, and makes it's explicit that building on Ubuntu 16.04 is broken, and not recommended.

  This includes a commit from @donaloconnor in #11244, and is mostly the investigative work of @laanwj throughout #8732, #8653 and quite a few other issues.

  I tested building on 14.04, 16.04.3 and 17.04 [here](https://github.com/bitcoin/bitcoin/pull/11244#issuecomment-327990251) and got the results we expect.

  ---

  Built master at c22a53cd63 on a Windows 10 VM (Version 1607, OS Build 14393.1593) using WSL with Ubuntu 14.04.
  ![windows](https://user-images.githubusercontent.com/863730/30195033-867f1f24-9489-11e7-932c-e87b8764a627.png)

  Upgraded WSL to 16.04.3, and tried building c22a53cd63 using these instructions. The result is as expected.
  ![ubuntu 16 04 3](https://user-images.githubusercontent.com/863730/30235670-b9bf36bc-953d-11e7-8c1d-4debf7113032.png)

  Upgraded WSL to 17.04 and tried building 3255d6347b using these instructions.
  ![ubuntu 17 04](https://user-images.githubusercontent.com/863730/30235669-b7473434-953d-11e7-8ea3-d05a319ae2d4.png)

  If someone else could also verify that builds are working on both 14.04 and 17.04 with these instructions, that would be great.

Tree-SHA512: 866f1003eb45d208d8ae849504f54fc2f27c32240129d2124ce5a2ee7167bcbf062d29f23b1745123f532ffd0253a8611e719b2a316d1331d3c3924f91e7775d
2019-09-25 10:33:21 +02:00

3.2 KiB

Cross-compiliation of Dash Core

Dash Core can be cross-compiled on Linux to all other supported host systems. This is done by changing the HOST parameter when building the dependencies and then specifying another --prefix directory when building Dash.

The following instructions are only tested on Debian Stretch and Ubuntu Bionic.

MacOSX Cross-compilation

Cross-compiling to MacOSX requires a few additional packages to be installed:

$ sudo apt-get install python3-setuptools libcap-dev zlib1g-dev libbz2-dev

Additionally, the Mac OSX SDK must be downloaded and extracted manually:

$ mkdir -p depends/sdk-sources
$ mkdir -p depends/SDKs
$ curl https://bitcoincore.org/depends-sources/sdks/MacOSX10.11.sdk.tar.gz -o depends/sdk-sources/MacOSX10.11.sdk.tar.gz
$ tar -C depends/SDKs -xf depends/sdk-sources/MacOSX10.11.sdk.tar.gz

When building the dependencies, as described in build-generic, use

$ make HOST=x86_64-apple-darwin11 -j4

When building Dash Core, use

$ ./configure --prefix=`pwd`/depends/x86_64-apple-darwin11

Windows 64bit/32bit Cross-compilation

Cross-compiling to Windows requires a few additional packages to be installed:

$ sudo apt-get install nsis wine-stable wine64 bc

For Windows 64bit, install :

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

If you're building on Ubuntu 17.04 or later, run these two commands, selecting the 'posix' variant for both, to work around issues with mingw-w64. See issue 8732 for more information. This also fixes linker issues related to std::thread and other threading related standard C++ libraries.

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

For Windows 32bit, install:

$ sudo apt-get install g++-mingw-w64-i686

If you're building on Ubuntu 17.04 or later, run these two commands, selecting the 'posix' variant for both, to fix linker issues related to std::thread and other threading related standard C++ libraries.

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

Before building for Windows 32bit or 64bit, run

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

When building the dependencies, as described in build-generic, use

$ make HOST=x86_64-w64-mingw32 -j4

When building Dash Core, use

$ ./configure --prefix=`pwd`/depends/x86_64-w64-mingw32

These commands will build for Windows 64bit. If you want to compile for 32bit, replace x86_64-w64-mingw32 with i686-w64-mingw32.

ARM-Linux Cross-compilation

Cross-compiling to ARM-Linux requires a few additional packages to be installed:

$ sudo apt-get install g++-arm-linux-gnueabihf

When building the dependencies, as described in build-generic, use

$ make HOST=arm-linux-gnueabihf -j4

When building Dash Core, use

$ ./configure --prefix=`pwd`/depends/arm-linux-gnueabihf