Post
Topic
Board Beginners & Help
Re: Building Armory on Raspberry Pi
by
bektar
on 28/03/2013, 07:46:15 UTC
# Build Bitcoin Armory for Raspberry Pi (using cross compiler)
This is a step by step guide on how to build Bitcoin Armory for the Raspberry Pi. This guide assumes that a working crosscompiler has been set up in a fashion similar to the previous post

## Install packages
Quote
   
   sudo apt-get install git-core build-essential pyqt4-dev-tools swig libqtcore4 libqt4-dev python-qt4 python-dev python-twisted
## Download Armory sourcecode
Quote
   
   cd ~/src/Crosstool/RaspberryPi/staging
   git clone git://github.com/etotheipi/BitcoinArmory.git
   cd BitcoinArmory
   
## Copy libraries from Pi
Quote
   scp -r pi@[IP_OF_PI_GOES_HERE]:/usr/include/python2.7 ~/src/Crosstool/RaspberryPi/include
   scp -r pi@[IP_OF_PI_GOES_HERE]:/usr/lib/libpython2.7.so ~/src/Crosstool/RaspberryPi/lib
## Modify code for ARM
Create a patchfile by executing
Quote
   cat > BitcoinArmory.patch
and then copy and paste
Quote
   diff -rupN BitcoinArmory/cppForSwig/cryptopp/Makefile BitcoinArmoryModified/cppForSwig/cryptopp/Makefile
   --- BitcoinArmory/cppForSwig/cryptopp/Makefile   2013-03-26 16:14:29.670518482 +0100
   +++ BitcoinArmoryModified/cppForSwig/cryptopp/Makefile   2013-03-26 21:34:58.438595983 +0100
   @@ -38,7 +38,7 @@ ifeq ($(UNAME),Darwin)
    CXXFLAGS += -arch x86_64 -arch i386
    else
    #CXXFLAGS += -march=native
   -CXXFLAGS += -mtune=generic
   +#CXXFLAGS += -mtune=generic
    endif
    endif
   
   diff -rupN BitcoinArmory/cppForSwig/Makefile BitcoinArmoryModified/cppForSwig/Makefile
   --- BitcoinArmory/cppForSwig/Makefile   2013-03-26 16:14:29.666518482 +0100
   +++ BitcoinArmoryModified/cppForSwig/Makefile   2013-03-26 21:36:47.046595921 +0100
   @@ -1,18 +1,16 @@
   -COMPILER = g++
   +COMPILER = $(CXX)
    #COMPILER_OPTS = -c -g -Wall -fPIC -D_DEBUG
    COMPILER_OPTS = -c -O2 -pipe -fPIC
   
    #**************************************************************************
   -LINKER = g++
   +LINKER = $(CXX)
    OBJS = UniversalTimer.o BinaryData.o FileDataPtr.o BtcUtils.o BlockObj.o BlockUtils.o EncryptionUtils.o libcryptopp.a
   
   
   -DEPSDIR ?= /usr
   -
    INCLUDE_OPTS += -Icryptopp -DUSE_CRYPTOPP -D__STDC_LIMIT_MACROS
    LIBRARY_OPTS += -lpthread
    SWIG_OPTS    += -c++ -python -classic -threads
   -PYVER        += `python -c 'import sys; print str(sys.version_info[0]) + "." + str(sys.version_info[1])'`
   +PYVER        += 2.7
   
   
    UNAME := $(shell uname)
   @@ -37,7 +35,7 @@ all :
       make BlockUtilsTest.out
       
    swig : $(OBJS) CppBlockUtils_wrap.o
   -   g++ -shared $(LIBRARY_OPTS) $(OBJS) $(STATICPYTHON) CppBlockUtils_wrap.o -o ../_CppBlockUtils.so
   +   $(CXX) -shared $(LIBRARY_OPTS) $(OBJS) $(STATICPYTHON) CppBlockUtils_wrap.o -o ../_CppBlockUtils.so
       pyrcc4 -o ../qrc_img_resources.py ../imgList.xml
   
    BlockUtilsTest.out : $(OBJS) BlockUtilsTest.cpp
and close the file by hitting control+d.

Apply the patch:
Quote
   patch -p1 < BitcoinArmory.patch
## Build & package it
Quote
   DEPSDIR=/home/[USERNAME]/src/Crosstool/RaspberryPi CXX=arm-unknown-linux-gnueabi-g++ make

   mkdir -p /tmp/BitcoinArmoryRPi/img/
   cp *.py *.so README LICENSE /tmp/BitcoinArmoryRPi/
   cp img/* /tmp/BitcoinArmoryRPi/img/
   cd /tmp
   tar cvfz BitcoinArmoryRPi.tar.gz BitcoinArmoryRPi

   scp /tmp/BitcoinArmoryRPi.tar.gz pi@[IP_OF_PI_GOES_HERE]:/home/pi/Desktop/
## Configure Pi
Install required packages
Quote
   sudo apt-get update
   sudo apt-get install python-qt4 python-twisted
Finally, to start armory execute:
Quote
   python ArmoryQt.py

## Resources / References
* [Building Armory from source](https://bitcoinarmory.com/building-armory-from-source/)
* [Building the Armory Bitcoin client for the Raspberry Pi](https://gist.github.com/FiloSottile/3646033#file-cxx-patch)
* [Bitcointalk: Building Armory on Raspberry Pi](https://bitcointalk.org/index.php?topic=156003)
* [The Ten Minute Guide to diff and patch](http://jungels.net/articles/diff-patch-ten-minutes.html)