This website is no longer actively supported. Please see the Ripple Developer Center for up-to-date documentation and other resources.

Ubuntu build instructions

From Ripple Wiki
Jump to: navigation, search

Prerequisites

You'll need Ubuntu 14.04 LTS or later. This process has been tested and verified for Ubuntu 14.04 and 15.10.

Verify the version of Ubuntu:

$ cat /etc/issue
Ubuntu 15.10 \n \l

Clone the rippled repository

From the terminal

sudo apt-get install git
git clone https://github.com/ripple/rippled.git
cd rippled
git checkout develop

Install Software

There is a script on the develop branch that installs the dependencies rippled needs. On Ubuntu < 15.10, this will make make gcc 5 the default compiler. Note:

There was an ABI change between gcc 4 and gcc 5. On Ubuntu < 15.10, libraries used with rippled (such as boost and protobuf) must either be:

* Installed with apt-get
* Compiled with gcc 4.x
* Compiled with gcc 5.x and a command line that includes: -D_GLIBCXX_USE_CXX11_ABI=0

Make sure you understand the ABI issue described above, then run

cd /path/to/rippled
git checkout develop
sudo Builds/Ubuntu/install_rippled_depends_ubuntu.sh

After upgrading to gcc 5 on Ubuntu < 15.10, there may be issues compiling other (non-ripple) programs with g++. The command "sudo update-alternatives --config gcc" will help switch between gcc 4 and gcc 5.


GCC 5

Since rippled uses c++-14, it must be built with gcc 5 or better. The command: "sudo update-alternatives --config gcc" will help switch between gcc 4 and gcc 5.

 gcc --version
 # If gcc version < 5
 sudo update-alternatives --config gcc
 # Choose gcc 5 from that list

A Note on clang

Clang (as of 3.7) cannot understand the new GCC 5 ABI. When using clang on Ubuntu >= 15.10, boost and protobuf must be built with the GCC 4 ABI. The best solution is when using clang on Ubuntu >= 15.10, build these libraries with clang and set the BOOST_ROOT and PROTOBUF_DIR to the appropriate directories (see the SConstruct file).

Building

Choose the master branch or one of the tagged releases listed on GitHub.

git checkout master

or to test the latest release candidate, choose the release branch.

git checkout release

or to try the most recent commits, choose the develop branch. Note: develop is bleeding edge and may not even build.

git checkout develop

Build everything:

scons

See: here

Create the database directory

cd /var/lib
sudo mkdir -p rippled/db

Assign it to the appropriate user

sudo chown -R <name>:<name> rippled

Assuming you are the only user on this machine, to find <name>, issue the command:

id

Configure rippled

See the rippled.cfg page for more information. Note that there is a example rippled configuration in the repository under /rippled/doc/rippled-example.cfg.

You may need to copy this file to the .config/ripple directory for rippled to start, if you do not specify a config file for rippled when starting it.

Start rippled

To get the initial ledger from the network (assuming you git cloned rippled to the home directory):

~/rippled/build/rippled --net

Please note that you will either need to use certificates or disable SSL (commented out in the final stanza of the example rippled.cfg file) to use rippled's API. See the rippled.cfg file for more information.

System Tests (Recommended)

The external rippled system tests are written in Javascript using Node.js, and utilize the buster system test framework. Test are run with rippled stopped. To run the system tests, it will be necessary to perform the following steps:

Install Node.js

Add more recent node repository

sudo add-apt-repository ppa:chris-lea/node.js

If add-apt-repository is not found, get it via

sudo apt-get install software-properties-common

Update Package List

sudo apt-get update

Install Package nodejs

sudo apt-get install nodejs

Install nodejs Package Manager

 sudo apt-get install npm

Create node_modules

From the root of your local rippled repository directory, invoke npm to bring in the necessary components:

npm install

Create a test/config.js

cp test/config-example.js test/config.js

Edit your version of test/config.js to reflect the correct path to the rippled executable if you placed it somewhere else.

The test runner will create a `tmp` folder in the root of the repository, with an auto-generated `ripple.cfg` file, and a folder for the db backend's disk storage. The configuration is generated from the `servers` object exported from `rippled/test/config.js`. There is an example configuration file at `rippled/test/config-example.js` you can copy to create this. You must specify a db backend (NodeBackEnd) to be able to run the tests.

Run Tests

 npm test

Alternatively, run an individual test using node:

node test/module-test.js


Development ripple-lib

To use the latest branch of ripple-lib during the system tests, first clone the repository in a new location outside of your rippled repository. Then update the submodules. After, run npm install to set up the node_modules directory. Finally, install the grunt command line tools required to run grunt and build ripple-lib.

git clone git@github.com:ripple/ripple-lib.git
cd ripple-lib
git submodule update --init
npm install
npm install -g grunt-cli
grunt

Now link this version of ripple-lib into the global packages:

sudo npm link

To make rippled use the newly linked global ripple-lib package instead of the one installed under node_modules, change directories to the local rippled repository and delete the old ripple-lib then link to the new one:

rm -rf node_modules/ripple-lib
npm link ripple-lib