Bitcoin Forum

Other => Beginners & Help => Topic started by: bektar on March 21, 2013, 03:57:43 PM



Title: Building Armory on Raspberry Pi
Post by: bektar on March 21, 2013, 03:57:43 PM
I'm trying to build Bitcoin Armory on a Raspberry Pi with Rapsbian (to use as an offline wallet) and I'm in need of assistance.

I've found a couple of guides on how to set up a cross compiler, building it, and then moving it over to the pi. I can't get any of them to work, so I decided to start by getting Armory to build on the Pi itself, and then moving on to getting it to work on the cross compiler.

Since Raspbian is based on debian, I was hoping I could just use the build instructions for Ubuntu found on the official Armory page http://bitcoinarmory.com/building-armory-from-source/ (http://bitcoinarmory.com/building-armory-from-source/).

Doing this ends up with the error:

Quote
make[2]: Entering directory `/home/pi/Desktop/Armory/BitcoinArmory/cppForSwig/cryptopp'
g++ -DNDEBUG -O -g0 -native -template=no%extdef  -c 3way.cpp
g++: error: unrecognized option ‘-native’
g++: error: unrecognized option ‘-template=no%extdef’
make[2]: *** [3way.o] Error 1
make[2]: Leaving directory `/home/pi/Desktop/Armory/BitcoinArmory/cppForSwig/cryptopp'
mv: cannot stat `libcryptopp.a': No such file or directory
make[1]: *** [libcryptopp.a] Error 1
make[1]: Leaving directory `/home/pi/Desktop/Armory/BitcoinArmory/cppForSwig'
make: *** [all] Error 2

To get past this i opened up cppForSwig/cryptopp/Makefile and edited line 106 from:
   CXXFLAGS = -DNDEBUG -O -g0 -native -template=no%extdef $(M32OR64)
to
   CXXFLAGS = -DNDEBUG -O -g0 $(M32OR64)

And ran make oncemore. This resulted in the error:
Quote
g++ -xar -o libcryptopp.a 3way.o adler32.o algebra.o algparam.o arc4.o asn.o authenc.o base32.o base64.o basecode.o bfinit.o blowfish.o blumshub.o camellia.o cast.o casts.o cbcmac.o ccm.o channels.o cmac.o cpu.o crc.o cryptlib_bds.o cryptlib.o default.o des.o dessp.o dh2.o dh.o dll.o dsa.o eax.o ec2n.o eccrypto.o ecp.o elgamal.o emsa2.o eprecomp.o esign.o files.o filters.o fips140.o fipstest.o gcm.o gf2_32.o gf256.o gf2n.o gfpcrypt.o gost.o gzip.o hex.o hmac.o hrtimer.o ida.o idea.o integer.o iterhash.o luc.o md2.o md4.o md5.o misc.o modes.o mqueue.o mqv.o nbtheory.o network.o oaep.o osrng.o pch.o pkcspad.o polynomi.o pssr.o pubkey.o queue.o rabin.o randpool.o rc2.o rc5.o rc6.o rdtables.o rijndael.o ripemd.o rng.o rsa.o rw.o safer.o salsa.o seal.o seed.o serpent.o shacal2.o sha.o sharkbox.o shark.o simple.o skipjack.o socketft.o sosemanuk.o square.o squaretb.o strciphr.o tea.o tftables.o tiger.o tigertab.o trdlocal.o ttmac.o twofish.o vmac.o wait.o wake.o whrlpool.o winpipes.o xtr.o xtrcrypt.o zdeflate.o zinflate.o zlib.o
g++: error: language ar not recognized

(repeated once for each file)

