Skip to content

BUILD_OS_X

bijianing97 edited this page Mar 6, 2020 · 16 revisions

OS X Build Instructions

===============================

  1. Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  1. Install dependencies:
brew update
brew install cmake wget git openssl autoconf automake doxygen libtool llvm@4
  1. Install boost 1.65
wget https://dl.bintray.com/boostorg/release/1.65.0/source/boost_1_65_0.tar.gz -O boost_1_65_0.tar.gz
tar -zxvf boost_1_65_0.tar.gz
cd boost_1_65_0 && chmod +x bootstrap.sh
./bootstrap.sh 
./b2 --buildtype=complete install toolset=clang cxxflags="-arch x86_64" linkflags="-arch x86_64" 
  1. Install llvm with wasm
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 -p 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 -j4 install
  1. Install leveldb and snappy (It does not need to be installed by default unless you compile the plugin version)
# install leveldb
wget https://github.com/google/leveldb/archive/v1.20.tar.gz
tar xvf v1.20.tar.gz
rm -f v1.20.tar.gz
cd leveldb-1.20
make
sudo scp -r out-static/lib* out-shared/lib* "/usr/local/lib"
cd include
sudo scp -r leveldb /usr/local/include
sudo ldconfig
# install snappy
git clone https://github.com/google/snappy.git
cd snappy
mkdir build
cd build && cmake ../ 
sudo make install
  1. Build GXB-Core:
git clone https://github.com/gxchain/gxb-core
cd gxb-core && git checkout master
git submodule update --init --recursive

export LLVM_DIR=/usr/local/Cellar/llvm@4/4.0.1_1/lib/cmake/llvm
export WASM_ROOT=~/opt/wasm
mkdir -p build &&  cd build
cmake -DLLVM_DIR=$LLVM_DIR -DWASM_ROOT=$WASM_ROOT -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib -DCMAKE_BUILD_TYPE=Release ..

#`query_txid` plugin is off normal state, if you want to start it ,you can add `-DLOAD_TXID_PLUGIN=ON`

make -j4
sudo make install
Clone this wiki locally