- Blockchain By Example
- Bellaj Badr Richard Horrocks Xun (Brian) Wu
- 311字
- 2021-06-10 18:53:41
Building Bitcoin Core
As the dependencies are installed, we can build the code using autotools by running these commands in succession as follows:
./autogen.sh
./configure --with-gui=qt5 --enable-debug
sudo make
Pay attention to the space and double dash in front of both the options: with-gui and enable-debug.
It's common to supply some options to the configure command to change the final location of the executable program. You can explore the different possible options in the official documentation: https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.md.
As you may have noticed, we passed the configure file two arguments: --with-gui=qt5 to build the graphical interface, and --enable-debug to produce better debugging builds. If you want to build only a headless Bitcoin client, use --without-gui.
After running the make command, the initial compile will take quite a long time. Think about taking a coffee.
If all the dependencies have been installed correctly, a test compilation should be achieved successfully at the end of the compilation process. If you got an error somewhere, have a look at the compilation output to spot the error.
Now that the software is built and ready to run, you can optionally install it by running the following command:
sudo make install
This will add the Bitcoin commands to your PATH so that you can simply run bitcoin-qt or bitcoind to start the Bitcoin client without specifying the binary location. Keep in mind that you have to rerun make install each time you edit and compile your code in order to update your client.
Congratulations! You have compiled Bitcoin successfully from its source code.