Pages:
Author

Topic: Building Armory on Raspberry Pi - page 2. (Read 10081 times)

newbie
Activity: 37
Merit: 0
May 12, 2013, 01:50:06 AM
#23
@runeks:
good stuff!
I'm sorry for not responding quicker, I forgot all about this thread Smiley 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 Smiley
newbie
Activity: 37
Merit: 0
May 12, 2013, 01:47:40 AM
#22
   
## 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.
newbie
Activity: 38
Merit: 0
May 11, 2013, 11:42:59 PM
#21
Cool stuff.  I keep seeing things that make me want to finally order a Raspberry Pi, this might be the tipping point...
newbie
Activity: 46
Merit: 0
May 11, 2013, 11:34:59 PM
#20
   
## 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.
legendary
Activity: 980
Merit: 1008
April 21, 2013, 05:39:58 PM
#19
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/.

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).

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
newbie
Activity: 37
Merit: 0
April 08, 2013, 11:37:11 PM
#18
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.
full member
Activity: 205
Merit: 100
April 08, 2013, 07:08:37 PM
#17
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
newbie
Activity: 37
Merit: 0
March 28, 2013, 02:54:28 AM
#16
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 Smiley. Anyway, this also something to add to the todo list.
newbie
Activity: 37
Merit: 0
March 28, 2013, 02:46:15 AM
#15
# 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://bitcointalksearch.org/topic/building-armory-on-raspberry-pi-156003)
* [The Ten Minute Guide to diff and patch](http://jungels.net/articles/diff-patch-ten-minutes.html)
newbie
Activity: 37
Merit: 0
March 28, 2013, 02:42:49 AM
#14

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
   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/)
newbie
Activity: 37
Merit: 0
March 26, 2013, 07:16:02 AM
#13
Hehe, didn't notice your edit until after i was done. But that was the trick. Good catch!
newbie
Activity: 37
Merit: 0
March 26, 2013, 07:12:25 AM
#12
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!



newbie
Activity: 7
Merit: 0
March 26, 2013, 06:21:51 AM
#11
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?
newbie
Activity: 37
Merit: 0
March 26, 2013, 06:10:45 AM
#10
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?
newbie
Activity: 7
Merit: 0
March 26, 2013, 03:32:40 AM
#9
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!
newbie
Activity: 7
Merit: 0
March 26, 2013, 03:23:50 AM
#8
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!
newbie
Activity: 37
Merit: 0
March 26, 2013, 02:18:50 AM
#7
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 Smiley
newbie
Activity: 6
Merit: 0
March 25, 2013, 05:16:05 PM
#6
Were you able to get this working? It seems like this would be a great use for the RaspberryPi!
newbie
Activity: 37
Merit: 0
March 25, 2013, 01:56:00 PM
#5
Excellent! Thanks for taking the time to post it here.

I'll give it a try first thing tomorrow!
newbie
Activity: 7
Merit: 0
March 25, 2013, 01:53:44 PM
#4
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!
Pages:
Jump to: