|Version 2 (modified by stefan, 3 years ago) (diff)|
Notes on Building COIN-OR projects under Windows
There are ways to build COIN-OR projects even under Windows. However, one should keep in mind that this platform is only sporadically maintained. Most COIN-OR projects are developed on a Unix-like system and do not focus primarily on supporting many other platforms. The platform of the developer, which is Linux in many cases, is usually the one where most of the testing is done. There is some effort to automatically test also other platforms, however, build or execution problems with Windows are discovered often only with much delay - if at all. Performance is usually never checked.
After these motivating words, this page tries to give a short overview on the possible tracks to build COIN-OR projects under Windows. It will be far from complete, a message that as usual comes with the reminder that this page is a wiki.
Before thinking on how to build a COIN-OR project under Windows, you should convince yourself whether you really need to run this project under Windows. There exist user-friendly Linux distributions that are easy to install and use.
Next to a usual installation that replaces Windows or exists parallel to a Windows installation, you could also consider an installation a Linux system in a virtual machine, thus allowing to run Linux "inside" Windows. Setting up virtual machines is easy nowadays.
Use precompiled binaries
The people behind COIN-OR put some effort in providing binary versions of executables and libraries, especially for Windows.
The binaries are available at the COIN-OR binaries download page. If binaries for the particular project you are interested in are not available, have a look if it is included in the archives for the CoinAll project. CoinAll is a selection of COIN-OR projects that are known to work together.
Using MS Visual Studio
The developer of the Windows system, Microsoft, also provides a tool for developing applications under Windows, called Microsoft Visual Studio (MSVS). Of course, it comes with its own system of how to build libraries and binaries from a bunch of source files, so that the default build system (based on shell, autotools, and make) of COIN-OR projects cannot be reused.
Instead, a group of fearless COIN-OR maintainers took up the task to provide MSVS project files for some projects. The COIN-OR Visual Studio wiki describes the organization and use of these files and for which projects they are available.
Cygwin is a project that tries to emulate a Linux running on top of Windows. I.e., it provides a Unix shell and standard Linux tools, thus allowing one to work as under a real Linux system. Thus, it makes it possible to use the default COIN-OR build system under Cygwin.
Building with GNU compilers
Cygwin also includes the GNU compiler collection, including gcc, g++, and gfortran. The strong emulation of Linux by Cygwin allows to build most COIN-OR projects that also build under Linux with GNU compilers.
Note, that by default the binaries produced by a Cygwin/GNU build require the library cygwin.dll (or some such name) at runtime, hence binaries will not run without this library in the native Windows environment.
However, adding -mno-cygwin to the compiler flags allows to build in a way that everything that needs cygwin.dll is avoided. The resulting binaries then also run in a native Windows environment. This compiler flag can be added by using the configure option --enable-doscompile=mingw.
Note further, that some Cygwin distributions include a buggy make binary, which may result in failing builds. Regarding this issue and other issues with Cygwin builds, please consult the current issues page.
Building with MS or Intel compilers
It is also possible to use MS or Intel compilers while still using COIN-OR build system under Cygwin. The way it works is that Unix-paths are translated into Windows-paths using the cygpath tool at the time the compiler is called. The whole system is a bit fragile, so don't be surprised if some things don't work.
Note that setting up the $PATH variable under Cygwin in a way that it finds the MS or Intel compilers is important.
The Intel compilers have the advantage that they also bring a Fortran compiler that compiles both Fortran77 and Fortran90 code. MSVS usually contains only C/C++ compilers.
However, the BuildTools include a script compile_f2c that emulates a Fortran compiler by translating Fortran77 code into C code via f2c and compiles this code via a C compiler.
This does not work for Fortran90.
See the INSTALL file on instructions on how to install compile_f2c. If configure is called with --enable-doscompile=msvc and no other Fortran compiler is available, compile_f2c will be chosen automatically.
Using MinGW / MSYS
MinGW is a sort of minimal version of Cygwin. It brings a shell and a set of standard Unix tools, but does not try to emulate a full Linux system.
However, it includes enough tools to use the COIN-OR build system, i.e., to run configure and co.
The difference between MinGW and MSYS seem to be that MinGW includes the GNU compiler collection. Thus, it can be used to build COIN-OR projects mostly as under Linux.
Further, using MS or Intel compilers and the compile_f2c script should be possible, see the corresponding notes in the Cygwin section.
Note, that it is important that the $PATH variable is setup such that the MS/Intel compiler paths come first (to find the correct link.exe), if used, the MinGW/MSYS paths come second (to find the correct sort.exe, find.exe), and the Windows system paths come last. See also the note on the current issues page.