GLPK/Compiling GLPK

Many users prefer to compile GLPK from scratch — 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 — given that your development environment was set up properly.

Manual compilation

edit

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

  • GLPSOL — the command-line MathProg model interpreter and solver
  • libglpk — 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 — with compile-time linking
  • a shared library — 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

edit

There are dedicated pages for compiling GLPK on: