GNU Astronomy Utilities

Next: , Previous: , Up: Developing   [Contents][Index]

11.6 Building and debugging

To build the various programs and libraries in Gnuastro, the GNU build system is used which defines the steps in Quick start. It consists of GNU Autoconf, GNU Automake and GNU Libtool which are collectively known as GNU Autotools. They provide a very portable system to check the hosts environment and compile Gnuastro based on that. They also make installing everything in their standard places very easy for the programmer. Most of the small caps files that you see in the top source directory of the tarball are created by these three tools (see Version controlled source). To facilitate the building and testing of your work during development, Gnuastro comes with two useful scripts:


This is more fully described in Configure and build in RAM. During development, you will usually run this command only once (at the start of your work).


This script is designed to be run each time you make a change and want to test your work (with some possible input and output). The script itself is heavily commented and thoroughly describes the best way to use it, so we won’t repeat it here.

As a short summary: you specify the build directory, an output directory (for the built program to be run in, and also contains the inputs), the program’s short name and the arguments and options that it should be run with. This script will then build Gnuastro, go to the output directory and run the built executable from there. One option for the output directory might be your desktop, so you can easily see the output files and delete them when you are finished. The main purpose of these scripts is to keep your source directory clean and facilitate your development.

By default all the programs are compiled with optimization flags for increased speed. A side effect of optimization is that valuable debugging information is lost. All the libraries are also linked as shared libraries by default. Shared libraries further complicate the debugging process and significantly slow down the compilation (the make command). So during development it is recommended to configure Gnuastro as follows:

$ ./configure --disable-shared CFLAGS="-g -O0"

These options to configure are already included in tmpfs-config-make, you just have to un-comment them when you want to start developing or debugging.

In order to understand the building process, you can go through the Autoconf, Automake and Libtool manuals, like all GNU manuals they provide both a great tutorial and technical documentation. The “A small Hello World” section in Automake’s manual (in chapter 2) can be a good starting guide after you have read the separate introductions.

Next: , Previous: , Up: Developing   [Contents][Index]