# Building for Linux¶

## Getting the source code¶

We use git and GitHub to maintain the source code. Clone the repository by:

git clone --recursive https://github.com/ethereum/cpp-ethereum.git
cd cpp-ethereum


The --recursive option is important. It orders git to clone additional submodules which are required to build the project. If you missed it you can correct your mistake with command git submodule update --init.

## CMake¶

Alternative method

The repository contains the script install_cmake.sh that downloads a fixed version of CMake and unpacks it to the given directory prefix. Example usage scripts/install_cmake.sh --prefix /usr/local.

## Installing dependencies¶

The following libraries are required to be installed in the system:

• boost
• leveldb
• curl
• microhttpd
• miniupnp
• gmp

They usually can be installed using distribution-specific package manager. For example on Debian-based systems:

sudo apt-get install libboost-all-dev libleveldb-dev libcurl4-openssl-dev libmicrohttpd-dev libminiupnpc-dev libgmp-dev


or on RedHat-based systems:

dnf install boost-devel leveldb-devel curl-devel libmicrohttpd-devel miniupnpc-devel gmp-devel


Linux has a horror-show of fragmentation when it comes to packaging systems.

We support a “one-button” bash script which attempts to make this minefield more navigable for users of common distros. It identifies your distro and installs the external packages which you will need, using whatever combination of package servers and build-from-source is required for your specific distro version. This is a non-trivial task, but by that token is also something which we don’t want anybody to have to replicate themselves.

scripts/install_deps.sh


We use the same script for automated builds and continuous integration, so it is continuously tested, which is especially important on MacOS, where Homebrew is a constantly moving target.

If you try it, and it doesn’t work for you, please report the problem with details of your distro, your version number and any other important details and we can work together to get it working for your use-case.

We have manual instructions for Fedora, openSUSE and Arch Linux (see below). If you using some other distro then please contact us and we’ll see if we can get you going.

## Build on the command-line¶

When you have installed your dependencies you can build.

mkdir build                                              Make a directory for the build output
cd build                                                 Switch into that directory

cmake ..                                                 To generate a makefile.
make                                                     To build that makefile on the command-line
make -j<number>                                          (or) Execute makefile with multiple cores in parallel


## 32-bit Linux builds¶

We have cpp-ethereum building and running successfully on many 32-bit Linux distros, with the main constraint being the availability of external dependencies in 32-bit variants. Probably the most active demand here is for single-board computers like the Raspberry Pi family.

You will need to disable the JIT and the heavy-weight LLVM dependency which comes with that. EVMJIT only supports x86_64. Other than that, cpp-ethereum should “just work” on 32-bit platforms. To disable JIT, you will need to use the following command for the Makefile generation phase:

cmake .. -DEVMJIT=Off