GLPK/Compiling GLPK

Many users prefer to compile GLPK from scratch &mdash; although pre-compiled binaries are often available for Windows systems, for Debian and Red Hat-based Linux distros, and perhaps for other platforms. The advantages of manual compilation are listed shortly.

GLPK provides makefiles and batch files for a range of platforms and is known for its straightforward builds &mdash; given that your development environment was set up properly.

Manual compilation
The two reasons for having GLPK present are to gain access to:


 * GLPSOL &mdash; the command-line MathProg model interpreter and solver
 * libglpk &mdash; the callable solver library that you link to your application program.

A manual build allows you:


 * to run the latest code, containing new features and bugfixes
 * to customize your build, for instance, to provide support for arbitrary-precision arithmetic
 * to be less dependent on package maintainers
 * to modify the GLPK codebase.

Reasons to modify the codebase range from runtime reporting tweaks through to experimentation with the mixed-integer solution strategy.

You will need to decide which kind of library to build:


 * a static library &mdash; with compile-time linking
 * a shared library &mdash; with runtime linking.

The characteristics of each are discussed at Wikipedia.

If you intend to use GLPSOL, then a shared library is usually preferable. If you plan to link to a custom application you are writing, then a static library means that you need not distribute a copy of libglpk with your application.

If you wish to use non-default features in GLPSOL (such as arbitrary-precision arithmetic), then you will need to hand build GLPK with the appropriate configuration options (--with-gmp) and the correct third-party libraries present (libgmp).

Specific operating systems
There are dedicated pages for compiling GLPK on:


 * Windows
 * Mac OS X
 * Linux
 * Solaris