Version 1 (modified by andreasw, 15 years ago) (diff)

first draft - to be continued after break

Preparing the Compilation

Here we only describe the configuration procedure on UNIX-like systems (including Linux, Cygwin, and MSys), where the user can run the configure script. If you are using the MS Developer Studio, you are referred to the MSDevStudio project page.

Running the configure script

Before you can compile the source code using make, the Makefiles have to be created, so that they contain the correct compiler names and options, as well as other system dependent information. To this purpose, the shell scripts configure in the package's base directory (e.g., Coin-Clp) and in the projects main directories (such as Coin-Clp/CoinUtils) perform a number of tests and creates the final Makefiles. In addition, the configure script usually creates a header file (such as inc/config_clp.h) for the individual packages, which contains #defines to help the source code to adapt to different platforms.

To run the configuration scripts, you go into base directory of the downloaded COIN package (e.g., Coin-Clp), and type


This picks default settings for compilers and compiler options. You can change some aspects of the configuration by providing arguments to the configuration script, see below.

Giving Options to the configure script

There are two types of arguments that can be given to the configure script. The first set of arguments have the form of regular command line options, such as --enable-debug or -C. The second set of options works through variables, and they can be provided either on the command line, or can be set as environment variables.

An alternative to providing configuration options through the command line is the file, see below.

For most COIN packages, several configuration scripts are run recursively. You need to specify the options for all subprojects (e.g., Clp and CoinUtils) when you run the case configure script, since they are given to the subconfigure scripts.

You can see a list of all available (documented) options by running

./configure --help=recursive

Command Line Arguments for configure

The command line arguments are given to configure simply as additional arguments for to the command line. Some common arguments are described here, but there might be additional options that you can find on the home pages for the individual COIN projects.

  • -C: Makes configure use a cache file to speed up the tests when they been performed earlier. If you rerun configure with different options (so that the results of tests might change), you should delete the config.cache file before the rerun.
  • --prefix: By default, the binaries and header files are installed (by make install) into bin, lib, and include directories of where the main configuration scripts was run. If you prefer to have make install install in a different location (such as $HOME), you need to use this option, e.g., with --prefix=$HOME.
  • --enable-debug: This causes configure to select the debug compiler options. It also defines the preprocessor macro COIN_DEBUG, which in some source code is use to activate additional time-consuming consistency tests.
  • --enable-static: By detault, the COIN libraries are compiled as shared libraries or DLLs, at least on platforms that support this. If you want to also have static libraries to be generated as well, you need to specify this option.
  • --disable-shared: If you want only static libraries to be compiled and no shared objects or DLLs, you should speficy this option.
  • --with-gnu-packages: Some of the COIN projects can make use of GNU packages (such as zlib, bzlib, or readline). Since those are usually provided under the GPL license, which has rather strong conditions, the configuration scripts do not check for the availability of those packages by default. If you want to compile the COIN code so that it uses those packages, you need to provide this option.
  • Further options of the form --enable-... and with-... might be understood by the configuration scripts for specific COIN projects. For example, if you want to tell the Open Solver Interface (OSI) that you want to compile the CPLEX solver interface, you need to specify the --with-clp-lib and --with-clp-incdir options with the appropriate values. If such a value consists of more than one word (e.g., -L/opt/cplex -lcpx), you need to enclose it in quotation marks.

A typical call for the configuration script would then look like

./configure --with-cplex-lib="L/opt/cplex -lcpx" --with-cplex-incdir=/opt/cplex/include --enable-static -C

Variable Arguments for configure

Other options, usually related to compilation configuration (such as compiler name and options) can be set as variables. The values for those variables can be either provided as environment variables (e.g., set in your shell startup script), or on the command line. Values set on the command line overwrite values set in the environment. If you want to set the value of a variable (such as CXX) in the comamnd line for configure, you simply list the variable, follow immediately by an = and the value, possibly enclosed in quotation marks (such as CXX="cl").