make[2]: *** [libcryptopp.a] Error 1
make[2]: Leaving directory `/home/pi/Desktop/Armory/BitcoinArmory/cppForSwig/cryptopp'
mv: cannot stat `libcryptopp.a': No such file or directory
make[1]: *** [libcryptopp.a] Error 1
make[1]: Leaving directory `/home/pi/Desktop/Armory/BitcoinArmory/cppForSwig'
make: *** [all] Error 2

I fiddled around a bit more in the makefile, but there are so many things that I'm not quite sure what they do that I figure its more efficient to ask for help.

What do I need to do to make this work?


Title: Re: Building Armory on Raspberry Pi
Post by: whitenight639 on March 21, 2013, 04:38:08 PM
https://bitcointalk.org/index.php?topic=73648.20



page 2 somebody has same issue on compiling armory for Mac,


gcc can be a pain, I have had similar issues compiling mining software on Ubuntu, I think you can install extra gcc libraries but you can seriously break your system, I think you need to follow the above thread to see if theres a resolution and read the gcc documentation, you might be able to set proper flags for ppc or whatever pi is based on.


Title: Re: Building Armory on Raspberry Pi
Post by: bektar on March 22, 2013, 05:52:41 AM
ok, thanks… seems a bit more difficult than I was hoping for. I'll look into it.

If i manage to get it working I'll include a step by step guide here for future reference.


Title: Re: Building Armory on Raspberry Pi
Post by: nomis on March 25, 2013, 06:53:44 PM
Hi,

I followed this instruction to get armory working on my raspberry pi:

https://gist.github.com/FiloSottile/3646033

As the CXX.patch file is quite old, I had to patch those two files (cppForSwig/Makefile, cppForSwig/cryptopp/Makefile) by hand. Just search for the red marked lines (https://gist.github.com/FiloSottile/3646033#file-cxx-patch) and replace them by the green ones. And because of the static linking of python you also need to adjust cppForSwig/Makefile to point to your libpython$(PYVER).so. You need to get this file from your raspberry pi, then save it on your compiling machine and change the Makefile accordingly.

Good luck!

Cheers!


Title: Re: Building Armory on Raspberry Pi
Post by: bektar on March 25, 2013, 06:56:00 PM
Excellent! Thanks for taking the time to post it here.

I'll give it a try first thing tomorrow!


Title: Re: Building Armory on Raspberry Pi
Post by: Tuckie on March 25, 2013, 10:16:05 PM
Were you able to get this working? It seems like this would be a great use for the RaspberryPi!


Title: Re: Building Armory on Raspberry Pi
Post by: bektar on March 26, 2013, 07:18:50 AM
Still not managing to get it to work…

First I manually applied the patch like you suggested. Then I copied
Quote
/usr/lib/libpython2.7.so
to my compiling computer. I then opened cppForSwig/Makefile and changed the line
Quote
STATICPYTHON += "$(DEPSDIR)/lib/libpython$(PYVER).so"
to
Quote
STATICPYTHON += "/home/testuser/libpython2.7.so"

This nets me the error message
Quote
make[2]: Leaving directory `/home/testuser/src/RaspberryPi/staging/BitcoinArmory/cppForSwig/cryptopp'
g++ -shared -lpthread  UniversalTimer.o BinaryData.o FileDataPtr.o BtcUtils.o BlockObj.o BlockUtils.o EncryptionUtils.o libcryptopp.a "/home/testuser/src/RaspberryPi/staging/BitcoinArmory/libpython2.7.so" CppBlockUtils_wrap.o -o ../_CppBlockUtils.so
/home/testuser/src/RaspberryPi/staging/BitcoinArmory/libpython2.7.so: could not read symbols: File in wrong format
collect2: error: ld returned 1 exit status
make[1]: *** [swig] Error 1
make[1]: Leaving directory `/home/testuser/src/RaspberryPi/staging/BitcoinArmory/cppForSwig'
make: *** [all] Error 2

when i run make…

Hopefully I'm doing something obviously stupid here so its easy to fix :)


Title: Re: Building Armory on Raspberry Pi
Post by: nomis on March 26, 2013, 08:23:50 AM
Hi,

Did you:

1. enabled c++ in menuconfig of the crosscompiler (C-compiler → Additional supported languages)?
2. added the x-tools/arm-unknown-linux-gnueabi/bin to your PATH (step 18)?
3. run make using "CXX=arm-unknown-linux-gnueabi-g++ make"?

Cheers!


Title: Re: Building Armory on Raspberry Pi
Post by: nomis on March 26, 2013, 08:32:40 AM
Additional:

Are you sure you edited all required lines in cppForSwig/Makefile?

Quote
make[2]: Leaving directory `/home/testuser/src/RaspberryPi/staging/BitcoinArmory/cppForSwig/cryptopp'
g++ -shared -lpthread  UniversalTimer.o BinaryData.o FileDataPtr.o BtcUtils.o BlockObj.o BlockUtils.o EncryptionUtils.o libcryptopp.a "/home/testuser/src/RaspberryPi/staging/BitcoinArmory/libpython2.7.so" CppBlockUtils_wrap.o -o ../_CppBlockUtils.so
/home/testuser/src/RaspberryPi/staging/BitcoinArmory/libpython2.7.so: could not read symbols: File in wrong format

It still seems to use g++ instead of arm-unknown-linux-gnueabi-g++.

Quote
remove >> g++ -shared $(LIBRARY_OPTS) $(OBJS) $(STATICPYTHON) CppBlockUtils_wrap.o -o ../_CppBlockUtils.so << remove
replace >> $(CXX) -shared $(LIBRARY_OPTS) $(OBJS) $(STATICPYTHON) CppBlockUtils_wrap.o -o ../_CppBlockUtils.so  << replace

