I previously wrote about how to get Gridcoinresearch running under Ubuntu. Since then, the project has advanced and in most cases you can simply install the wallet from a PPA.
I came to realize that this was not the case with my Raspberyy Pi 3 B, running Rasbian stretch. When trying to add a PPA as recommended by Launchpad Gridcoin-stable:
Stable builds for ordinary users for i386, amd64 and armhf. This PPA will lag leisure releases by up to one day to ensure stability. Mandatory upgrades will be released immediately.The following happens.
sudo add-apt-repository ppa:gridcoin/gridcoin-stableTraceback (most recent call last): File "/usr/bin/add-apt-repository", line 95, in <module> sp = SoftwareProperties(options=options) File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 109, in __init__ self.reload_sourceslist() File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 599, in reload_sourceslist self.distro.get_sources(self.sourceslist) File "/usr/lib/python3/dist-packages/aptsources/distro.py", line 89, in get_sources (self.id, self.codename))aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Raspbian/stretch
Hence, lets compile from source.
Update 12/06/2018
The latest release of Gridcoin switched to using autogen instead of the old make -f makefile process. The install and update process is less tedious this was, but it takes quite long on a Raspberry Pi 3B. The general method for building and installing it is,
./autogen.sh
./configure
make
make install
However, to succeed on Raspbian, some packages need to be installed first. Proceed as follows.
1.
BerkleyDB4.8 needs to be installed, exactly! So basically what is available from apt (libdb5.x) is not good. I found a good resource for installing this from source at askubuntu.com. Below is the solution that worked on my Raspberry Pi.
wget 'http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz'tar -xzvf db-4.8.30.NC.tar.gz
cd db-4.8.30.NC/build_unix/
../dist/configure --enable-cxx
makemake install
And then tell the system where to find db4.8
export BDB_INCLUDE_PATH="/usr/local/BerkeleyDB.4.8/include"
export BDB_LIB_PATH="/usr/local/BerkeleyDB.4.8/lib"ln -s /usr/local/BerkeleyDB.4.8/lib/libdb-4.8.so /usr/lib/libdb-4.8.so
2.
After this the building can begin. The first few steps are simple,sudo apt-get install autoconfgit clone https://github.com/gridcoin-community/Gridcoin-Researchcd Gridcoin-Research./autogen.sh
When trying to run ./configure I got into trouble with BerkleyDB4.8 still not being detected or perhaps superceeded by a higher version. The solution here was to set the environment variable and link CPPFLAGS and LDFLAGS before running ./configure as,
env CPPFLAGS='-I/usr/local/BerkeleyDB.4.8/include' LDFLAGS='-L/usr/local/BerkeleyDB.4.8/lib' ./configureFinally,
make
Note: As usual, you can run make -j4 to run it on 4 threads, however I had a lot of system hungs with my Raspberry Pi at this point. Maybe the RAM ran out, I am not certain. See if it works for you, but I would recommend you set up some temporary swap as descibed below in "Setting up additional Swap".
--- UPDATE END ---
TL;DR
For those who understand commands and want to get things running qucikly.sudo apt-get install ntp git build-essential libssl-dev libdb-dev libdb++-dev libqrencode-dev libcurl4-openssl-dev libzip4 libzip-dev libboost1.62-all-dev libminiupnpc-dev
sudo dd if=/dev/zero of=/mnt/2GB.swap bs=1024 count=2097152
sudo mkswap /mnt/2GB.swap
sudo swapon /mnt/2GB.swap
git clone https://github.com/gridcoin/Gridcoin-Research
cd ~/Gridcoin-Research/src
chmod 755 leveldb/build_detect_platform
make -f makefile.unix -j 2 USE_UPNP=- -e PIE=1
strip gridcoinresearchd
sudo cp gridcoinresearchd /usr/bin/gridcoinresearchd
sudo swapoff -a
Installation
Although, installing the client is described on the Github page [1] of the project and following it step-by-step will result, in most cases, in a perfect installation, for the raspberry pi it can get tricky.
Install dependencies
Nothing special here, just the dependencies. First do a
sudo apt-get update && sudo apt-get upgrade
and then
sudo apt-get install ntp git build-essential libssl-dev libdb-dev libdb++-dev libqrencode-dev libcurl4-openssl-dev libzip4 libzip-dev libboost1.62-all-dev libminiupnpc-dev
Setting up additional Swap
I ran into issues with memory during compiling, especially with multiple threads. You can try to skip this step and see if it works, otherwise lets create a 2 GiB swap file. The commands take about 2-4 minutes to finish, so be patient.
sudo dd if=/dev/zero of=/mnt/2GB.swap bs=1024 count=2097152
sudo mkswap /mnt/2GB.swap
sudo swapon /mnt/2GB.swap
This will create a 2GiB /mnt/2GB.swap file that will be used during compiling.
Clone and compile gridcoinresearchd from Github
Everything is ready to pull gridcoinresearchd from Github and proceed with building it.
git clone https://github.com/gridcoin/Gridcoin-Research
cd ~/Gridcoin-Research/src
chmod 755 leveldb/build_detect_platform
make -f makefile.unix -j 2 USE_UPNP=- -e PIE=1
strip gridcoinresearchd
sudo cp gridcoinresearchd /usr/bin/gridcoinresearchdTo start gridcoinresearchd type
gridcoinresearchd
Note: The compiling (make) takes a while. Be patient.
Tip: "gridcoinresearchd" is a system command now and can be called quickly by starting to type it "grid..." and pressing [TAB]. Also, type gridcoinresearchd help to get a list of available commands with the headless client. The -j 2 option tells make to use 2 CPU cores, this helps speeding up the compiling. Some general practice says that it is fine to use number of CPU x 1.5 to get a good parallel performance, however when using 4-6 threads I ran out of memory and got errors.
Turn off swap
Swap is no longer needed after compiling, so it can be turned off. This helps prolonging the SD card's lifespan by preventing writing to it too often.sudo swapoff -a
Troubleshooting
If any dependencies are missing (or, of course, something else is wrong) you will be greeted by an army of error messages. For example,
gridcoin upgrader.h:4:42: fatal error: curl/curl.h: No such file or directory #include <curl/curl.h> // for downloading
means that there is an issue with curl. It took me a while, but it was not actually curl, but libcurl that has been missing. After installing it with sudo apt-get install libcurl4-openssl-dev, the compiling got past this point.
Or something like this
Of course, these are just two examples, but the rule applies. Check the last few lines of the error message, and see what is missing. You can check whether a package is installed with dpkg -l | grep <PACKAGENAME>.
Of course, if you get stuck somewhere you can feel free to leave a comment below.
Sources
[1] - https://github.com/gridcoin/Gridcoin-master/blob/master/CompilingGridcoinOnLinux.txt
Or something like this
gridcoin compilation terminated. makefile.unix:137: recipe for target 'obj/rpcrawtransaction.o' failed make: *** [obj/rpcrawtransaction.o] Error 1Here if I remember the issue was a missing boost library. sudo apt-get install libboost1.62-all-dev fixed the problem in this case.
Of course, these are just two examples, but the rule applies. Check the last few lines of the error message, and see what is missing. You can check whether a package is installed with dpkg -l | grep <PACKAGENAME>.
Of course, if you get stuck somewhere you can feel free to leave a comment below.
Sources
[1] - https://github.com/gridcoin/Gridcoin-master/blob/master/CompilingGridcoinOnLinux.txt
No comments:
Post a Comment