LoginSignup
3
1

More than 5 years have passed since last update.

building catapult-server on ubuntu16.04

Posted at

昨日はcatapult-serverのビルドですごく盛り上がっていたんですね。

遅ればせながら、わたしも@Daoka氏のdockerfileを参考にして一応ビルドが完了したので、やったことをまとめておきます。

@Daoka氏、お疲れさまです!

しかし、ちょっと大変すぎ ^^

環境(Time4VPSに構築)

  • OS: Ubuntu 16.04 (64-bit)
  • Processor: 2 x 2.4 GHz
  • Memory: 2048 MB
  • Hard disk: 80 GB
  • Inodes: 1,600,000
  • Bandwidth: 100 Mbps (Monthly limit: 4 TB)

ソフトウェアバージョン(2018/5/17時点)

手順

以下、Time4VPSでサーバを借りてUbuntuをインストールした後からの手順。

以下、rootで実行。

ユーザ追加

adduser ryo
gpasswd -a ryo sudo
su - ryo

以下は追加したユーザで実行。

ビルド環境もろもろ準備

sudo apt update
sudo apt upgrade
sudo apt install -y build-essential git cmake automake autoconf libtool pkg-config software-properties-common

gcc 6を7に変更

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install -y gcc-7 g++-7
sudo apt clean 
sudo rm -rf /var/lib/apt/lists/* 
sudo rm /usr/bin/gcc /usr/bin/g++
sudo ln -s /usr/bin/gcc-7 /usr/bin/gcc
sudo ln -s /usr/bin/g++-7 /usr/bin/g++

install用ディレクトリ準備

C_HOME=$HOME/catapult
mkdir $C_HOME
C_LIBS=$C_HOME/libs
mkdir $C_LIBS

rocksdb(1時間くらい時間がかかる)

cd $C_LIBS
wget -O rocksdb-5.13.1.tar.gz https://github.com/facebook/rocksdb/archive/v5.13.1.tar.gz
tar zxvf rocksdb-5.13.1.tar.gz
cd rocksdb-5.13.1
$ make
sudo make install

boost(これも1時間くらい時間がかかる)

cd $C_LIBS
wget https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.gz
tar zxvf boost_1_65_1.tar.gz
cd boost_1_65_1
./bootstrap.sh
sudo ./b2 install -j2

gtest

cd $C_LIBS
wget -O googletest-release-1.8.0.tar.gz https://github.com/google/googletest/archive/release-1.8.0.tar.gz
tar zxvf googletest-release-1.8.0.tar.gz
cd googletest-release-1.8.0/googletest
mkdir _build
cd _build
cmake ..
make
sudo make install

libzmq

cd $C_LIBS
wget -O libzmq-4.2.3.tar.gz https://github.com/zeromq/libzmq/archive/v4.2.3.tar.gz
tar zxvf libzmq-4.2.3.tar.gz
cd libzmq-4.2.3
mkdir _build
cd _build
cmake ..
make
sudo make install

cppzmq

cd $C_LIBS
wget -O cppzmq-4.2.3.tar.gz https://github.com/zeromq/cppzmq/archive/v4.2.3.tar.gz
tar zxvf cppzmq-4.2.3.tar.gz
cd cppzmq-4.2.3
mkdir _build
cd _build
cmake ..
make
sudo make install

mongo-c-driver

cd $C_LIBS
wget https://github.com/mongodb/mongo-c-driver/releases/download/1.4.2/mongo-c-driver-1.4.2.tar.gz
tar zxvf mongo-c-driver-1.4.2.tar.gz
cd mongo-c-driver-1.4.2
./configure --disable-automatic-init-and-cleanup
make
sudo make install

mongo-cxx-driver

cd $C_LIBS
wget -O mongo-cxx-driver-r3.0.2.tar.gz https://github.com/mongodb/mongo-cxx-driver/archive/r3.0.2.tar.gz
tar zxvf mongo-cxx-driver-r3.0.2.tar.gz
cd mongo-cxx-driver-r3.0.2
mkdir _build
cd _build
cmake -DBSONCXX_POLY_USE_BOOST=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install

catapult-server(ようやく。でもこれからまた1時間以上かかる)

cd $C_HOME
git clone https://github.com/nemtech/catapult-server
cd catapult-server/
mkdir _build
cd _build
export PYTHON_EXECUTABLE=/usr/bin/python3
export BOOST_ROOT=/usr/local/include/boost
export GTEST_ROOT=/usr/local/include/gtest
export LIBMONGOCXX_DIR=/usr/local/lib/cmake/libmongocxx-3.3.0-rc0-pre
export LIBBSONCXX_DIR=/usr/local/lib/cmake/libbsoncxx-3.3.0-rc0-pre
export cppzmq_DIR=/usr/local/share/cmake/cppzmq
export ROCKSDB_ROOT_DIR=/usr/local/include/rocksdb
cmake -DCMAKE_BUILD_TYPE=RelWithDebugInfo \
-DCMAKE_C_FLAGS="-lpthread" \
-DCMAKE_MODULE_LINKER_FLAGS="-lpthread" \
-DCMAKE_SHARED_LINKER_FLAGS="-lpthread" \
-DBSONCXX_LIB:FILEPATH=/usr/local/lib/libbsoncxx.so \
-MONGOCXX_LIB:FILEPATH=/usr/local/lib/libmongocxx.so \
..
make publish && make
3
1
10

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1