Cheers!


Title: Re: Building Armory on Raspberry Pi
Post by: bektar on March 26, 2013, 11:10:45 AM
Duh, I just ran
Quote
make
instead of
Quote
CXX=/home/testuser/local/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-g++ make

When i actually remember to call the correct compiler i end up with this error instead:
Quote
make[2]: Leaving directory `/home/testuser/Desktop/BitcoinArmory/cppForSwig/cryptopp'
/home/testuser/local/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-g++  -I"/usr/include/python`python -c 'import sys; print str(sys.version_info[0]) + "." + str(sys.version_info[1])'`" -c -O2 -pipe -fPIC  -Icryptopp -DUSE_CRYPTOPP -D__STDC_LIMIT_MACROS  -lpthread  CppBlockUtils_wrap.cxx
In file included from /usr/include/python2.7/Python.h:58:0,
                 from CppBlockUtils_wrap.cxx:151:
/usr/include/python2.7/pyport.h:873:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
make[1]: *** [CppBlockUtils_wrap.o] Error 1
make[1]: Leaving directory `/home/testuser/Desktop/BitcoinArmory/cppForSwig'
make: *** [all] Error 2

I remember getting this error last week as well (didn't mention it in the post since i gave up on crosscompiling and was trying to compile it on the pi itself), and it is mentioned in the comments in the gists.


I assume this is why I'm copying the libpython2.7.so file from the pi? Any idea what I might be doing wrong this time?


Title: Re: Building Armory on Raspberry Pi
Post by: nomis on March 26, 2013, 11:21:51 AM
Quote
/home/testuser/local/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-g++  -I"/usr/include/python`python -c 'import sys; print str(sys.version_info[0]) + "." + str(sys.version_info[1])'`" -c -O2 -pipe -fPIC  -Icryptopp -DUSE_CRYPTOPP -D__STDC_LIMIT_MACROS  -lpthread  CppBlockUtils_wrap.cxx

Please check your cppForSwig/Makefile again, it still includes the wrong path to the python library!

EDIT: I checked my Makefile and its pointing to the same include dir. Don't know why it worked with my version. You could try to get the whole /usr/include/python* directory from your RPi and then adjust the path in the Makefile for SWIG_INC.

EDIT2: Did you 'make clean' after the faulty make without the CXX env set?


Title: Re: Building Armory on Raspberry Pi
Post by: bektar on March 26, 2013, 12:12:25 PM
It finally compiled!

What I hadn't done was copy all of /usr/include/python2.7 to my cross compiler. After doing this and editing one more line in the makefile it worked perfectly.

I'm going to write down the exact steps I took to get this to work, since I will probably end up doing this again in like a year or so. If there is any interest I'll post it here once I've made sure it is complete and no steps are missing.


I'm also gonna give it a few more tries to get it to compile directly on the Pi. I feel it would be nice to get this to work (even if its very slow) since then one wouldn't need an additional computer.


Big thanks to nomis for the help!





Title: Re: Building Armory on Raspberry Pi
Post by: bektar on March 26, 2013, 12:16:02 PM
Hehe, didn't notice your edit until after i was done. But that was the trick. Good catch!


Title: Re: Building Armory on Raspberry Pi
Post by: bektar on March 28, 2013, 07:42:49 AM

I noticed this thread being linked from the official Armory subforum which inspired me to include a step by step guide to get it working. This could probably be made into a shellscript, but my linuxfu is not strong enough and it will probably be broken very easily as time marches on and things gets updated.

These steps were tested on a clean install of Ubuntu 12.10 64-bit on 2013-03-26. The current version of Bitcoin Armory is 0.87-beta.

(This pretty much a copy paste from a markdown file I wrote for future me, however, there are a few manual edits to account for the forum syntax)
========================================

## Starting point
This step by step guide is done on a clean install of ubuntu 12.10 desktop amd64. During installation the option ”Download updates while installing” was left unchecked to make the results completly replicable.

After the installation process completed the only things I did before starting this guide is change the resolution of the screen and install OpenSSH-server since I’m used to the OS X terminal app.
Quote
   sudo apt-get install openssh-server
   
to figure out the ip of the computer i used
Quote
   ifconfig
(Yes, this is a VERY thorough walkthrough, the idea is that when I’m doing this again, maybe in a year or two, nothing should have to be googled while following this guide)

## Download crosstool-ng
Quote
   wget http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.17.0.tar.bz2
   tar xfv crosstool-ng-1.17.0.tar.bz2
   cd crosstool-ng-1.17.0.tar.bz2/

## Install required packages
My main gripe with the other guides was that apparantly they had some stuff already installed on their systems. I say this because when I followed their instructions I kept hitting roadblocks.

The complete list of packages i installed after the ubuntu installer was do is as follows:

* openssh-server    (i can’t imagine this affects anything, but I’m not going to leave anything out)
* automake   
* bison
* build-essential
* flex
* gawk
* gperf
* libncurses5-dev
* libtool
* subversion
* texinfo

## Create directories
Quote
   mkdir -p ~/src/Crosstool/RaspberryPi/include         
   mkdir -p ~/src/Crosstool/RaspberryPi/staging
   mkdir -p ~/bin/Crosstool/crosstool-ng
   mkdir -p ~/bin/Crosstool/Toolchains/
## Configure and Build crosstool-ng
Quote
   sudo apt-get install automake bison build-essential flex gawk gperf libncurses5-dev libtool subversion texinfo
   wget http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.17.0.tar.bz2
   tar xfv crosstool-ng-1.17.0.tar.bz2
   
   cd crosstool-ng-1.17.0/
   ./configure --prefix=/home/[USERNAME]/bin/Crosstool/crosstool-ng
   make
   make install
   cd ..
   rm -r crosstool-ng-1.17.0 crosstool-ng-1.17.0.tar.bz2
   
   export PATH=$PATH:/home/[USERNAME]/bin/Crosstool/crosstool-ng/bin/
   
   cd ~/src/Crosstool/RaspberryPi/staging/
   ct-ng menuconfig
This opens up a menubased interface to configure crosstool before building it. Do the following steps:
Quote
   Paths and misc options —> Try features marked as EXPERIMENTAL (NEW)
   Paths and misc options —> Prefix directory (NEW) —> ${HOME}/bin/Crosstool/Toolchains/${CT_TARGET}
   
   Target options    —> Target Architecture(alpha) —> arm
   
   Operating System —> Target OS (bare-metal) —> linux
   
   Binary utilities —> binutils version (2.22 (EXPERIMENTAL)) —> 2.21.1a
   
   C compiler —> Show Linaro versions (EXPERIMENTAL) (NEW)
   C compiler —> C++
   
   Exit —> Yes
Finally build it:
Quote
   ct-ng build
## Modify path permanently (untested)
Add these lines to the bottom of the ~/.profile file:
Quote
   export PATH=$PATH:/home/[USERNAME]/bin/Crosstool/Toolchains/arm-unknown-linux-gnueabi/bin
## Check compiler
Quote
   arm-unknown-linux-gnueabi-gcc --version

   mkdir /tmp/helloWorld/
   cd /tmp/helloWorld/

   cat > test.c
   #include <stdio.h>
   int main() { printf("Hello, world!\n"); return 0; }
   ^D

   arm-unknown-linux-gnueabi-gcc -o test test.c
   chmod +x test

   scp test pi@@[IP_OF_PI_GOES_HERE]:/tmp/
   ssh pi@[IP_OF_PI_GOES_HERE] /tmp/test

## Resources / References
* [Kitware blog: Cross-Compiling for Raspberry Pi](http://kitware.com/blog/home/post/426)
* [Building a Raspberry Pi Cross Compiler: could not retrieve eglibc-2_16](http://brains.witsmith.com/2012/10/building-cross-compiling-toolchain-for.html)
* [How to build a cross compiler for your Raspberry Pi](http://www.bootc.net/archives/2012/05/26/how-to-build-a-cross-compiler-for-your-raspberry-pi/)
* [crosstool-ng](http://crosstool-ng.org/)


Title: Re: Building Armory on Raspberry Pi
Post by: bektar on March 28, 2013, 07:46:15 AM
# 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)


Title: Re: Building Armory on Raspberry Pi
Post by: bektar on March 28, 2013, 07:54:28 AM
Some things I feel are noteworthy:

Would be nice to have Armory autostart once x is up and running. Not sure how to do this in linux. I intend to figure it out after easter is done. I would imagine it is very simple.

It is VERY slow to decrypt an encrypted wallet, it took a couple of minutes to do it for me when i was doing an initial test. I'm contemplating using full disk encryption instead of encrypting each individual wallet since I intend to have a SD-card that i use only for armory. However, i fear this might make the Pi so slow as to make it unusable. Not sure how to it either, but isn't that the point of having a pi? To learn new stuff :). Anyway, this also something to add to the todo list.


Title: Re: Building Armory on Raspberry Pi
Post by: chufchuf on April 09, 2013, 12:08:37 AM
thanks a lot for this write up. i want to ask you two things:

do you think it being so slow might be because raspberry pi isn't designed for ubuntu. it's not one of its officially supported OSes. Or is it because pi is generally slow all around when it comes to 2D acceleration?

And, I noticed you used the command line a lot. Is there any reason why a simpler transfer through USB stick, and Unetbootin, might not be just as good, first the OS through an .iso, then Armory, as detailed (though not with Pi) in this blog: http://georgeoughttohelp.tumblr.com/post/46937654072/transferring-bitcoins-to-a-secure-offline-wallet-using


Title: Re: Building Armory on Raspberry Pi
Post by: bektar on April 09, 2013, 04:37:11 AM
On the Pi i used Raspbian wheezy. I didn't think of mentioning it, so I'm glad thing you asked.

Not sure why it is so slow, my guess would be simply because the arm chip isn't very powerful. I imagine the libraries used aren't optimized for arm either. Neither one of these theories provide a way to increase the speed though, so hopefully i'm wrong.

I'm sure using tools with GUIs will work just as well. The main reason I stuck with the command line is that it is so easy to reproduce the results; just copy each line and in the end it will work. Using a GUI makes it a bit trickier to clearly explain each step.


Title: Re: Building Armory on Raspberry Pi
Post by: runeks on April 21, 2013, 10:39:58 PM
I'm trying to build Bitcoin Armory on a Raspberry Pi with Rapsbian (to use as an offline wallet) and I'm in need of assistance.

I've found a couple of guides on how to set up a cross compiler, building it, and then moving it over to the pi. I can't get any of them to work, so I decided to start by getting Armory to build on the Pi itself, and then moving on to getting it to work on the cross compiler.

Since Raspbian is based on debian, I was hoping I could just use the build instructions for Ubuntu found on the official Armory page http://bitcoinarmory.com/building-armory-from-source/ (http://bitcoinarmory.com/building-armory-from-source/).

Doing this ends up with the error:

Quote
make[2]: Entering directory `/home/pi/Desktop/Armory/BitcoinArmory/cppForSwig/cryptopp'
g++ -DNDEBUG -O -g0 -native -template=no%extdef  -c 3way.cpp
g++: error: unrecognized option ‘-native’
g++: error: unrecognized option ‘-template=no%extdef’
make[2]: *** [3way.o] Error 1
make[2]: Leaving directory `/home/pi/Desktop/Armory/BitcoinArmory/cppForSwig/cryptopp'
mv: cannot stat `libcryptopp.a': No such file or directory
make[1]: *** [libcryptopp.a] Error 1
make[1]: Leaving directory `/home/pi/Desktop/Armory/BitcoinArmory/cppForSwig'
make: *** [all] Error 2

[...]


This error seems to be caused by the Makefile in cryptopp 5.6.1 detecting the compiler on the Raspberry Pi to be a Sun C++ compiler (I have no idea why that happens). To fix this issue simply replace the Makefile in cppForSwig/cryptopp with the GNUmakefile that is in cryptopp 5.6.2 (link (http://www.cryptopp.com/#download)).

The next problem I ran into was strange assembler errors. Turns out this was caused by the Pi running out of memory. Creating a large swap file and using it as swap solved this issue. How to do this is described here: http://www.roberteklund.org/projects/raspberry-pi#TOC-Installation1


Title: Re: Building Armory on Raspberry Pi
Post by: wsoei on May 12, 2013, 04:34:59 AM
   
## 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


I'm stuck on this one.  Can an example of IP_of_PI be given?  Thanks for any help provided.


Title: Re: Building Armory on Raspberry Pi
Post by: RogueLeader on May 12, 2013, 04:42:59 AM
Cool stuff.  I keep seeing things that make me want to finally order a Raspberry Pi, this might be the tipping point...


Title: Re: Building Armory on Raspberry Pi
Post by: bektar on May 12, 2013, 06:47:40 AM
   
## 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


I'm stuck on this one.  Can an example of IP_of_PI be given?  Thanks for any help provided.

IP_of_PI is the ip number of your Raspberry Pi, I use the command ifconfig to find it.


Title: Re: Building Armory on Raspberry Pi
Post by: bektar on May 12, 2013, 06:50:06 AM
@runeks:
good stuff!
I'm sorry for not responding quicker, I forgot all about this thread :) I haven't tried your advice yet since everything is working well for me atm. I'm sure I will have to set up another Pi sometime in the future though so will give it a try then :)


Title: Re: Building Armory on Raspberry Pi
Post by: whiskers75 on May 12, 2013, 08:16:53 AM
   
## 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


I'm stuck on this one.  Can an example of IP_of_PI be given?  Thanks for any help provided.
IP_of_PI is the Internet Protocol address of your Pi. like 192.168.0.11


Title: Re: Building Armory on Raspberry Pi
Post by: hiturew on May 12, 2013, 08:42:48 AM
I assume this is why I'm copying the libpython2.7.so file from the pi? Any idea what I might be doing wrong this time?


Title: Re: Building Armory on Raspberry Pi
Post by: wsoei on May 12, 2013, 04:17:35 PM

IP_of_PI is the ip number of your Raspberry Pi, I use the command ifconfig to find it.


IP_of_PI is the Internet Protocol address of your Pi. like 192.168.0.11

Thanks for responding, bektar & whiskers75.

So, the raspberry pi would be connected to the ubuntu computer, in a closed network?  I'd disconnect the ubuntu computer from the internet and connect to the raspberry pi so that the raspberry pi never touches the actual network?


Title: Re: Building Armory on Raspberry Pi
Post by: bektar on May 13, 2013, 01:01:33 PM

IP_of_PI is the ip number of your Raspberry Pi, I use the command ifconfig to find it.


IP_of_PI is the Internet Protocol address of your Pi. like 192.168.0.11

Thanks for responding, bektar & whiskers75.

So, the raspberry pi would be connected to the ubuntu computer, in a closed network?  I'd disconnect the ubuntu computer from the internet and connect to the raspberry pi so that the raspberry pi never touches the actual network?

Yes that would work. Or you could use a usb stick. As long as you get the files from the Pi to the Ubuntu computer any way is fine.


Title: Re: Building Armory on Raspberry Pi
Post by: bektar on July 28, 2013, 06:35:15 AM
Just to make sure, you are replacing [user] with your username? If not start by doing that :)

In general, to change permissions in *nix you need to use the command "chmod". Perhaps in combination with "sudo" (depending on if you are the owner of the file). What you do is write

Code:
chmod 777 [filename goes here]

and thats it.

Please note that 777 gives read/write permissions to everyone. I believe its ok in this particular case since i expect you are going to be using this offline with no user except for yourself. In general though you should read the man pages for chmod and tailor the permissions as required.


Title: Re: Building Armory on Raspberry Pi
Post by: _mr_e on July 28, 2013, 10:58:22 PM
I have got up to this part...
scp -r pi@[IP_OF_PI_GOES_HERE]:/usr/lib/libpython2.7.so ~/src/Crosstool/RaspberryPi/lib

except my pi does not have a libpython2.7.so directory... Have I done something wrong?

This line worked though so I'm confused:
scp -r pi@[IP_OF_PI_GOES_HERE]:/usr/include/python2.7 ~/src/Crosstool/RaspberryPi/include


Title: Re: Building Armory on Raspberry Pi
Post by: _mr_e on July 28, 2013, 11:23:14 PM
I also tried going ahead and creating the patch file but I am receiving an error there too:

(Patch is indented 3 spaces.)
patching file cppForSwig/cryptopp/Makefile
(Patch is indented 3 spaces.)
patching file cppForSwig/Makefile
Hunk #1 FAILED at 1.
Hunk #2 FAILED at 37.
2 out of 2 hunks FAILED -- saving rejects to file cppForSwig/Makefile.rej

Help:(


Title: Re: Building Armory on Raspberry Pi
Post by: bektar on July 30, 2013, 05:34:29 AM
I'll have a look at it tonight or tomorrow and get back to you… I thought I was pretty thorough when I tested everything, but apparently I messed up somewhere :)


Title: Re: Building Armory on Raspberry Pi
Post by: FactualOrc on August 11, 2013, 04:33:06 PM
Any more word on this, Bektar?

I also tried going ahead and creating the patch file but I am receiving an error there too:

(Patch is indented 3 spaces.)
patching file cppForSwig/cryptopp/Makefile
(Patch is indented 3 spaces.)
patching file cppForSwig/Makefile
Hunk #1 FAILED at 1.
Hunk #2 FAILED at 37.
2 out of 2 hunks FAILED -- saving rejects to file cppForSwig/Makefile.rej

Help:(
I'm getting this error too. You can fix the indentation error though by making sure that lines that begin with either a "+", "-" or "@" don't have a space at the beginning and that all the other lines do

I have got up to this part...
scp -r pi@[IP_OF_PI_GOES_HERE]:/usr/lib/libpython2.7.so ~/src/Crosstool/RaspberryPi/lib

except my pi does not have a libpython2.7.so directory... Have I done something wrong?

This line worked though so I'm confused:
scp -r pi@[IP_OF_PI_GOES_HERE]:/usr/include/python2.7 ~/src/Crosstool/RaspberryPi/include

This is also confusing me, I'm pretty sure my Pi has the python libraries but they do not seem to be in that directroy... strange.


Title: Re: Building Armory on Raspberry Pi
Post by: cosmarchy on August 26, 2013, 01:41:36 PM
I'm trying to follow bektars instructions back in post #15 where it gives instructs

Quote
scp -r pi@[IP_OF_PI_GOES_HERE]:/usr/lib/libpython2.7.so ~/src/Crosstool/RaspberryPi/lib

but when I look at my RPI, I cannot find libpython2.7.so only libpython2.7.so.0 and libpython2.7.so.1
I've searched the entire drive high and low and these are the only files vaguely relevant.

Can anyone please advise what I can do?

Thanks


Title: Re: Building Armory on Raspberry Pi
Post by: cosmarchy on August 26, 2013, 06:41:01 PM
Mr bektar, sir....are you there?  ;D


Title: Re: Building Armory on Raspberry Pi
Post by: bektar on September 27, 2013, 08:18:50 AM
Ugh, i completly forgot all about this thread…

After having a quick look I would guess that the problem is copy pasting from the forum… it adds whitespace. I've created a gist at https://gist.github.com/bektar/6725546 (https://gist.github.com/bektar/6725546).

Use this by creating a file inside the "BitcoinArmory" directory called "BitcoinArmory.patch" and instead of doing:

Quote
cat > BitcoinArmory.patch

paste the raw contents in the gist into this file (please use a text editor, not a word editor).

And then go on with step "Apply the patch".


Please note, I havent tried this myself so please let me know how it goes.


Title: Re: Building Armory on Raspberry Pi
Post by: bektar on September 27, 2013, 08:21:07 AM
I'll try to take some time this weekend to make a gist or repo of the entire process… not making any promises though :)


Title: Re: Building Armory on Raspberry Pi
Post by: bektar on September 27, 2013, 08:24:06 AM
I'm trying to follow bektars instructions back in post #15 where it gives instructs

Quote
scp -r pi@[IP_OF_PI_GOES_HERE]:/usr/lib/libpython2.7.so ~/src/Crosstool/RaspberryPi/lib

but when I look at my RPI, I cannot find libpython2.7.so only libpython2.7.so.0 and libpython2.7.so.1
I've searched the entire drive high and low and these are the only files vaguely relevant.

Can anyone please advise what I can do?

Thanks

Do you get any error when you do this step? You are doing it from your crosscompiling computer and not your Pi, right?


Title: Re: Building Armory on Raspberry Pi
Post by: bektar on September 27, 2013, 08:27:30 AM
After reading through the guide now months after i wrote it i realize its note all that clear which parts are run on you pi, and which are run on your crosscompiling computer…

I'll try to make this clearer if while I'm making the repo/gist this weekend (if i get around to it, still not making any promises :P )


Title: Re: Building Armory on Raspberry Pi
Post by: xabbix on December 29, 2013, 11:07:26 PM
In case anyone is still interested in compiling the Bitcoin Armory on the RPi, you can download the compiled source code from http://coldpi.com.

That is Bitcoin Armory 0.88, compiled for Raspbian.


Title: Re: Building Armory on Raspberry Pi
Post by: abracadabra on March 08, 2014, 06:40:00 PM
Code:
/opt/cross/x-tools/arm-unknown-linux-gnueabi/lib/gcc/arm-unknown-linux-gnueabi/4.8.2/../../../../arm-unknown-linux-gnueabi/bin/ld: libleveldb.a(db_impl.o): Relocations in generic ELF (EM: 3)
libleveldb.a: could not read symbols: File in wrong format
collect2: error: ld returned 1 exit status
make[1]: *** [../_CppBlockUtils.so] Error 1
make[1]: Leaving directory `/home/user/src/Crosstool/RaspberryPi/staging/BitcoinArmory/cppForSwig'
make: *** [all] Error 2

Trying to cross compile on ubuntu.

Full output is here:

http://pastebin.com/8MKevDbS

Any ideas?

Thanks!


Title: Re: Building Armory on Raspberry Pi
Post by: abracadabra on March 09, 2014, 12:47:31 AM
Got the above fixed... there's stuff in the makefile that needs fixing... seems the script that makes the pypaths.txt doesn't make it right...

Anyways.. have compiled armory with no errors...
running it on the pi i get the following:

Code:
root@raspberrypi:/home/pi/Desktop/BitcoinArmoryRPi# python ArmoryQt.py
********************************************************************************
Loading Armory Engine:
   Armory Version:       0.90
   PyBtcWallet  Version: 1.35
Detected Operating system: Linux
   OS Variant            : ('debian', '7.2', '')
   User home-directory   : /root
   Satoshi BTC directory : /root/.bitcoin/
   Armory home dir       : /root/.armory/
   LevelDB directory     : /root/.armory/databases
   Armory settings file  : /root/.armory/ArmorySettings.txt
   Armory log file       : /root/.armory/armorylog.txt
(ERROR) Traceback (most recent call last):
  File "ArmoryQt.py", line 32, in <module>
    from armoryengine import *
  File "/home/pi/Desktop/BitcoinArmoryRPi/armoryengine.py", line 10916, in <module>
    from jsonrpc import ServiceProxy, authproxy
ImportError: cannot import name authproxy

Error in sys.excepthook:
Traceback (most recent call last):
  File "/home/pi/Desktop/BitcoinArmoryRPi/armoryengine.py", line 618, in logexcept_override
    sys.__excepthook__(type, value, tback)
AttributeError: 'NoneType' object has no attribute '__excepthook__'

Original exception was:
Traceback (most recent call last):
  File "ArmoryQt.py", line 32, in <module>
    from armoryengine import *
  File "/home/pi/Desktop/BitcoinArmoryRPi/armoryengine.py", line 10916, in <module>
    from jsonrpc import ServiceProxy, authproxy
ImportError: cannot import name authproxy

I have done the following:

Code:
git clone https://github.com/joshmarshall/jsonrpclib
cd jsonrpclib/
python setup.py install

Same error.
Then tried:

Code:
apt-get install bzr
bzr checkout http://bzr.json-rpc.org/trunk ; cd trunk/python-jsonrpc
sudo python setup.py install


Same error...
help is appreciated..


Title: Re: Building Armory on Raspberry Pi
Post by: kay-nut on March 26, 2014, 07:55:21 PM
Anyways.. have compiled armory with no errors...
running it on the pi i get the following:

Code:
root@raspberrypi:/home/pi/Desktop/BitcoinArmoryRPi# python ArmoryQt.py
********************************************************************************
Loading Armory Engine:
   Armory Version:       0.90
   PyBtcWallet  Version: 1.35
Detected Operating system: Linux
   OS Variant            : ('debian', '7.2', '')
   User home-directory   : /root
   Satoshi BTC directory : /root/.bitcoin/
   Armory home dir       : /root/.armory/
   LevelDB directory     : /root/.armory/databases
   Armory settings file  : /root/.armory/ArmorySettings.txt
   Armory log file       : /root/.armory/armorylog.txt
(ERROR) Traceback (most recent call last):
  File "ArmoryQt.py", line 32, in <module>
    from armoryengine import *
  File "/home/pi/Desktop/BitcoinArmoryRPi/armoryengine.py", line 10916, in <module>
    from jsonrpc import ServiceProxy, authproxy
ImportError: cannot import name authproxy

Error in sys.excepthook:
Traceback (most recent call last):
  File "/home/pi/Desktop/BitcoinArmoryRPi/armoryengine.py", line 618, in logexcept_override
    sys.__excepthook__(type, value, tback)
AttributeError: 'NoneType' object has no attribute '__excepthook__'

Original exception was:
Traceback (most recent call last):
  File "ArmoryQt.py", line 32, in <module>
    from armoryengine import *
  File "/home/pi/Desktop/BitcoinArmoryRPi/armoryengine.py", line 10916, in <module>
    from jsonrpc import ServiceProxy, authproxy
ImportError: cannot import name authproxy

The packaging instructions earlier in this thread are out of date for the current BitcoinArmory version.
I have done a successful cross compile of BitcoinArmory for Raspberry Pi and will do a complete write up and post it here in a couple of days.

To fix your error you need to do the following after compiling succeeds:
Code:
mkdir -p /tmp/BitcoinArmoryRPi/img/
mkdir -p /tmp/BitcoinArmoryRPi/extras/
mkdir -p /tmp/BitcoinArmoryRPi/jsonrpc/
mkdir -p /tmp/BitcoinArmoryRPi/dialogs/


cp *.py *.so README LICENSE /tmp/BitcoinArmoryRPi/
cp img/* /tmp/BitcoinArmoryRPi/img/
cp extras/*.py /tmp/BitcoinArmoryRPi/extras/
cp jsonrpc/*.py /tmp/BitcoinArmoryRPi/jsonrpc/
cp dialogs/*.py /tmp/BitcoinArmoryRPi/dialogs/

cd /tmp
tar cvfz BitcoinArmoryRPi.tar.gz BitcoinArmoryRPi


Title: Re: Building Armory on Raspberry Pi
Post by: kay-nut on April 09, 2014, 08:32:00 PM
For those interested I did a complete write up on my blog: http://moritzpfeiffer.ch/ (http://moritzpfeiffer.ch/).