alpar@1
|
1 |
%* glpk07.tex *%
|
alpar@1
|
2 |
|
alpar@1
|
3 |
\chapter{Installing GLPK on Your Computer}
|
alpar@1
|
4 |
\label{install}
|
alpar@1
|
5 |
|
alpar@1
|
6 |
\section{Downloading the distribution tarball}
|
alpar@1
|
7 |
|
alpar@1
|
8 |
The distribution tarball of the most recent version of the GLPK
|
alpar@1
|
9 |
package can be found on \url{http://ftp.gnu.org/gnu/glpk/} [via http]
|
alpar@1
|
10 |
and \url{ftp://ftp.gnu.org/gnu/glpk/} [via FTP]. It can also be found
|
alpar@1
|
11 |
on one of the FTP mirrors; see \url{http://www.gnu.org/prep/ftp.html}.
|
alpar@1
|
12 |
Please use a mirror if possible.
|
alpar@1
|
13 |
|
alpar@1
|
14 |
To make sure that the GLPK distribution tarball you have downloaded is
|
alpar@1
|
15 |
intact you need to download the corresponding `\verb|.sig|' file and
|
alpar@1
|
16 |
run a command like this:
|
alpar@1
|
17 |
|
alpar@1
|
18 |
\begin{verbatim}
|
alpar@1
|
19 |
gpg --verify glpk-4.38.tar.gz.sig
|
alpar@1
|
20 |
\end{verbatim}
|
alpar@1
|
21 |
|
alpar@1
|
22 |
\noindent
|
alpar@1
|
23 |
If that command fails because you do not have the required public key,
|
alpar@1
|
24 |
run the following command to import it:
|
alpar@1
|
25 |
|
alpar@1
|
26 |
\begin{verbatim}
|
alpar@1
|
27 |
gpg --keyserver keys.gnupg.net --recv-keys 5981E818
|
alpar@1
|
28 |
\end{verbatim}
|
alpar@1
|
29 |
|
alpar@1
|
30 |
\noindent
|
alpar@1
|
31 |
and then re-run the previous command.
|
alpar@1
|
32 |
|
alpar@1
|
33 |
\section{Unpacking the distribution tarball}
|
alpar@1
|
34 |
|
alpar@1
|
35 |
The GLPK package (like all other GNU software) is distributed in the
|
alpar@1
|
36 |
form of packed archive. This is one file named \verb|glpk-X.Y.tar.gz|,
|
alpar@1
|
37 |
where {\it X} is the major version number and {\it Y} is the minor
|
alpar@1
|
38 |
version number.
|
alpar@1
|
39 |
|
alpar@1
|
40 |
In order to prepare the distribution for installation you should:
|
alpar@1
|
41 |
|
alpar@1
|
42 |
\medskip
|
alpar@1
|
43 |
|
alpar@1
|
44 |
1. Copy the GLPK distribution file to a working subdirectory.
|
alpar@1
|
45 |
|
alpar@1
|
46 |
\medskip
|
alpar@1
|
47 |
|
alpar@1
|
48 |
2. Unpack the distribution file with the following command:
|
alpar@1
|
49 |
|
alpar@1
|
50 |
\begin{verbatim}
|
alpar@1
|
51 |
gzip -d glpk-X.Y.tar.gz
|
alpar@1
|
52 |
\end{verbatim}
|
alpar@1
|
53 |
|
alpar@1
|
54 |
\noindent
|
alpar@1
|
55 |
that renames the distribution file to \verb|glpk-X.Y.tar|.
|
alpar@1
|
56 |
|
alpar@1
|
57 |
\medskip
|
alpar@1
|
58 |
|
alpar@1
|
59 |
3. Unarchive the distribution file with the following command:
|
alpar@1
|
60 |
|
alpar@1
|
61 |
\begin{verbatim}
|
alpar@1
|
62 |
tar -x < glpk-X.Y.tar
|
alpar@1
|
63 |
\end{verbatim}
|
alpar@1
|
64 |
|
alpar@1
|
65 |
\noindent
|
alpar@1
|
66 |
that automatically creates the subdirectory \verb|glpk-X.Y| containing
|
alpar@1
|
67 |
the GLPK distribution.
|
alpar@1
|
68 |
|
alpar@1
|
69 |
|
alpar@1
|
70 |
\section{Configuring the package}
|
alpar@1
|
71 |
|
alpar@1
|
72 |
After unpacking and unarchiving the GLPK distribution you should
|
alpar@1
|
73 |
configure the package, i.e. automatically tune it for your platform.
|
alpar@1
|
74 |
|
alpar@1
|
75 |
Normally, you should just \verb|cd| to the subdirectory
|
alpar@1
|
76 |
\verb|glpk-X.Y| and run the configure script, e.g.
|
alpar@1
|
77 |
|
alpar@1
|
78 |
\begin{verbatim}
|
alpar@1
|
79 |
./configure
|
alpar@1
|
80 |
\end{verbatim}
|
alpar@1
|
81 |
|
alpar@1
|
82 |
The `\verb|configure|' shell script attempts to guess correct values
|
alpar@1
|
83 |
for various system-dependent variables used during compilation. It uses
|
alpar@1
|
84 |
those values to create a `\verb|Makefile|' in each directory of the
|
alpar@1
|
85 |
package. It also creates file `\verb|config.h|' containing
|
alpar@1
|
86 |
platform-dependent definitions. Finally, it creates a shell script
|
alpar@1
|
87 |
`\verb|config.status|' that you can run in the future to recreate the
|
alpar@1
|
88 |
current configuration, a file `\verb|config.cache|' that saves the
|
alpar@1
|
89 |
results of its tests to speed up reconfiguring, and a file
|
alpar@1
|
90 |
`\verb|config.log|' containing compiler output (useful mainly for
|
alpar@1
|
91 |
debugging `\verb|configure|').
|
alpar@1
|
92 |
|
alpar@1
|
93 |
Running `\verb|configure|' takes about a few minutes. While it is
|
alpar@1
|
94 |
running, it displays some informational messages that tell you what it
|
alpar@1
|
95 |
is doing. If you don't want to see these messages, run
|
alpar@1
|
96 |
`\verb|configure|' with its standard output redirected to
|
alpar@1
|
97 |
`\verb|dev/null|'; for example, `\verb|./configure > /dev/null|'.
|
alpar@1
|
98 |
|
alpar@1
|
99 |
By default both static and shared versions of the GLPK library will be
|
alpar@1
|
100 |
compiled. Compilation of the shared librariy can be turned off by
|
alpar@1
|
101 |
specifying the `\verb|--disable-shared|' option to `\verb|configure|',
|
alpar@1
|
102 |
e.g.
|
alpar@1
|
103 |
|
alpar@1
|
104 |
\begin{verbatim}
|
alpar@1
|
105 |
./configure --disable-shared
|
alpar@1
|
106 |
\end{verbatim}
|
alpar@1
|
107 |
|
alpar@1
|
108 |
\noindent
|
alpar@1
|
109 |
If you encounter problems building the library try using the above
|
alpar@1
|
110 |
option, because some platforms do not support shared libraries.
|
alpar@1
|
111 |
|
alpar@1
|
112 |
\newpage
|
alpar@1
|
113 |
|
alpar@1
|
114 |
The GLPK package has some optional features listed below. By default
|
alpar@1
|
115 |
all these features are disabled. To enable a feature the corresponding
|
alpar@1
|
116 |
option should be passed to the configure script.
|
alpar@1
|
117 |
|
alpar@1
|
118 |
\bigskip
|
alpar@1
|
119 |
|
alpar@1
|
120 |
\noindent
|
alpar@1
|
121 |
\verb|--with-gmp | Enable using the GNU MP bignum library
|
alpar@1
|
122 |
|
alpar@1
|
123 |
\medskip
|
alpar@1
|
124 |
|
alpar@1
|
125 |
This feature allows the exact simplex solver to use the GNU MP bignum
|
alpar@1
|
126 |
library. If it is disabled, the exact simplex solver uses the GLPK
|
alpar@1
|
127 |
bignum module, which provides the same functionality as GNU MP, however,
|
alpar@1
|
128 |
it is much less efficient.
|
alpar@1
|
129 |
|
alpar@1
|
130 |
For details about the GNU MP bignum library see its web page at
|
alpar@1
|
131 |
\url{http://gmplib.org/}.
|
alpar@1
|
132 |
|
alpar@1
|
133 |
\bigskip
|
alpar@1
|
134 |
|
alpar@1
|
135 |
\noindent
|
alpar@1
|
136 |
\verb|--with-zlib |
|
alpar@1
|
137 |
Enable using the zlib data compression library
|
alpar@1
|
138 |
|
alpar@1
|
139 |
\medskip
|
alpar@1
|
140 |
|
alpar@1
|
141 |
This feature allows GLPK API routines and the stand-alone solver to
|
alpar@1
|
142 |
read and write compressed data files performing compression and
|
alpar@1
|
143 |
decompression ``on the fly'' (compressed data files are recognized by
|
alpar@1
|
144 |
suffix `\verb|.gz|' in the file name). It may be useful in case of
|
alpar@1
|
145 |
large MPS files to save the disk space.
|
alpar@1
|
146 |
|
alpar@1
|
147 |
For details about the zlib compression library see its web page at
|
alpar@1
|
148 |
\url{http://www.zlib.net/}.
|
alpar@1
|
149 |
|
alpar@1
|
150 |
\bigskip
|
alpar@1
|
151 |
|
alpar@1
|
152 |
\noindent
|
alpar@1
|
153 |
\verb|--enable-dl | The same as `\verb|--enable-dl=ltdl|'
|
alpar@1
|
154 |
|
alpar@1
|
155 |
\noindent
|
alpar@1
|
156 |
\verb|--enable-dl=ltdl | Enable shared library support (GNU)
|
alpar@1
|
157 |
|
alpar@1
|
158 |
\noindent
|
alpar@1
|
159 |
\verb|--enable-dl=dlfcn | Enable shared library support (POSIX)
|
alpar@1
|
160 |
|
alpar@1
|
161 |
\medskip
|
alpar@1
|
162 |
|
alpar@1
|
163 |
Currently this feature is only needed to provide dynamic linking to
|
alpar@1
|
164 |
ODBC and MySQL shared libraries (see below).
|
alpar@1
|
165 |
|
alpar@1
|
166 |
For details about the GNU shared library support see the manual at
|
alpar@1
|
167 |
\url{http://www.gnu.org/software/libtool/manual/}.
|
alpar@1
|
168 |
|
alpar@1
|
169 |
\bigskip
|
alpar@1
|
170 |
|
alpar@1
|
171 |
\noindent
|
alpar@1
|
172 |
\verb|--enable-odbc |
|
alpar@1
|
173 |
Enable using ODBC table driver (\verb|libiodbc|)
|
alpar@1
|
174 |
|
alpar@1
|
175 |
\noindent
|
alpar@1
|
176 |
\verb|--enable-odbc=unix |
|
alpar@1
|
177 |
Enable using ODBC table driver (\verb|libodbc|)
|
alpar@1
|
178 |
|
alpar@1
|
179 |
\medskip
|
alpar@1
|
180 |
|
alpar@1
|
181 |
This feature allows transmitting data between MathProg model objects
|
alpar@1
|
182 |
and relational databases accessed through ODBC.
|
alpar@1
|
183 |
|
alpar@1
|
184 |
For more details about this feature see the supplement ``Using Data
|
alpar@1
|
185 |
Tables in the GNU MathProg Modeling Language'' (\verb|doc/tables.pdf|).
|
alpar@1
|
186 |
|
alpar@1
|
187 |
\bigskip
|
alpar@1
|
188 |
|
alpar@1
|
189 |
\noindent
|
alpar@1
|
190 |
\verb|--enable-mysql |
|
alpar@1
|
191 |
Enable using MySQL table driver (\verb|libmysql|)
|
alpar@1
|
192 |
|
alpar@1
|
193 |
\medskip
|
alpar@1
|
194 |
|
alpar@1
|
195 |
This feature allows transmitting data between MathProg model objects
|
alpar@1
|
196 |
and MySQL relational databases.
|
alpar@1
|
197 |
|
alpar@1
|
198 |
For more details about this feature see the supplement ``Using Data
|
alpar@1
|
199 |
Tables in the GNU MathProg Modeling Language'' (\verb|doc/tables.pdf|).
|
alpar@1
|
200 |
|
alpar@1
|
201 |
\section{Compiling the package}
|
alpar@1
|
202 |
|
alpar@1
|
203 |
Normally, you can compile (build) the package by typing the command:
|
alpar@1
|
204 |
|
alpar@1
|
205 |
\begin{verbatim}
|
alpar@1
|
206 |
make
|
alpar@1
|
207 |
\end{verbatim}
|
alpar@1
|
208 |
|
alpar@1
|
209 |
\noindent
|
alpar@1
|
210 |
It reads `\verb|Makefile|' generated by `\verb|configure|' and performs
|
alpar@1
|
211 |
all necessary jobs.
|
alpar@1
|
212 |
|
alpar@1
|
213 |
If you want, you can override the `\verb|make|' variables \verb|CFLAGS|
|
alpar@1
|
214 |
and \verb|LDFLAGS| like this:
|
alpar@1
|
215 |
|
alpar@1
|
216 |
\begin{verbatim}
|
alpar@1
|
217 |
make CFLAGS=-O2 LDFLAGS=-s
|
alpar@1
|
218 |
\end{verbatim}
|
alpar@1
|
219 |
|
alpar@1
|
220 |
To compile the package in a different directory from the one containing
|
alpar@1
|
221 |
the source code, you must use a version of `\verb|make|' that supports
|
alpar@1
|
222 |
`\verb|VPATH|' variable, such as GNU `\verb|make|'. `\verb|cd|' to the
|
alpar@1
|
223 |
directory where you want the object files and executables to go and run
|
alpar@1
|
224 |
the `\verb|configure|' script. `\verb|configure|' automatically checks
|
alpar@1
|
225 |
for the source code in the directory that `\verb|configure|' is in and
|
alpar@1
|
226 |
in `\verb|..|'. If for some reason `\verb|configure|' is not in the
|
alpar@1
|
227 |
source code directory that you are configuring, then it will report that
|
alpar@1
|
228 |
it can't find the source code. In that case, run `\verb|configure|' with
|
alpar@1
|
229 |
the option `\verb|--srcdir=DIR|', where \verb|DIR| is the directory that
|
alpar@1
|
230 |
contains the source code.
|
alpar@1
|
231 |
|
alpar@1
|
232 |
Some systems require unusual options for compilation or linking that
|
alpar@1
|
233 |
the `\verb|configure|' script does not know about. You can give
|
alpar@1
|
234 |
`\verb|configure|' initial values for variables by setting them in the
|
alpar@1
|
235 |
environment. Using a Bourne-compatible shell, you can do that on the
|
alpar@1
|
236 |
command line like this:
|
alpar@1
|
237 |
|
alpar@1
|
238 |
\begin{verbatim}
|
alpar@1
|
239 |
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
alpar@1
|
240 |
\end{verbatim}
|
alpar@1
|
241 |
|
alpar@1
|
242 |
\noindent
|
alpar@1
|
243 |
Or on systems that have the `\verb|env|' program, you can do it like
|
alpar@1
|
244 |
this:
|
alpar@1
|
245 |
|
alpar@1
|
246 |
\begin{verbatim}
|
alpar@1
|
247 |
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
alpar@1
|
248 |
\end{verbatim}
|
alpar@1
|
249 |
|
alpar@1
|
250 |
Here are the `\verb|make|' variables that you might want to override
|
alpar@1
|
251 |
with environment variables when running `\verb|configure|'.
|
alpar@1
|
252 |
|
alpar@1
|
253 |
For these variables, any value given in the environment overrides the
|
alpar@1
|
254 |
value that `\verb|configure|' would choose:
|
alpar@1
|
255 |
|
alpar@1
|
256 |
\medskip
|
alpar@1
|
257 |
|
alpar@1
|
258 |
\noindent
|
alpar@1
|
259 |
\verb|CC | C compiler program. The default is `\verb|cc|'.
|
alpar@1
|
260 |
|
alpar@1
|
261 |
\medskip
|
alpar@1
|
262 |
|
alpar@1
|
263 |
\noindent
|
alpar@1
|
264 |
\verb|INSTALL | Program used to install files. The default value is
|
alpar@1
|
265 |
`\verb|install|' if
|
alpar@1
|
266 |
|
alpar@1
|
267 |
\noindent
|
alpar@1
|
268 |
\verb| | you have it, otherwise `\verb|cp|'.
|
alpar@1
|
269 |
|
alpar@1
|
270 |
\medskip
|
alpar@1
|
271 |
|
alpar@1
|
272 |
For these variables, any value given in the environment is added to the
|
alpar@1
|
273 |
value that `\verb|configure|' chooses:
|
alpar@1
|
274 |
|
alpar@1
|
275 |
\medskip
|
alpar@1
|
276 |
|
alpar@1
|
277 |
\noindent
|
alpar@1
|
278 |
\verb|DEFS | Configuration options, in the form
|
alpar@1
|
279 |
`\verb|-Dfoo -Dbar| \dots'.
|
alpar@1
|
280 |
|
alpar@1
|
281 |
\medskip
|
alpar@1
|
282 |
|
alpar@1
|
283 |
\noindent
|
alpar@1
|
284 |
\verb|LIBS | Libraries to link with, in the form
|
alpar@1
|
285 |
`\verb|-lfoo -lbar| \dots'.
|
alpar@1
|
286 |
|
alpar@1
|
287 |
\section{Checking the package}
|
alpar@1
|
288 |
|
alpar@1
|
289 |
To check the package, i.e. to run some tests included in the package,
|
alpar@1
|
290 |
you can use the following command:
|
alpar@1
|
291 |
|
alpar@1
|
292 |
\begin{verbatim}
|
alpar@1
|
293 |
make check
|
alpar@1
|
294 |
\end{verbatim}
|
alpar@1
|
295 |
|
alpar@1
|
296 |
\section{Installing the package}
|
alpar@1
|
297 |
|
alpar@1
|
298 |
Normally, to install the GLPK package you should type the following
|
alpar@1
|
299 |
command:
|
alpar@1
|
300 |
|
alpar@1
|
301 |
\begin{verbatim}
|
alpar@1
|
302 |
make install
|
alpar@1
|
303 |
\end{verbatim}
|
alpar@1
|
304 |
|
alpar@1
|
305 |
\noindent
|
alpar@1
|
306 |
By default, `\verb|make install|' will install the package's files in
|
alpar@1
|
307 |
`\verb|usr/local/bin|', `\verb|usr/local/lib|', etc. You can specify an
|
alpar@1
|
308 |
installation prefix other than `\verb|/usr/local|' by giving
|
alpar@1
|
309 |
`\verb|configure|' the option `\verb|--prefix=PATH|'. Alternately, you
|
alpar@1
|
310 |
can do so by consistently giving a value for the `\verb|prefix|'
|
alpar@1
|
311 |
variable when you run `\verb|make|', e.g.
|
alpar@1
|
312 |
|
alpar@1
|
313 |
\begin{verbatim}
|
alpar@1
|
314 |
make prefix=/usr/gnu
|
alpar@1
|
315 |
make prefix=/usr/gnu install
|
alpar@1
|
316 |
\end{verbatim}
|
alpar@1
|
317 |
|
alpar@1
|
318 |
After installing you can remove the program binaries and object files
|
alpar@1
|
319 |
from the source directory by typing `\verb|make clean|'. To remove all
|
alpar@1
|
320 |
files that `\verb|configure|' created (`\verb|Makefile|',
|
alpar@1
|
321 |
`\verb|config.status|', etc.), just type `\verb|make distclean|'.
|
alpar@1
|
322 |
|
alpar@1
|
323 |
The file `\verb|configure.ac|' is used to create `\verb|configure|' by
|
alpar@1
|
324 |
a program called `\verb|autoconf|'. You only need it if you want to
|
alpar@1
|
325 |
remake `\verb|configure|' using a newer version of `\verb|autoconf|'.
|
alpar@1
|
326 |
|
alpar@1
|
327 |
\section{Uninstalling the package}
|
alpar@1
|
328 |
|
alpar@1
|
329 |
To uninstall the GLPK package, i.e. to remove all the package's files
|
alpar@1
|
330 |
from the system places, you can use the following command:
|
alpar@1
|
331 |
|
alpar@1
|
332 |
\begin{verbatim}
|
alpar@1
|
333 |
make uninstall
|
alpar@1
|
334 |
\end{verbatim}
|
alpar@1
|
335 |
|
alpar@1
|
336 |
%* eof *%
|