3 \chapter{Installing GLPK on Your Computer}
6 \section{Downloading the distribution tarball}
8 The distribution tarball of the most recent version of the GLPK
9 package can be found on \url{http://ftp.gnu.org/gnu/glpk/} [via http]
10 and \url{ftp://ftp.gnu.org/gnu/glpk/} [via FTP]. It can also be found
11 on one of the FTP mirrors; see \url{http://www.gnu.org/prep/ftp.html}.
12 Please use a mirror if possible.
14 To make sure that the GLPK distribution tarball you have downloaded is
15 intact you need to download the corresponding `\verb|.sig|' file and
16 run a command like this:
19 gpg --verify glpk-4.38.tar.gz.sig
23 If that command fails because you do not have the required public key,
24 run the following command to import it:
27 gpg --keyserver keys.gnupg.net --recv-keys 5981E818
31 and then re-run the previous command.
33 \section{Unpacking the distribution tarball}
35 The GLPK package (like all other GNU software) is distributed in the
36 form of packed archive. This is one file named \verb|glpk-X.Y.tar.gz|,
37 where {\it X} is the major version number and {\it Y} is the minor
40 In order to prepare the distribution for installation you should:
44 1. Copy the GLPK distribution file to a working subdirectory.
48 2. Unpack the distribution file with the following command:
51 gzip -d glpk-X.Y.tar.gz
55 that renames the distribution file to \verb|glpk-X.Y.tar|.
59 3. Unarchive the distribution file with the following command:
66 that automatically creates the subdirectory \verb|glpk-X.Y| containing
67 the GLPK distribution.
70 \section{Configuring the package}
72 After unpacking and unarchiving the GLPK distribution you should
73 configure the package, i.e. automatically tune it for your platform.
75 Normally, you should just \verb|cd| to the subdirectory
76 \verb|glpk-X.Y| and run the configure script, e.g.
82 The `\verb|configure|' shell script attempts to guess correct values
83 for various system-dependent variables used during compilation. It uses
84 those values to create a `\verb|Makefile|' in each directory of the
85 package. It also creates file `\verb|config.h|' containing
86 platform-dependent definitions. Finally, it creates a shell script
87 `\verb|config.status|' that you can run in the future to recreate the
88 current configuration, a file `\verb|config.cache|' that saves the
89 results of its tests to speed up reconfiguring, and a file
90 `\verb|config.log|' containing compiler output (useful mainly for
91 debugging `\verb|configure|').
93 Running `\verb|configure|' takes about a few minutes. While it is
94 running, it displays some informational messages that tell you what it
95 is doing. If you don't want to see these messages, run
96 `\verb|configure|' with its standard output redirected to
97 `\verb|dev/null|'; for example, `\verb|./configure > /dev/null|'.
99 By default both static and shared versions of the GLPK library will be
100 compiled. Compilation of the shared librariy can be turned off by
101 specifying the `\verb|--disable-shared|' option to `\verb|configure|',
105 ./configure --disable-shared
109 If you encounter problems building the library try using the above
110 option, because some platforms do not support shared libraries.
114 The GLPK package has some optional features listed below. By default
115 all these features are disabled. To enable a feature the corresponding
116 option should be passed to the configure script.
121 \verb|--with-gmp | Enable using the GNU MP bignum library
125 This feature allows the exact simplex solver to use the GNU MP bignum
126 library. If it is disabled, the exact simplex solver uses the GLPK
127 bignum module, which provides the same functionality as GNU MP, however,
128 it is much less efficient.
130 For details about the GNU MP bignum library see its web page at
131 \url{http://gmplib.org/}.
137 Enable using the zlib data compression library
141 This feature allows GLPK API routines and the stand-alone solver to
142 read and write compressed data files performing compression and
143 decompression ``on the fly'' (compressed data files are recognized by
144 suffix `\verb|.gz|' in the file name). It may be useful in case of
145 large MPS files to save the disk space.
147 For details about the zlib compression library see its web page at
148 \url{http://www.zlib.net/}.
153 \verb|--enable-dl | The same as `\verb|--enable-dl=ltdl|'
156 \verb|--enable-dl=ltdl | Enable shared library support (GNU)
159 \verb|--enable-dl=dlfcn | Enable shared library support (POSIX)
163 Currently this feature is only needed to provide dynamic linking to
164 ODBC and MySQL shared libraries (see below).
166 For details about the GNU shared library support see the manual at
167 \url{http://www.gnu.org/software/libtool/manual/}.
172 \verb|--enable-odbc |
173 Enable using ODBC table driver (\verb|libiodbc|)
176 \verb|--enable-odbc=unix |
177 Enable using ODBC table driver (\verb|libodbc|)
181 This feature allows transmitting data between MathProg model objects
182 and relational databases accessed through ODBC.
184 For more details about this feature see the supplement ``Using Data
185 Tables in the GNU MathProg Modeling Language'' (\verb|doc/tables.pdf|).
190 \verb|--enable-mysql |
191 Enable using MySQL table driver (\verb|libmysql|)
195 This feature allows transmitting data between MathProg model objects
196 and MySQL relational databases.
198 For more details about this feature see the supplement ``Using Data
199 Tables in the GNU MathProg Modeling Language'' (\verb|doc/tables.pdf|).
201 \section{Compiling the package}
203 Normally, you can compile (build) the package by typing the command:
210 It reads `\verb|Makefile|' generated by `\verb|configure|' and performs
213 If you want, you can override the `\verb|make|' variables \verb|CFLAGS|
214 and \verb|LDFLAGS| like this:
217 make CFLAGS=-O2 LDFLAGS=-s
220 To compile the package in a different directory from the one containing
221 the source code, you must use a version of `\verb|make|' that supports
222 `\verb|VPATH|' variable, such as GNU `\verb|make|'. `\verb|cd|' to the
223 directory where you want the object files and executables to go and run
224 the `\verb|configure|' script. `\verb|configure|' automatically checks
225 for the source code in the directory that `\verb|configure|' is in and
226 in `\verb|..|'. If for some reason `\verb|configure|' is not in the
227 source code directory that you are configuring, then it will report that
228 it can't find the source code. In that case, run `\verb|configure|' with
229 the option `\verb|--srcdir=DIR|', where \verb|DIR| is the directory that
230 contains the source code.
232 Some systems require unusual options for compilation or linking that
233 the `\verb|configure|' script does not know about. You can give
234 `\verb|configure|' initial values for variables by setting them in the
235 environment. Using a Bourne-compatible shell, you can do that on the
236 command line like this:
239 CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
243 Or on systems that have the `\verb|env|' program, you can do it like
247 env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
250 Here are the `\verb|make|' variables that you might want to override
251 with environment variables when running `\verb|configure|'.
253 For these variables, any value given in the environment overrides the
254 value that `\verb|configure|' would choose:
259 \verb|CC | C compiler program. The default is `\verb|cc|'.
264 \verb|INSTALL | Program used to install files. The default value is
268 \verb| | you have it, otherwise `\verb|cp|'.
272 For these variables, any value given in the environment is added to the
273 value that `\verb|configure|' chooses:
278 \verb|DEFS | Configuration options, in the form
279 `\verb|-Dfoo -Dbar| \dots'.
284 \verb|LIBS | Libraries to link with, in the form
285 `\verb|-lfoo -lbar| \dots'.
287 \section{Checking the package}
289 To check the package, i.e. to run some tests included in the package,
290 you can use the following command:
296 \section{Installing the package}
298 Normally, to install the GLPK package you should type the following
306 By default, `\verb|make install|' will install the package's files in
307 `\verb|usr/local/bin|', `\verb|usr/local/lib|', etc. You can specify an
308 installation prefix other than `\verb|/usr/local|' by giving
309 `\verb|configure|' the option `\verb|--prefix=PATH|'. Alternately, you
310 can do so by consistently giving a value for the `\verb|prefix|'
311 variable when you run `\verb|make|', e.g.
315 make prefix=/usr/gnu install
318 After installing you can remove the program binaries and object files
319 from the source directory by typing `\verb|make clean|'. To remove all
320 files that `\verb|configure|' created (`\verb|Makefile|',
321 `\verb|config.status|', etc.), just type `\verb|make distclean|'.
323 The file `\verb|configure.ac|' is used to create `\verb|configure|' by
324 a program called `\verb|autoconf|'. You only need it if you want to
325 remake `\verb|configure|' using a newer version of `\verb|autoconf|'.
327 \section{Uninstalling the package}
329 To uninstall the GLPK package, i.e. to remove all the package's files
330 from the system places, you can use the following command: