Version 2 (modified by anonymous, 16 years ago) (diff)


Compiling and Installing the Package

These instructions only pertain to UNIX-like systems, where the configure scripts can be run. If you want to use the MS Developer Studio to compile the code, please see the MSDevStudio project page.

Compiling the Code

Assuming that the configure script ran successfully, you can compile the source code, including all subprojects, by typing


The COIN Makefiles should work with any UNIX make. If you are using GNU make and want to use the parallel compilation feature, you can do this by specifying the -j N option to make, where N is the number of parallel compilations you want to start. A good value for N is the number of available processors plus 1.

If the compilation fails, the screen output hopefully helps you to find out what is going wrong. The output is quite verbose, and you see all command lines that are executed. Since most of the COIN Makefiles are generated with the GNU packages automake and libtool they are very complicated and might look confusing. Unless you know what you are doing, it not easy to change the Makefiles. If you want to make modifications, you should modify the files and use the GNU autotools to generate the real Makefile.

Testing the Compilation

Most of the COIN packages provide a unit test (in the test subdirectory), which can be used to verify if the compiled code works correctly. If you want to test the compilation for the main project only (i.e., Clp in our example) you type

make test

If you want to run the tests for all subprojects (i.e., CoinUtils and Clp in our example), you can do that with

make tests

This will run the unit test in all COIN projects that have one.

You don't need to type make before running make test or make tests.

Installing the Executables, Libraries and Header Files

To install the final product of the compilation, i.e., the reason you are doing all this, you type

make install

Again, you don't need to type make first. This will install the executable files in $prefix/bin, the libraries in $prefix/lib, and the header files in $prefix/include. Here, $prefix stands for the installation directory, which by default is the directory where you ran the configure script. The installation directory is otherwise the argument you specified with the --prefix argument for configure.

In the lib directory you will also see *_addlibs.txt files (such as clp_addlibs.txt). This contains a string with additionally required libraries (such as -lz if you are using the zlib GNU package), adapted to your system and configuration settings. If you link with an installed COIN library, you should also specify the context of the corresponding *_addlibs.txt file in the link command.

Some COIN projects come with examples that show how a generated library can be used. In that case, in the example subdirectory for the project, you will find a simple Makefile to compile the examples, adapted to your settings. If you want to link your own code with a COIN library, it is probably best to start with this Makefile; read more here.

Further Makefile Targets

Additional targets that can be specified in a "make" command are

  • clean: This deletes all objects.
  • distclean: This deletes everything that has been created since running the {{{configure}} script, except for installed files.
  • uninstall: This deletes all files that have been previously copied by a make install.
  • dist: This creates a source code tarball for the COIN package.