COIN-OR::LEMON - Graph Library

Version 2 (modified by Alpar Juttner, 11 years ago) (diff)


Installation Instructions

This file contains instructions for building and installing LEMON from source on Linux. The process on Windows is similar.

Note that it is not necessary to install LEMON in order to use it. Instead, you can easily integrate it with your own code directly. For instructions, see

In order to install LEMON from the extracted source tarball you have to issue the following commands:

  1. Step into the root of the source directory.
      $ cd lemon-x.y.z
  1. Create a build subdirectory and step into it.
      $ mkdir build
      $ cd build
  1. Perform system checks and create the makefiles.
      $ cmake ..
  1. Build LEMON.
      $ make 

This command compiles the non-template part of LEMON into libemon.a file. It also compiles the programs in the 'tools' and 'demo' subdirectories.

  1. [Optional] Compile and run the self-tests.
      $ make check
  1. [Optional] Generate the user documentation.
      $ make html

The release tarballs already include the documentation.

Note that for this step you need to have the following tools installed: Python, Doxygen, Graphviz, Ghostscript, LaTeX.

  1. [Optional] Install LEMON
      $ make install

This command installs LEMON under /usr/local (you will need root privileges to be able to do that). If you want to install it to some other location, then pass the -DCMAKE_INSTALL_PREFIX=DIRECTORY flag to cmake in Step 3. For example:

$ cmake -DCMAKE_INSTALL_PREFIX=/home/username/lemon'

Configure Options and Variables

In Step 3, you can customize the build process by passing options to CMAKE.

$ cmake [OPTIONS] ..

You find a list of the most useful options below.


Set the installation prefix to PREFIX. By default it is /usr/local.


This sets the compiler options. The choices are the following

Release: A strong optimization is turned on (-O3 with gcc). This

is the default setting and we strongly recommend using this for the final compilation.

Debug: Optimization is turned off and debug info is added (-O0 -ggdb with gcc). If is recommended during the development.

Maintainer: The same as 'Debug' but the compiler warnings are

converted to errors (-Werror with gcc). In addition, make will also automatically compile and execute the test codes. It is the best way of ensuring that LEMON codebase is clean and safe.

RelWithDebInfo: Optimized build with debug info.

MinSizeRel: Size optimized build (-Os with gcc)


Using this, the test codes will be executed using valgrind. It is a very effective way of identifying indexing problems and memory leaks.


Change the compiler to be used.


Build shared library instead of static one. Think twice if you really want to use this option.


Include the browsable cross referenced LEMON source code into the doc. It makes the doc quite bloated, but may be useful for developing LEMON itself.


Use MathJax ( for rendering the math formulae in the doc. It of much higher quality compared to the default LaTeX generated static images and it allows copy&paste of the formulae to LaTeX, Open Office, MS Word etc. documents.

On the other hand, it needs either Internet access or a locally installed version of MathJax to properly render the doc.


The location of the MathJax library. It defaults to, which necessitates Internet access for proper rendering. The easiest way to make it usable offline is to set this parameter to mathjax and copy all files of the MathJax library into the 'doc/html/mathjax' subdirectory of the build location.

See for more details.


Enable optional third party libraries. They are all enabled by default.


Sets the default LP solver backend. The supported values are CPLEX, CLP and GLPK. By default, it is set to the first one which is enabled and succesfully discovered.


Sets the default MIP solver backend. The supported values are CPLEX, CBC and GLPK. By default, it is set to the first one which is enabled and succesfully discovered.


Root directory prefixes of optional third party libraries.

Makefile Variables

$ make VERBOSE=1

This results in a more verbose output by showing the full compiler and linker commands.