Added a doc fragment in build.md about cross compilation and clarified

the error message.
This commit is contained in:
Chris Kleeschulte 2016-02-10 17:18:08 -05:00
parent afce33e5ff
commit 610b9ea269
2 changed files with 29 additions and 1 deletions

View File

@ -25,7 +25,7 @@ get_host_and_platform () {
arch="${SYS[0]}"
platform="${SYS[1]}"-"${SYS[2]}"
else
error_message="You've specified a cross compiler, but we could not compute the host-platform-triplet for cross compilation. Please set CC and CXX environment variables with host-platform-triplet-*. Example: CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++"
error_message="You've specified a cross compiler, but we could not compute the host-platform-triplet for cross compilation. Please set CC and CXX environment variables with host-platform-triplet-*. Also ensure the cross compiler exists on your system and is available on your path. Example: CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++"
return_error_message
fi
fi

View File

@ -80,6 +80,34 @@ And finally run the build which will take several minutes. A script in the "bin"
npm install
```
## Cross Compilation
If you desire to cross compile to ARM or Windows from a system that has cross compilation tools available for use, please use the following directions:
Using a Debian (Jessie) system as the host system (the system that will be doing the compiling):
```bash
echo -n "deb http://emdebian.org/tools/debian/ jessie main" | sudo tee -a /etc/apt/sources.list
sudo dpkg --add-architecture armhf #or whatever arch you are interested in compiling for
sudo apt-get update #you will get GPG KEY warnings, you can decide if you would like to trust the key
sudo apt-get install crossbuild-essential-armhf
```
Next is to use the cross compilation toolchain instead of the defaults:
```bash
CXX=arm-linux-gnueabihf-g++ CC=arm-linux-gnueabihf-gcc npm install
```
The only thing different is the setting of CC/CXX environment variables. Please make sure those compilers (arm-linux-gnueabihf-gcc) actually exist and are on your path.
```bash
arm-linux-gnueabihf-g++ -v
arm-linux-gnueabihf-gcc -v
```
You should get output with the last line ending with something like this:
gcc version 4.9.2 ( 4.9.2-10)
Once everything is built, you can run bitcore-node via:
```bash