[9] | 1 | %* glpk07.tex *% |
---|
| 2 | |
---|
| 3 | \chapter{Installing GLPK on Your Computer} |
---|
| 4 | \label{install} |
---|
| 5 | |
---|
| 6 | \section{Downloading the distribution tarball} |
---|
| 7 | |
---|
| 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. |
---|
| 13 | |
---|
| 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: |
---|
| 17 | |
---|
| 18 | \begin{verbatim} |
---|
| 19 | gpg --verify glpk-4.38.tar.gz.sig |
---|
| 20 | \end{verbatim} |
---|
| 21 | |
---|
| 22 | \noindent |
---|
| 23 | If that command fails because you do not have the required public key, |
---|
| 24 | run the following command to import it: |
---|
| 25 | |
---|
| 26 | \begin{verbatim} |
---|
| 27 | gpg --keyserver keys.gnupg.net --recv-keys 5981E818 |
---|
| 28 | \end{verbatim} |
---|
| 29 | |
---|
| 30 | \noindent |
---|
| 31 | and then re-run the previous command. |
---|
| 32 | |
---|
| 33 | \section{Unpacking the distribution tarball} |
---|
| 34 | |
---|
| 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 |
---|
| 38 | version number. |
---|
| 39 | |
---|
| 40 | In order to prepare the distribution for installation you should: |
---|
| 41 | |
---|
| 42 | \medskip |
---|
| 43 | |
---|
| 44 | 1. Copy the GLPK distribution file to a working subdirectory. |
---|
| 45 | |
---|
| 46 | \medskip |
---|
| 47 | |
---|
| 48 | 2. Unpack the distribution file with the following command: |
---|
| 49 | |
---|
| 50 | \begin{verbatim} |
---|
| 51 | gzip -d glpk-X.Y.tar.gz |
---|
| 52 | \end{verbatim} |
---|
| 53 | |
---|
| 54 | \noindent |
---|
| 55 | that renames the distribution file to \verb|glpk-X.Y.tar|. |
---|
| 56 | |
---|
| 57 | \medskip |
---|
| 58 | |
---|
| 59 | 3. Unarchive the distribution file with the following command: |
---|
| 60 | |
---|
| 61 | \begin{verbatim} |
---|
| 62 | tar -x < glpk-X.Y.tar |
---|
| 63 | \end{verbatim} |
---|
| 64 | |
---|
| 65 | \noindent |
---|
| 66 | that automatically creates the subdirectory \verb|glpk-X.Y| containing |
---|
| 67 | the GLPK distribution. |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | \section{Configuring the package} |
---|
| 71 | |
---|
| 72 | After unpacking and unarchiving the GLPK distribution you should |
---|
| 73 | configure the package, i.e. automatically tune it for your platform. |
---|
| 74 | |
---|
| 75 | Normally, you should just \verb|cd| to the subdirectory |
---|
| 76 | \verb|glpk-X.Y| and run the configure script, e.g. |
---|
| 77 | |
---|
| 78 | \begin{verbatim} |
---|
| 79 | ./configure |
---|
| 80 | \end{verbatim} |
---|
| 81 | |
---|
| 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|'). |
---|
| 92 | |
---|
| 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|'. |
---|
| 98 | |
---|
| 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|', |
---|
| 102 | e.g. |
---|
| 103 | |
---|
| 104 | \begin{verbatim} |
---|
| 105 | ./configure --disable-shared |
---|
| 106 | \end{verbatim} |
---|
| 107 | |
---|
| 108 | \noindent |
---|
| 109 | If you encounter problems building the library try using the above |
---|
| 110 | option, because some platforms do not support shared libraries. |
---|
| 111 | |
---|
| 112 | \newpage |
---|
| 113 | |
---|
| 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. |
---|
| 117 | |
---|
| 118 | \bigskip |
---|
| 119 | |
---|
| 120 | \noindent |
---|
| 121 | \verb|--with-gmp | Enable using the GNU MP bignum library |
---|
| 122 | |
---|
| 123 | \medskip |
---|
| 124 | |
---|
| 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. |
---|
| 129 | |
---|
| 130 | For details about the GNU MP bignum library see its web page at |
---|
| 131 | \url{http://gmplib.org/}. |
---|
| 132 | |
---|
| 133 | \bigskip |
---|
| 134 | |
---|
| 135 | \noindent |
---|
| 136 | \verb|--with-zlib | |
---|
| 137 | Enable using the zlib data compression library |
---|
| 138 | |
---|
| 139 | \medskip |
---|
| 140 | |
---|
| 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. |
---|
| 146 | |
---|
| 147 | For details about the zlib compression library see its web page at |
---|
| 148 | \url{http://www.zlib.net/}. |
---|
| 149 | |
---|
| 150 | \bigskip |
---|
| 151 | |
---|
| 152 | \noindent |
---|
| 153 | \verb|--enable-dl | The same as `\verb|--enable-dl=ltdl|' |
---|
| 154 | |
---|
| 155 | \noindent |
---|
| 156 | \verb|--enable-dl=ltdl | Enable shared library support (GNU) |
---|
| 157 | |
---|
| 158 | \noindent |
---|
| 159 | \verb|--enable-dl=dlfcn | Enable shared library support (POSIX) |
---|
| 160 | |
---|
| 161 | \medskip |
---|
| 162 | |
---|
| 163 | Currently this feature is only needed to provide dynamic linking to |
---|
| 164 | ODBC and MySQL shared libraries (see below). |
---|
| 165 | |
---|
| 166 | For details about the GNU shared library support see the manual at |
---|
| 167 | \url{http://www.gnu.org/software/libtool/manual/}. |
---|
| 168 | |
---|
| 169 | \bigskip |
---|
| 170 | |
---|
| 171 | \noindent |
---|
| 172 | \verb|--enable-odbc | |
---|
| 173 | Enable using ODBC table driver (\verb|libiodbc|) |
---|
| 174 | |
---|
| 175 | \noindent |
---|
| 176 | \verb|--enable-odbc=unix | |
---|
| 177 | Enable using ODBC table driver (\verb|libodbc|) |
---|
| 178 | |
---|
| 179 | \medskip |
---|
| 180 | |
---|
| 181 | This feature allows transmitting data between MathProg model objects |
---|
| 182 | and relational databases accessed through ODBC. |
---|
| 183 | |
---|
| 184 | For more details about this feature see the supplement ``Using Data |
---|
| 185 | Tables in the GNU MathProg Modeling Language'' (\verb|doc/tables.pdf|). |
---|
| 186 | |
---|
| 187 | \bigskip |
---|
| 188 | |
---|
| 189 | \noindent |
---|
| 190 | \verb|--enable-mysql | |
---|
| 191 | Enable using MySQL table driver (\verb|libmysql|) |
---|
| 192 | |
---|
| 193 | \medskip |
---|
| 194 | |
---|
| 195 | This feature allows transmitting data between MathProg model objects |
---|
| 196 | and MySQL relational databases. |
---|
| 197 | |
---|
| 198 | For more details about this feature see the supplement ``Using Data |
---|
| 199 | Tables in the GNU MathProg Modeling Language'' (\verb|doc/tables.pdf|). |
---|
| 200 | |
---|
| 201 | \section{Compiling the package} |
---|
| 202 | |
---|
| 203 | Normally, you can compile (build) the package by typing the command: |
---|
| 204 | |
---|
| 205 | \begin{verbatim} |
---|
| 206 | make |
---|
| 207 | \end{verbatim} |
---|
| 208 | |
---|
| 209 | \noindent |
---|
| 210 | It reads `\verb|Makefile|' generated by `\verb|configure|' and performs |
---|
| 211 | all necessary jobs. |
---|
| 212 | |
---|
| 213 | If you want, you can override the `\verb|make|' variables \verb|CFLAGS| |
---|
| 214 | and \verb|LDFLAGS| like this: |
---|
| 215 | |
---|
| 216 | \begin{verbatim} |
---|
| 217 | make CFLAGS=-O2 LDFLAGS=-s |
---|
| 218 | \end{verbatim} |
---|
| 219 | |
---|
| 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. |
---|
| 231 | |
---|
| 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: |
---|
| 237 | |
---|
| 238 | \begin{verbatim} |
---|
| 239 | CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure |
---|
| 240 | \end{verbatim} |
---|
| 241 | |
---|
| 242 | \noindent |
---|
| 243 | Or on systems that have the `\verb|env|' program, you can do it like |
---|
| 244 | this: |
---|
| 245 | |
---|
| 246 | \begin{verbatim} |
---|
| 247 | env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure |
---|
| 248 | \end{verbatim} |
---|
| 249 | |
---|
| 250 | Here are the `\verb|make|' variables that you might want to override |
---|
| 251 | with environment variables when running `\verb|configure|'. |
---|
| 252 | |
---|
| 253 | For these variables, any value given in the environment overrides the |
---|
| 254 | value that `\verb|configure|' would choose: |
---|
| 255 | |
---|
| 256 | \medskip |
---|
| 257 | |
---|
| 258 | \noindent |
---|
| 259 | \verb|CC | C compiler program. The default is `\verb|cc|'. |
---|
| 260 | |
---|
| 261 | \medskip |
---|
| 262 | |
---|
| 263 | \noindent |
---|
| 264 | \verb|INSTALL | Program used to install files. The default value is |
---|
| 265 | `\verb|install|' if |
---|
| 266 | |
---|
| 267 | \noindent |
---|
| 268 | \verb| | you have it, otherwise `\verb|cp|'. |
---|
| 269 | |
---|
| 270 | \medskip |
---|
| 271 | |
---|
| 272 | For these variables, any value given in the environment is added to the |
---|
| 273 | value that `\verb|configure|' chooses: |
---|
| 274 | |
---|
| 275 | \medskip |
---|
| 276 | |
---|
| 277 | \noindent |
---|
| 278 | \verb|DEFS | Configuration options, in the form |
---|
| 279 | `\verb|-Dfoo -Dbar| \dots'. |
---|
| 280 | |
---|
| 281 | \medskip |
---|
| 282 | |
---|
| 283 | \noindent |
---|
| 284 | \verb|LIBS | Libraries to link with, in the form |
---|
| 285 | `\verb|-lfoo -lbar| \dots'. |
---|
| 286 | |
---|
| 287 | \section{Checking the package} |
---|
| 288 | |
---|
| 289 | To check the package, i.e. to run some tests included in the package, |
---|
| 290 | you can use the following command: |
---|
| 291 | |
---|
| 292 | \begin{verbatim} |
---|
| 293 | make check |
---|
| 294 | \end{verbatim} |
---|
| 295 | |
---|
| 296 | \section{Installing the package} |
---|
| 297 | |
---|
| 298 | Normally, to install the GLPK package you should type the following |
---|
| 299 | command: |
---|
| 300 | |
---|
| 301 | \begin{verbatim} |
---|
| 302 | make install |
---|
| 303 | \end{verbatim} |
---|
| 304 | |
---|
| 305 | \noindent |
---|
| 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. |
---|
| 312 | |
---|
| 313 | \begin{verbatim} |
---|
| 314 | make prefix=/usr/gnu |
---|
| 315 | make prefix=/usr/gnu install |
---|
| 316 | \end{verbatim} |
---|
| 317 | |
---|
| 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|'. |
---|
| 322 | |
---|
| 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|'. |
---|
| 326 | |
---|
| 327 | \section{Uninstalling the package} |
---|
| 328 | |
---|
| 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: |
---|
| 331 | |
---|
| 332 | \begin{verbatim} |
---|
| 333 | make uninstall |
---|
| 334 | \end{verbatim} |
---|
| 335 | |
---|
| 336 | %* eof *% |
---|