LEMON Tutorial  59
3 Installation Guide

In this section we detail how to start using LEMON, from downloading it to your computer, through the steps of installation, to showing how to compile programs that use LEMON. We assume that you have a basic knowledge of your operating system and C++ programming language. The procedure is pretty straightforward, but if you have any difficulties do not hesitate to ask.

In fact, LEMON provides two different build environments, one is based on autotool while the other is based on cmake. Your choise will mainly depend on the operation system you use - choose the autotool based one on Linux and other Unices, while use the cmake based one on M$ Windows.

3.2 Install on Linux/Unix (using autotool)

3.1 Hardware and Software Requirements

In LEMON we use C++ templates heavily, thus compilation takes a considerable amount of time and memory. So some decent box would be advantageousm, but otherwise there are no special hardware requirements.

You will need a recent C++ compiler. Our primary target is the GNU C++ Compiler (g++), from version 3.3 upwards. We also checked the Intel C++ Compiler (icc) and Microsoft Visual C++ (on Windows). If you want to develop with LEMON under Windows, you can use a Windows installer or you can consider using Cygwin.

In this description we will suppose a Linux environment and GNU C++ Compiler. If you would like to develop under Windows and use a Windows installer, you could skip the following sections and continue reading basic_concepts. However keep in mind that you have to make appropriate steps instead of the instructions detailed here to be able to use LEMON with your compiler.

3.1.1 LP Solver Requirements

The LEMON LP solver interface can use the GLPK (GNU Linear Programming Kit), CPLEX and SoPlex solver. If you want to use it, you will need at least one of these. See the INSTALL file how to enable these at compile time.

3.2.1 Install from Source

You can download LEMON from the web site: http://lemon.cs.elte.hu/. There you will find released versions in form of .tar.gz files (and Windows installers). If you want a developer version (for example you want to contribute in developing LEMON) then you might want to use our Mercurial repository. This case is detailed later, so from now on we suppose that you downloaded a .tar.gz file.

Thus you have to do the following steps.

Download the tarball either from the browser or just issuing

wget http://lemon.cs.elte.hu/pub/sources/lemon-1.0.tar.gz
The tarball is named lemon-x.y.z.tar.gz where x, y and z (which is missing if it is 0) are numbers indicating the version of the library, in our example we will have lemon-1.0.tar.gz.

Then issue the following commands:

tar xvzf lemon-1.0.tar.gz
cd lemon-1.0
make check    # This is optional, but recommended. It runs a bunch of tests.
make install

These commands install LEMON under /usr/local (you will need root privileges to be able to install to that directory). If you want to install it to some other place, then pass the –prefix=DIRECTORY flag to ./configure, for example:

./configure --prefix=/home/username/lemon

We briefly explain these commands below.

tar xvzf lemon-1.0.tar.gz

This command untars the tar.gz file into a directory named lemon-1.0.

cd lemon-1.0

This command enters the directory.


This command runs the configure shell script, which does some checks and creates the makefiles.


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

make check

This step is optional, but recommended. It performes a bunch of library self-tests.

make install

This command will copy the directory structure to its final destination (e.g. to /usr/local) so that your system can access it. This command should be issued as "root", unless you provided a –prefix switch to the configure to install the library in non-default location.

Several other configure flags can be passed to ./configure. For more information see the INSTALL file.

3.2.2 Install the Latest Development Version

You can also use the latest (developer) version of LEMON from our Mercurial repository. You need a couple additional tool for that.

Once you have all these tools installed, the process is fairly easy. First, you have to get the copy of the latest version.

hg clone http://lemon.cs.elte.hu/hg/lemon-main lemon-src

The next step is to initialize the build system.

autoreconf -vif

Then the process is the same as in case of using the release tarball.

make install

To generate the documentation, just run

make html
Is make html really necessary after make install?

3.2.3 Install from rpm

Write this section (3.2.3 Install from rpm).

3.2.4 Install Locally to the User

Write this section (3.2.4 Install Locally to the User).

3.3 Install on Windows (from source, with CMAKE)

First, you should obtain and extract the source code. You can either use the mercurial repository, or use the following links.

You must also dowload and install CMake 2.6.2 (.exe installer) or later.

Finally - assuming you use a recent version of use Visual Studio - start a "Visual Studio Command Prompt" from the start menu. Then, in the command prompt, step into the extraced LEMON source directory and type in the following commands.

mkdir build
cd build
cmake -G "NMake Makefiles"
nmake install

3.4 Compile Codes that Use LEMON

Now let us see how to use the library after installing it.

3.4.1 If LEMON is Installed System-Wide

If your installation of LEMON into directory /usr/local was successful, then you have to issue a command like this to compile a source file that uses LEMON.

g++ -lemon [other options] <source file>

The argument -lemon tells the compiler that we are using the installed library LEMON.

3.4.2 If LEMON is Installed User-Local

You have to give more options to the compiler if LEMON is installed user-local into a directory (denoted by <dir>).

g++ -lemon -I <dir>/include -L <dir>/lib [other options] <source file> Use pkg-config

Write this sub-subsection ( Use pkg-config).

<< hello_lemon | Home | License Terms >>