Skip to content

Building CPP ethereum without the umbrella project

Lefteris Karapetsas edited this page Sep 9, 2015 · 3 revisions

One way is to use the umbrella project and work with submodules. This guide will document another way which does not require the umbrella project to be cloned at all.

Get the build scripts

Let's assume that you start from an empty directory. In there clone the helpers repository. We need the helpers for building but also for acquiring the 2 very important scripts which will let us build. ethupdate.sh and ethbuild.sh.

They are located under webthree-helpers/scripts. You can use them directly from there but if you are developing for ethereum often enough I would suggest to add the scripts directory to the PATH so that they are accessible from anywhere. The rest of the guide will assume you have done this. If you haven't just replace the script names with the full path to the script.

Cloning/updating the projects

The C++ ethereum project is composed of various subprojects. Starting from scratch you can get any of:

  • all
  • libweb3core
  • libethereum
  • webthree
  • solidity
  • alethzero
  • mix

In order to get a project issue the following command from the root directory:

ethupdate.sh --project NAME --no-push --upstream origin

This will clone all the required repositories for the project or update them if existing. To see all options type ethupdate.sh --help.

Some more advanced options allow for:

  • --branch NAME: Set a branch to fetch/clone. Default is develop.
  • --origin NAME: If working with your personal fork, and an upstream (which should be ethereum) then with this option you can set the remote name for your personal fork. If --no-push is not given any changes taken from the upstream will be pushed back to update your origin.
  • upstream NAME: As stated above this should be the name of the remote of the upstream, the ethereum repo. If you simply want to clone repos from scratch, set this to origin.
  • --no-push: If this argument is given changes from the upstream will not be pushed back to the origin
  • --use-ssh: If given and if you are cloning repos from scratch the ssh URL will be used instead of the HTTPS
  • --shallow-fetch: If given all repos will be fetched with --depth=1

After this is done your root directory will contain all the repositories required to build the requested project.

Building the projects

In order to build a project you issue the following from the root directory:

ethbuild.sh --project NAME --cores 4 --no-git

Some more advanced options allow for:

  • --clean-build: The build directory will be totally removed and recreated, so the build will be done from scratch
  • --no-git: No attempt to checkout a specific branch and no git checks will be done.
  • --branch NAME: The name of the branch to checkout for building if you want some specific branch built
  • --build-type NAME: The name of the type of build to do. For example legal values are: Debug, Release, RelWithDebInfo.
  • --cores NUM: The number of parallel threads of execution to build with.
Clone this wiki locally