Node Compilation and Building
Compiling and building node binary from source code.
This article explains how to build node binary files from source code and run them for the first time. If you do not need to compile, you can skip this chapter and go directly to the Node Startup Section.
Preparation of the Compilation Environment
Currently, the node software can only be built on Ubuntu 20.04 LTS. Please ensure the version number is correct, as higher versions are not supported yet (due to compilation errors). If your operating system is not Ubuntu 20.04 LTS, you can use Docker to compile the node software (refer to subsequent content). Plans are in place to support more operating systems.
Note, the building process is resource-intensive, and it is recommended to build on a machine with at least a 2-core CPU and 4GB of memory. The machine used for testing in this article is an AWS EC2 m5.xlarge instance with a 4-core CPU and 16GB of memory (Ubuntu 20.04 LTS).
Installing Dependencies
Building C++ code requires the following software packages. Use apt-get to install the necessary dependencies:
Copy and execute the following command:
Download Source Code and Compile
Ensure that your build environment has more than 1.5GB of available memory; otherwise, the compilation process may fail. Depending on your machine's configuration, this step could take several minutes to several hours.
Execute the following commands step by step:
The build log is as follows (you can compare to check if the configuration and actual execution match):
After executing make
, if everything goes smoothly, you will see three binary files in the src directory: mvcd
, mvc-cli
, and mvc-tx
. These files are the node program, node command line tool, and transaction tool, respectively.
After completing make install
, you will find these binary files in the specified directory (/home/$USER/mvc/bin), indicating a successful compilation. At this point, you can directly run the node program, or proceed with further actions such as Docker building.