2 min read

How to set up an IDE for developing Bitcoin Core on Linux

First steps into Bitcoin Core software development.
How to set up an IDE for developing Bitcoin Core on Linux

Recently I decided that browsing the Bitcoin Core source code in a text editor was not sufficient; I wanted to leverage the features of a full-fledged Integrated Development Environment. Since I’ve been doing Java development for the past several years, I decided to try loading the Bitcoin Core project into Eclipse CDT. This turned out to be a mistake. After struggling with Eclipse for some time, I tried out NetBeans and had it running smoothly in minutes. Here’s a walkthrough for the process of getting your development environment set up if you’re running Linux.

First you’ll need to grab a checkout of the Bitcoin Core software from Github, or alternatively fork the Bitcoin Core project. Gavin Andresen has posted instructions for how to fork Bitcoin Core.

jameson@lopp:~/workspace/$ git clone https://github.com/bitcoin/bitcoin.git Cloning into ‘bitcoin’…
remote: Reusing existing pack: 35655, done.
remote: Total 35655 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (35655/35655), 26.56 MiB | 2.37 MiB/s, done. Resolving deltas: 100% (25766/25766), done.
Checking connectivity… done

Now you need to make sure you have the dependencies required to build Bitcoin Core. Run the appropriate commands for your Linux distribution that are listed here. These instructions are most helpful if you are running Ubuntu or Debian; if you run a different distributions of Linux then you’ll need to navigate your package manager on your own. Once you think you have all of the dependencies installed, build the project just to make sure.

jameson@lopp:~/$ cd /path/to/workspace/bitcoin/
jameson@lopp:~/workspace/bitcoin/$ ./autogen.sh
jameson@lopp:~/workspace/bitcoin/$ ./configure
jameson@lopp:~/workspace/bitcoin/$ make

It may take 20+ minutes to build, depending upon your computer’s specs. If you’re missing a dependency, you should receive an error noting what is missing.

Now you’re ready to install an IDE. You can download the C/C++ bundle of NetBeans from https://netbeans.org/downloads/

Navigate to your download directory in a terminal and run the following commands:

jameson@lopp:~/Downloads$ chmod 755 netbeans-8.0-cpp-linux.sh
jameson@lopp:~/Downloads$ ./netbeans-8.0-cpp-linux.sh
Configuring the installer…
Searching for JVM on the system…
Extracting installation data…
Running the installer wizard…

Work your way through the Installer Wizard that pops up. Once completed, run NetBeans. Select File => New Project => C/C++ Project with Existing Sources => Next then select your Bitcoin Core checkout directory. NetBeans will build the project and then run a code analysis. Now you’re ready to start developing!

If you’re running OS X, you may be able to get Eclipse CDT working with minimal effort by following Gubatron’s guide. Unfortunately, I was never able to get Eclipse’s code analysis completely working. It was unable to resolve the berkeleydb and QT related classes, even though I specifically added the appropriate “include” directories to those libraries.

It’s worth noting that using an IDE for Bitcoin Core development does not appear to be standard practice. I asked several of the Bitcoin Core developers and they all responded saying that they use text editors.

There you have it. Using an IDE is a matter of personal preference; I, for one, appreciate having a wider array of tools at my disposal. I spent so much time wrestling with Eclipse that I felt compelled to write this guide. If anyone out there is successful in setting up the Bitcoin Core project in Eclipse CDT on Ubuntu, please contact me!