Build
Build Tools
Linux environment configuration refer to Dockerfile
- Ubuntu 20.04
- CentOS 7
apt update
apt install -y python3 python3-dev gcc-8 g++-8 python-dev libgmp-dev cmake libmysqlclient-dev
apt install -y automake ca-certificates git libtool m4 patch pkg-config unzip make wget curl zip ninja-build npm
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8
npm install -g @bazel/bazelisk
yum -y install epel-release
yum -y install python-devel gmp-devel centos-release-scl libtool ninja-build git npm make
yum -y install devtoolset-8-gcc*
yum -y install rh-python38 rh-python38-python-devel
echo "source /opt/rh/devtoolset-8/enable" >> /etc/profile
echo "source /opt/rh/rh-python38/enable" >> /etc/profile
source /etc/profile
npm install -g @bazel/bazelisk
# Check the version of libstdc++.so.6, if it is the default 6.0.19, you need to upgrade the version
ls -l /usr/lib64/libstdc++.so.6
wget https://primihub.oss-cn-beijing.aliyuncs.com/tools/libstdc.so_.6.0.26.zip
unzip libstdc.so_.6.0.26.zip
mv libstdc++.so.6.0.26 /usr/lib64
rm -f /usr/lib64/libstdc++.so.6
ln -s /usr/lib64/libstdc++.so.6.0.26 /usr/lib64/libstdc++.so.6
Get the code
git clone https://github.com/primihub/primihub.git
Build
- Linux & MacOS
- Windows
- Docker
Linux & MacOS
- Linux Environment: gcc-8,g++-8,python3.7 and higher,python3.7-dev,cmake-3.20
- Mac Environment: clang 12+,python3.7 and higher,cmake-3.20
./pre_build.sh
make
After build compiling, execute the following command in the root directory of the code to start the node, and its related logs are saved in log_node0, log_node1, log_node2 files respectively
bash start_server.sh
Check the logs, the following will start normally
# tail -f log_node0
...
I20230619 18:53:17.816563 29477 grpc_impl.cc:49] PutMeta to node: [:127.0.0.1:7977:0:] rpc succeeded.
I20230619 18:53:17.817224 29477 main.cc:55] server runing in no tls mode
I20230619 18:53:17.818142 29477 main.cc:86] 💻 Node listening on port: 50050
Windows
Not supported yet, you can use WSL
Docker
Use the Dockerfile in the root directory to build the docker image
docker build -t primihub/primihub-node .
If the dependencies can't be downloaded during build
, you can add a proxy to build
by running the following command
docker build --build-arg "HTTP_PROXY=http://your proxy address" --build-arg "HTTPS_PROXY=http://your proxy address" -t primihub/primihub-node .
When building docker images on Apple M1 devices, bazel 5.0.0 will cause build errors, which is a bug in bazel. Specific question see bazel github issue #13925, Need to modify the code .bazelvsersion file contents of 4d900ceea12919ad62012830a95e51f9ec1a48bb
Build FAQ
- Bazel build new platform and toolchain issues seeHere