Scroll to navigation



BuildProgram - compile, link with Gnuastro library and its dependencies, and run a C program


astbuildprog [OPTION...] C-source [ARGUMENTS TO RUN]


BuildProgram is part of GNU Astronomy Utilities 0.14. BuildProgram will compile and run a C program, while automatically linking with libraries that Gnuastro depends on. Hence you do not have to worry about explicitly linking with CFITSIO for example if you want to work on a FITS file, or with GSL if you want to use GNU Scientific Library's functions. The standard compiler options of '-I', '-L', and '-l' are also available for further customization of the build.

For more information, please run any of the following commands. In particular the second contains a very comprehensive explanation of BuildProgram's invocation: expected input(s), output(s), and a full description of all the options.

All options and their values:
$ astbuildprog -P
Inputs/Outputs and options:
$ info astbuildprog
Full section in manual/book:
$ info BuildProgram
Full Gnuastro manual/book:
$ info gnuastro

If you couldn't find your answer in the manual, you can get direct help from experienced Gnuastro users and developers. For more information, please run:

$ info help-gnuastro

BuildProgram options:

-a, --la=STR
Libtool '.la' to use instead of default.
-c, --cc=STR
Name of C compiler's executable.
-e, --noenv
No env. (e.g., LDFLAGS or CPPFLAGS) in build.
-I, --includedir=STR
Directories to search for '#include's.
-l, --linklib=STR
Link libraries, e.g., for libgsl: '-lgsl'.
-L, --linkdir=STR
Directory to search for libraries to link.
-t, --tag=STR
Libtool '--tag': programming language.
-b, --onlybuild
Don't run the built program.
-d, --deletecompiled
Delete compiled program after running.
-D, --dontdelete
Don't delete output if it exists.
-g, --debug
Debugging information in compiled binary.
-K, --keepinputdir
Keep input directory for automatic output.
-o, --output=STR
Output file name.
-O, --optimize=INT
Optimization level: 0, 1, 2, 3.
-W, --warning=STR
Compilation warnings on command-line.
Operating modes:
-?, --help
give this help list
List all config files and variables read.
BibTeX citation for this program.
Read configuration file STR immediately.
Do not parse any more configuration files.
Minimum bytes in array to not use ram RAM.
Only run if the program version is STR.
-P, --printparams
Print parameter values to be used and abort.
Don't print mmap'd file's name and size.
-q, --quiet
Only report errors, remain quiet about steps.
-S, --setdirconf
Set default values for this directory and abort.
give a short usage message
-U, --setusrconf
Set default values for this user and abort.
-V, --version
print program version

Mandatory or optional arguments to long options are also mandatory or optional for any corresponding short options.

GNU Astronomy Utilities home page:


Report bugs to


Copyright © 2015-2021, Free Software Foundation, Inc. License GPLv3+: GNU General public license version 3 or later.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

Written/developed by Mohammad Akhlaghi


The full documentation for BuildProgram is maintained as a Texinfo manual. If the info and BuildProgram programs are properly installed at your site, the command
info BuildProgram

should give you access to the complete manual.

January 2021 GNU Astronomy Utilities 0.14