Cross compiling Litecoin Core

I’ve had a plan of being a good guy and contributing to the litecoin network by being a full node. I was able to do this when I got around to buying a raspberry pi 3B+ and a 2TB external hard drive. There isn’t many up-to-date guides out there on setting a full node up on a raspberry pi, but this one was the most recent, and worked every step of the way (with a few minor changes) - the school of litecoin

I followed this guide and successfully setup a headless litecoin full node with no wallet, that stores the blockchain on an external harddrive (to hopefully save some SD card wear). I will post another, updated guide, heavily based on this one in my next post. But give that a read first as I won’t cover the basics that are covered in that medium publication. The only thing I didn’t get out of this guide was the wallet part of the node, as the wallet component requires a specific version of berkleyDB which you also have to manually compile (which isn’t covered in the guide)

This was great, however it took ~4 hours total to get this up and running (and an extra 2 days to fully sync the node) Seeing as though I plan to keep this thing updated, I did not want to have to spend 4 hours compiling the newest version of litecoin for every release. So that is when I thought of cross compiling from my desktop, to hopefully save time. As I don’t often do this, it took my quite a bit of time and research to get it working, but will now save myself (and hopefully others) time in the future! This guide would also be useful for any cryptocurrency that is a fork of bitcoin too

raspberrypi) and the target PC (the raspberrypi)

Host PC

Linux george-linux 4.4.0-98-generic #121-Ubuntu SMP Tue Oct 10 14:24:03 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Distributor ID: neon
Description:    KDE neon User Edition 5.12
Release:        16.04
Codename:       xenial

Target PC

Linux georgeboy 4.14.34-v7+ #1110 SMP Mon Apr 16 15:18:51 BST 2018 armv7l GNU/Linux

Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 9.4 (stretch)
Release:        9.4
Codename:       stretch


  • Install the dependancies for cross compile, there are quite a few
$ sudo apt-get install gcc-arm-linux-gnueabi binutils-arm-linux-gnueabi curl g +-aarch64-linux-gnu g++-4.8-aarch64-linux-gnu gcc-4.8-aarch64-linux-gnu binutils-aarch64-linux-gnu g++-arm-linux-gnueabihf g++-4.8-arm-linux-gnueabihf gcc-4.8-arm-linux-gnueabihf binutils-arm-linux-gnueabihf g++-4.8-multilib gcc-4.8-multilib binutils-gold bsdmainutils
  • Get the latest litecoin and extract (at the time I used 0.16.0rc1)

tar zxvf v0.16.0rc1.tar.gz
  • make the dependancies for the architecture you are compling for. This will go and grab a whole bunch of things, but you can turn off things you do not want here by adding some arguments to the make command
cd litecoin-0.16.0rc1/depends
make host=arm-linux-gnueabihf -j4 
# if you do not want wallet or gui 

# make host=arm-linux-gnueabihf -j4 NO_WALLET=1 NO_QT=1
real    5m28.381s
user    6m17.932s
sys     0m21.860s
  • now do the thing for litecoin
cd ..
./configure LDFLAGS="-static" CXXFLAGS="-O2 --param ggc-min-expand=1 --param ggc-min-heapsize=32768" --enable-cxx --without-gui --disable-shared --with-pic --build x86_64-pc-linux-gnu --host arm-linux-gnueabi --prefix=`pwd`/depends/arm-linux-gnueabihf
# time for ./configure

# real    0m36.008s

# user    0m30.848s

# sys     0m1.352s

sudo make -j4
# I use sudo here as I tried make by itself but ran into an issue, see "Issues" below

# real    18m3.695s

# user    71m0.420s

# sys     0m28.704s
  • Now copy over to your raspberrypi and test
scp src/litecoind src/litecoin-cli src/litecoin-tx george@newrpi:~/

george@newrpi:~ $ ./litecoind --version
Litecoin Core Daemon version v0.16.0.0-g3567effe2049
Copyright (C) 2011-2018 The Litecoin Core developers
Copyright (C) 2009-2018 The Bitcoin Core developers

Please contribute if you find Litecoin Core useful. Visit
<> for further information about the software.
The source code is available from

This is experimental software.
Distributed under the MIT software license, see the accompanying file COPYING
or <>

This product includes software developed by the OpenSSL Project for use in the
OpenSSL Toolkit <> and cryptographic software written by
Eric Young and UPnP software written by Thomas Bernard.

george@newrpi:~ $ ./litecoin-cli --version
Litecoin Core RPC client version v0.16.0.0-g3567effe2049

So all up (including installing the depedancies) 30 minutes to cross compile a litecoin node (including the wallet) for your raspberry pi. Seeing that the current stable is 0.15.1, and v0.16.0 is on RC, you’ll be upgrading soon so we have already saved some time

Issues I ran into along the way

Firstly I ran ./, ./configure and make directly in the litecoin folder without first building in the depends/ folder. I soon realised I needed Berkley DB. So I downloaded it and cross compiled it for arm. Then tried ./configure again using LDFLAGS="-static -L${BDB_PREFIX}/lib/" CXXFLAGS="-I${BDB_PREFIX}/include/ as arguments to point to the compiled Berkley DB files. This got me further but then I started running into libboost issues with an error similar to bitcoinserver_a error adding symbols: Archive has no index; run ranlib to add one this is because of a mismatch in architecture as it was referencing the x86_64 libboost files, turns out I need the arm version of boost libraries. I attempted to install multiarch on my desktop but that did not work, and eventually I found a pre-compiled version of libboost for arm on the forums. I downloaded that and used --with-boost-libdir=/home/harry/lib within ./configure to tell it about the arm libboost files. This got me further, however of course I ran into another issue univalue/.libs/libunivalue.a: error adding symbols: Archive has no index; run ranlib to add one. This one had me stumped and I was going to throw in the towel (as this was a few hours in)

But after researching further I stumbled across the /depends/ folder in the bitcoin repo This had some useful information regarding cross compiling. This allowed you to get all the dependancies for whatever architecture you were targeting without having to do it yourself. I do not know why I had not come across this earlier.

Sites that helped me along the way

The following links were very helpful during this journey, so I’d just like to recognise them here too: