EOS Build Guide on Ubuntu (Updated)

eos.jpeg

Update: Added GMP installation

This is a brief guide of building EOS on Ubuntu 16.04 LTS (Google Compute Engine). I haven't tested on other versions yet. If you verify this instruction works in other versions, please comment. Reporting missing parts and wrong commands is really appreciated too.

우분투 16.04 LTS 버전에서 EOS를 빌드하는 법을 정리해봤습니다. 구글 컴퓨트 엔진 기반으로 테스트했는데, 혹시 다른 버전에서도 동작하는 것을 확인하시면 댓글로 남겨주시면 감사하겠습니다.

Preparation

screen -S compile # Optional
sudo -i # Enter root

Install Dependencies

DEBIAN_FRONTEND=noninteractive apt-get install -y sudo wget net-tools ca-certificates unzip
echo "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main" >> /etc/apt/sources.list.d/llvm.list
wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y git-core automake autoconf libtool build-essential pkg-config libtool \
    mpi-default-dev libicu-dev python-dev python3-dev libbz2-dev zlib1g-dev libssl-dev \
    clang-4.0 lldb-4.0 lld-4.0
rm -rf /var/lib/apt/lists/*
update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-4.0/bin/clang 400
update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-4.0/bin/clang++ 400

Install cmake 3.9

cd /tmp
wget https://cmake.org/files/v3.9/cmake-3.9.0-Linux-x86_64.sh
mkdir /opt/cmake && chmod +x /tmp/cmake-3.9.0-Linux-x86_64.sh
sh /tmp/cmake-3.9.0-Linux-x86_64.sh --prefix=/opt/cmake --skip-license
ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake

Install boost 1.64

cd /tmp && wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.gz
tar zxf boost_1_64_0.tar.gz
cd boost_1_64_0
./bootstrap.sh --with-toolset=clang
./b2 -a -j$(nproc) stage release -sHAVE_ICU=1 --sICU_PATH=/usr
./b2 install --prefix=/usr
rm -rf /tmp/boost_1_64_0*

Install secp256k1-zkp from cryptonomex repo

cd /tmp
git clone https://github.com/cryptonomex/secp256k1-zkp.git
cd secp256k1-zkp
./autogen.sh
./configure
make
make install
ldconfig
rm -rf /tmp/secp256k1-zkp*

Install WASM compiler

cd /tmp && mkdir wasm-compiler && cd wasm-compiler
git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/llvm.git
cd llvm/tools && git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/clang.git
cd .. && mkdir build && cd build
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/opt/wasm -DLLVM_TARGETS_TO_BUILD= \-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly -DCMAKE_BUILD_TYPE=Release ../
make -j$(nproc) install
rm -rf /tmp/wasm-compiler

Install GMP

cd /tmp
wget https://gmplib.org/download/gmp/gmp-6.1.2.tar.bz2
tar -xvf gmp-6.1.2.tar.bz2 && cd gmp-6.1.2
./configure && make && sudo make install
make check
rm -rf /tmp/gmp-6.1.2

Exit root

exit

Install EOS software

cd ~/
git clone https://github.com/EOSIO/eos.git --recursive
cd eos && mkdir build && cd build
WASM_LLVM_CONFIG=/opt/wasm/bin/llvm-config cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/opt/eos ..
make -j$(nproc)
sudo make install
sudo cp ./programs/eosd/eosd /usr/bin/eosd    # Optional
sudo cp ./programs/eosc/eosc /usr/bin/eosc    # Optional
cp ../genesis.json ~/    # Move genesis.json to your home directory

Modify config.ini

cd ~/
eosd    # Ctrl+C after run to create config file
nano ./data-dir/config.ini

The following elements should be modified or added

# Modify
genesis-json = "/home/YOURACC/genesis.json"    # Uncomment and make sure your home directory is correct
enable-stale-production = true    # From false to true

# Add
producer-name = inita
producer-name = initb
producer-name = initc
producer-name = initd
producer-name = inite
producer-name = initf
producer-name = initg
producer-name = inith
producer-name = initi
producer-name = initj
producer-name = initk
producer-name = initl
producer-name = initm
producer-name = initn
producer-name = inito
producer-name = initp
producer-name = initq
producer-name = initr
producer-name = inits
producer-name = initt
producer-name = initu
plugin = eos::producer_plugin
plugin = eos::chain_api_plugin    # To run eosc

Run eosd

screen -S eosd
eosd

Run eosc

eosc info

See these documents for details of eosc

https://eosio.github.io/eos/group__eosc.html
https://github.com/EOSIO/eos/issues/97

Note: Example contracts are located in ~/eos/contracts, for instance,

eosc setcode currency ./eos/contracts/currency/currency.wast ./eos/contracts/currency/currency.abi

You can see my yesterday's post about executing example contracts Here

H2
H3
H4
3 columns
2 columns
1 column
30 Comments