Debian Codegraph @

INSTALL

raw
1 ## BUILDING AND INSTALLING
2
3 These instructions are for building and installing SYMPHONY from source. For
4 instructions on how to obtain pre-built binaries, please see the README file.
5 The instructions here are for the standard build. For a more detailed
6 explanation of the build options and for building in parallel, see the
7 SYMPHONY [manual](
8
9 IMPORTANT: The build instructions have changed significantly. In most case,
10 you do not need to clone this repository first! Please follow the instructions
11 for your platform below.
12
13 ### Building on Linux
14
15 Most Linux distributions come with all the required tools installed. To obtain
16 the source code, the first step is to get the installer that will then
17 fetch the source for SYMPHONY and all its dependencies. *You do not need to
18 clone SYMPHONY first, just do the following!* Open a terminal and execute
19
20 ```
21 git clone https://www.github.com/coin-or/COIN-OR-OptimizationSuite
22 ```
23
24 Next, to check out source code for and build all the necessary projects
25 (including dependencies), execute the script in the `COIN-OR-OptimizationSuite`
26 subdirectory. To execute the script, do
27
28 ```
29 cd COIN-OR-OptimizationSuite
30 chmod u+x coin.install.sh
31 ./coin.install.sh
32 ```
33
34 (Note: The `chmod` command is only needed if the execute permission is not
35 automatically set by git on cloning). Once you run the script,
36 you will be prompted interactively to select a project to fetch and build. The
37 rest should happen automagically. Alternatively, the following command-line
38 incantation will execute the procedure non-interactively.
39
40 ```
41 ./coin.install.sh fetch build --no-prompt --main-proj=SYMPHONY
42 ```
43
44 Options that would have been passed to the `configure` script under the old
45 build system can simply be added to the command-line. For example, to build
46 with debugging symbols, do
47
48 ```
49 ./coin.install.sh fetch build --no-prompt --main-proj=SYMPHONY --enable-debug
50 ```
51
52 To get help with additional options available in running the script, do
53
54 ```
55 ./coin/install.sh --help
56 ```
57
58 The above procedures will build all required dependencies and SYMPHONY itself.
59 Afterwards, the binaries will be installed in the directory `Mibs/build/bin`
60 and the libraries in the directory `SYMPHONY/build/lib`. If you wish to
61 install in a different directory, such as `/usr/local`, then run the command
62
63 ```
64 ./coin.install.sh install --no-prompt --main-proj=SYMPHONY --prefix=/path/to/install/dir
65 ```
66
67 After installation, you will also need to add `/path/to/install/dir/bin` to your
68 `PATH` variable in your `.bashrc` and also add `/path/to/install/dir/lib`
69 to your `LD_LIBRARY_PATH` if you want to link to COIN libraries.
70
71 ### Building on Windows (MSys2/CYGWIN and MinGW/MSVC)
72
73 By far, the easiest way to build on Windows is with the GNU autotools and the
74 GCC compilers. The first step is to install either
75 * [Msys2](https://msys2.github.io/)
76 * [CYGWIN](http://cygwin.org/)
77 * [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10)
78
79 If you don't already have CYGWIN installed and don't want to fool around with
80 WSL (which is a great option if you already know your way around Unix), it is
81 recommended to use MSys2, since it provides a minimal toolset that is easy to
82 install. To get MSys2, either download the installer
83 [here](https://msys2.github.io/) or download and unzip MSys2 base from
84 [here](http://kent.dl.sourceforge.net/project/msys2/Base/x86_64/msys2-base-x86_64-20150512.tar.xz)
85 (this is an out-of-date version, there may be a better place to get an archive
86 version).
87
88 Following any of the above steps, you should have the `bash` command
89 (with Msys2, be sure to run `msys2_shell.bat`
90 or manually add `msys64\usr\bin`, `msys64\mingw32\bin`, and
91 `msys64\mingw64\bin` to your Windows path).
92
93 Once you have bash installed and in your `PATH`, open a Windows terminal and
94 type
95
96 ```
97 bash
98 pacman -S make wget tar patch dos2unix diffutils git svn
99 ```
100
101 To obtain the source code, the first step is to get the installer that will then
102 fetch the source for SYMPHONY and all its dependencies. *You do not need to
103 clone SYMPHONY first, just do the following!* Open a terminal and execute
104
105 ```
106 git clone https://www.github.com/coin-or/COIN-OR-OptimizationSuite
107 ```
108
109 Next, to check out source code for and build all the necessary projects
110 (including dependencies), execute the script in the `COIN-OR-OptimizationSuite`
111 subdirectory. To execute the script, do
112
113 ```
114 cd COIN-OR-OptimizationSuite
115 chmod u+x coi.install.sh
116 ./coin.install.sh
117 ```
118
119 (Note: The `chmod` command is only needed if the execute permission is not
120 automatically set by git on cloning). Once you run the script,
121 you will be prompted interactively to select a project to fetch and build. the
122 rest should happen automagically. Alternatively, the following command-line
123 incantation will execute the procedure non-interactively.
124
125 ```
126 ./coin.install.sh fetch build --no-prompt --main-proj=SYMPHONY
127 ```
128 Options that would have been passed to the `configure` script under the old
129 build system can simply be added to the command-line. For example, to build
130 with debugging symbols, do
131
132 ```
133 ./coin.install.sh fetch build --no-prompt --main-proj=SYMPHONY --enable-debug
134 ```
135
136 To get help with additional options available in running the script, do
137
138 ```
139 ./coin/install.sh --help
140 ```
141
142 To use the resulting binaries and/or libraries, you will need to add the
143 full path of the directory `build\bin` to your Windows executable
144 search `PATH`, or, alternatively, copy the conents of the build directory to
145 `C:\Program Files (x86)\SYMPHONY` and add the directory
146 `C:\Program Files (x86)\SYMPHONY\bin`
147 to your Windows executable search `PATH`. You may also consider adding
148 `C:\Program Files (x86)\SYMPHONY\lib` to the `LIB` path and
149 `C:\Program Files (x86)\SYMPHONY\include` to the `INCLUDE` path.
150
151 It is possible to use almost the exact same commands to build with the Visual
152 Studio compilers. Before doing any of the above commands in the Windows
153 terminal, first run the `vcvarsall.bat` script for your version of Visual
154 Studio. Note that you will also need a compatible Fortran compiler if you want
155 to build any projects requiring Fortran (`ifort` is recommended, but not
156 free). Then follow all the steps above, but replace the `build` command
157 with
158
159 ```
160 ./coin.install.sh fetch build --no-prompt --main-proj=SYMPHONY --enable-msvc
161 ```
162
163 ## BUILDING WITH the MSVC++ IDE
164
165 These instructions are for MSVC++ Version 10. Instructions for other versions
166 should be similar. '''The MSVC++ are not regularly tested so please let us
167 know if they are broken.'''
168
169 1. Go to `SYMPHONY/MSVisualStudio/v10` directory and open the solution
170 file `symphony.sln`.
171
172 2. Note that there are a number of additional preprocessor definitions that
173 control the functionality of SYMPHONY. These definitions are described in
174 `sym.mak`, a Unix-style makefile included in the distribution. To enable
175 the functionality associated with a particular definition, simply add it to
176 the list of definitions of `libSymphony` project together with the
177 required libraries and paths. For instance, if you want to enable GMPL reader
178 option, you need to * add the directory of the header files of GLPK to the
179 include files path * add `USE_GLPMPL` to the defines * add the GLPK
180 library to the solution
181
182 3. Make sure that the project `symphony` is set as the startup project by
183 choosing "Set as Startup Project" from the Project menu after selecting the
184 symphony project in the Solution Explorer. Choose `Build Solution` from
185 the `Build` menu. This should successfully build the SYMPHONY library and
186 the corresponding executable.
187
188 4. To test the executable, go to the `Debug` tab and choose `Start
189 Without Debugging.` and then type `help` or `?` to see a list of
190 available commands.
191
192 ## BUILDING WITH VISUAL STUDIO FROM COMMAND LINE (deprecated)
193
194 These instructions are for MSVC++ Version 10. Instructions for other versions
195 should be similar.
196
197 1. Open a command line terminal. Go to 'SYMPHONY/MSVisualStudio/v10'
198 directory and type
199
200 ```
201 devenv symphony.sln /Build "Debug|Win32
202 ```
203
204 This will create the 32-bit debug version of SYMPHONY. You can build 64-bit
205 with
206
207 ```
208 devenv symphony.sln /Build "Debug|x64"
209 ```
210
211 For each command, the library `libSymphony.lib` and the executable
212 `symphony` will be created in directories according to platform and
213 configuration. The library, together with the header files in
214 `SYMPHONY\include\`, can then be used to call SYMPHONY from any C/C++
215 code. The API for calling SYMPHONY is described in the user's manual.
216
217 2. To test the executable, type
218
219 ```
220 symphony.exe -F ..\..\SYMPHONY\Datasets\sample.mps
221 ```
222
223 In the appropriate directory. If you want to use the interactive optimizer,
224 simply type
225
226 ```
227 symphony.exe
228 ```
229
230 and then type `help` or `?` to see a list of available commands.
231
232 3. If SYMPHONY is modified, type
233
234 ```
235 devenv symphony.sln /Rebuild "Debug|Win32"
236 ```
237
238 in order to clean and rebuild everything.
239
240 ## BUILDING WITH THE NMAKE Utility (deprecated)
241
242 Note: the `sym.mak` file is no longer maintained, but may work.
243
244 1. Go to `MSVisualStudio` directory and edit the `sym.mak` makefile
245 to reflect your environment. This involves specifying the LP solver to be
246 used, assigning some variables and setting various paths. Only minor edits
247 should be required. An explanation of what has to be set is contained in the
248 comments in the makefile. Note that, you have to first create the COIN
249 libraries Cgl, Clp, Osi, OsiClp and CoinUtils.
250
251 2. Once configuration is done, open a command line terminal and type
252
253 ```
254 nmake sym.mak
255 ```
256
257 This will make the SYMPHONY library `libSymphony.lib` and the executable
258 `symphony` in `Debug` directory. The library, together with the header
259 files in `SYMPHONY\include\`, can then be used to call SYMPHONY from any
260 C/C++ code. The API for calling SYMPHONY is described in the user's manual.
261
262 3. To test the executable, type
263
264 ```
265 symphony.exe -F ..\..\SYMPHONY\Datasets\sample.mps
266 ```
267
268 in the output directory. If you want to use the interactive optimizer, simply
269 type
270
271 ```
272 symphony.exe
273 ```
274 and then type `help` or `?` to see a list of available commands.
275
276 ### Building on OS X
277
278 OS X is a Unix-based OS and ships with many of the basic components needed to
279 build COIN-OR, but it's missing some things. For examples, the latest versions
280 of OS X come with the `clang` compiler but no Fortran compiler. You may also
281 be missing the `wget` utility and `subversion` and `git` clients (needed for
282 obtaining source code). The easiest way to get these missing utilitites is to
283 install Homebrew (see http://brew.sh). After installation, open a terminal and
284 do
285
286 ```
287 brew install gcc wget svn git
288 ```
289
290 To obtain the source code, the first step is to get the installer that will then
291 fetch the source for SYMPHONY and all its dependencies. *You do not need to
292 clone SYMPHONY first, just do the following!* Open a terminal and execute
293
294 ```
295 git clone https://www.github.com/coin-or/COIN-OR-OptimizationSuite
296 ```
297
298 Next, to check out source code for and build all the necessary projects
299 (including dependencies), execute the script in the `COIN-OR-OptimizationSuite`
300 subdirectory. To execute the script, do
301
302 ```
303 cd COIN-OR-OptimizationSuite
304 chmod u+x coi.install.sh
305 ./coin.install.sh
306 ```
307
308 (Note: The `chmod` command is only needed if the execute permission is not
309 automatically set by git on cloning). Once you run the script,
310 you will be prompted interactively to select a project to fetch and build. the
311 rest should happen automagically. Alternatively, the following command-line
312 incantation will execute the procedure non-interactively.
313
314 ```
315 ./coin.install.sh fetch build --no-prompt --main-proj=SYMPHONY
316 ```
317
318 With this setup, `clang` will be used for compiling C++ by default and
319 `gfortran` will be used for Fortran. Since `clang` uses the GNU standard
320 library, `gfortran` is compatible.
321
322 If you want to use the `gcc` compiler provided by Homebrew, then replace the
323 `build` command above with
324
325 ```
326 ./coin.install.sh build --no-prompt --main-proj=SYMPHONY CC=gcc-5 CXX=g++-5
327 ```
328
329 Options that would have been passed to the `configure` script under the old
330 build system can simply be added to the command-line. For example, to build
331 with debugging symbols, do
332
333 ```
334 ./coin.install.sh fetch build --no-prompt --main-proj=SYMPHONY --enable-debug
335 ```
336
337 To get help with additional options available in running the script, do
338
339 ```
340 ./coin/install.sh --help
341 ```
342
343 If you wish to install in a different directory, such as `/usr/local`, then run
344 the command
345
346 ```
347 ./coin.install.sh install --no-prompt --main-proj=SYMPHONY --prefix=/path/to/install/dir
348 ```
349
350 After installation, you will also need to add `/path/to/install/dir/bin` to your
351 `PATH` variable in your `.bashrc` and also add `/path/to/install/dir/lib`
352 to your `DYLD_LIBRARY_PATH` if you want to link to COIN libraries.
353