From 610b9ea269b6875c7ca990a7b69e5e949606ddf7 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Wed, 10 Feb 2016 17:18:08 -0500 Subject: [PATCH] Added a doc fragment in build.md about cross compilation and clarified the error message. --- bin/variables.sh | 2 +- docs/build.md | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/bin/variables.sh b/bin/variables.sh index 21b962ed..0988e0fa 100755 --- a/bin/variables.sh +++ b/bin/variables.sh @@ -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 diff --git a/docs/build.md b/docs/build.md index 1846356f..d22b8411 100644 --- a/docs/build.md +++ b/docs/build.md @@ -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