To build from source, binary or tarball?

By | May 2, 2016

It’s a lot quicker and less hassle to build from a tarball but lets face it, it’s just not as fun :). Let’s go through a simple sample process.

There is an open source code call cpuminer that turns your computer into a bitcoin miner. Back in the days, this is how bitcoin mining all started.

Getting the code

Google searching cpuminer will turn up 2 main links.

  • – executable binary
  • – tarball
  • – source code

If you download the binary you can run the code straight away. If you use the tarball, it contains all the files and dependencies you need. If you want a challange, grab a copy of the source code. If you have git, you can run:

> git clone

The First Step

Once you have the code, the first thing you want to do is to find the README file. Look for instructions on how to build it build the code based on your OS. I’ll focus on:

Basic *nix build instructions:
./ # only needed if building from git repo
./ # only needed if building on Mac OS X or with Clang
./configure CFLAGS=”-O3″

If you run ./ you should see this error: error: possibly undefined macro: AC_MSG_ERROR If this token and others are legitimate, please use m4_pattern_allow.  See the Autoconf documentation.

Running ./ should result in no error and running ./configure CFLAGS=”-O3″ should result in this error:

checking for pthread_create in -lpthread... yes
./configure: line 5623: syntax error near unexpected token `,'
./configure: line 5623: `LIBCURL_CHECK_CONFIG(, 7.15.2, ,'

The error from ./configure has been documented in a few places. Particularly:


The advice from the links above is to build from a tarball which is appropriate. However, if you want to dig deeper, you need to do the following:

Create a folder called m4

Create a folder called m4 and copy a file called libcurl.m4 into this directory. Then add string “ACLOCAL_AMFLAGS = -I m4” to file and edit file – replace string “aclocal” with “aclocal -I m4”.


Run brew install curl to install curl on your Mac. You should find libcurl.m4 in this location:


Once you have done this, run all the commands again starting from ./ and the code should compile.

If you want to run in debug mode via gdb, add the -g flag.

> ./configure CFLAGS="-g -O0"

This means you can then do gdb minerd

To execute the code, you’ll want to run something like this:

> ./minerd -0 url_of_your_pool -t 1 -u username -p password

For more info check out:

Leave a Reply

Your email address will not be published. Required fields are marked *