LoginSignup
3
4

More than 5 years have passed since last update.

monacoindをcentos7でコンパイルする

Last updated at Posted at 2014-09-14

monacoin のコンパイル

centos7にインストールするときに注意点が4つあります

  • opensslに必要なモジュールが組み込まれていないためソースからコンパイルする必要がある
  • miniupnpをインストール時に場所の指定をする必要がある
  • berkeleydbをコンパイル時にオプション指定する必要がある
  • monacoinコンパイル時にオプション指定する必要がある

1.yumでインストール

yum install -y git gcc gcc-c++ boost-* zlib-devel

2.opensslをダウンロードしてインストール

wget http://www.openssl.org/source/openssl-1.0.1i.tar.gz
tar zxvf openssl-1.0.1i.tar.gz 
cd openssl-1.0.1i
./config 
make
make install
cd ..

3.miniupnpをダウンロードしてインストール

git clone https://github.com/miniupnp/miniupnp.git
cd miniupnp/miniupnpc
make
LIBDIR=lib64 make install
cd ../..

4.berkeleydbをダウンロードしてインストール

wget http://download.oracle.com/berkeley-db/db-4.8.30.tar.gz
tar zxvf db-4.8.30.tar.gz
cd db-4.8.30/build_unix
../dist/configure --enable-static --enable-cxx --prefix=/usr/local --libdir=/usr/local/lib64 --disable-shared
make
make install
cd ../..

5.monacoinをダウンロードしてインストール

git clone https://github.com/monacoinproject/monacoin.git
cd monacoin/src
CXXFLAGS="-I/usr/local/ssl/include" LDFLAGS=-L/usr/local/ssl/lib make -f makefile.unix BOOST_LIB_SUFFIX=-mt

6.起動確認する

./monacoind -rpcuser=hoge -rpcpassword=hogehoge

特にエラー終了しないかどうか確認して問題なければコンパイル完了です。
enjoy

コンパイルエラーが出たとき

g++ -c -O2 -pthread -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -g -DBOOST_SPIRIT_THREADSAFE -D_FILE_OFFSET_BITS=64 -I/root/monacoin/src -I/root/monacoin/src/obj -DUSE_UPNP=0 -DUSE_IPV6=1 -I/root/monacoin/src/leveldb/include -I/root/monacoin/src/leveldb/helpers -DHAVE_BUILD_INFO -fno-stack-protector -fstack-protector-all -Wstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -I/usr/local/ssl/include -MMD -MF obj/bitcoinrpc.d -o obj/bitcoinrpc.o bitcoinrpc.cpp
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
make: *** [obj/bitcoinrpc.o] Error 4

メモリ不足なのでスワップを追加する(メモリ1Gだと出ます)
その場合はswapを追加します
以下のコマンドで追加可能

dd if=/dev/zero of=/swap bs=1024 count=1000000
mkswap /swap
swapon /swap

スワップを追加すると以下のような感じになる

[root@vultr src]# free
             total       used       free     shared    buffers     cached
Mem:       1017872     160280     857592      13296       2616      45528
-/+ buffers/cache:     112136     905736
Swap:            0          0          0
[root@vultr src]# swapon /swap 
swapon: /swap: insecure permissions 0644, 0600 suggested.
[root@vultr src]# free
             total       used       free     shared    buffers     cached
Mem:       1017872     162132     855740      13296       2636      46380
-/+ buffers/cache:     113116     904756
Swap:       999996          0     999996
3
4
0

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
4