Changes between Version 2 and Version 3 of user-windows


Ignore:
Timestamp:
Dec 27, 2013 1:28:29 PM (6 years ago)
Author:
tkr
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • user-windows

    v2 v3  
    1 = Notes on Building COIN-OR projects under Windows =
     1= Notes on using COIN-OR projects under Windows =
    22
    3 There are ways to build COIN-OR projects even under Windows.
    4 However, one should keep in mind that this platform is only ''sporadically maintained''.
    5 Most '''COIN-OR projects are developed on a Unix-like system''' and do not focus primarily on supporting many other platforms.
    6 The platform of the developer, which is Linux in many cases, is usually the one where most of the testing is done.
    7 There is some effort to [https://projects.coin-or.org/TestTools 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.
     3There are a number of different ways to build COIN-OR projects even under Windows.
    84
    9 After these motivating words, this page tries to give a short overview on the possible tracks to build COIN-OR projects under Windows.
    10 It will be far from complete, a message that as usual comes with the reminder that this page is a wiki.
     5== Use Precompiled Binaries ==
    116
    12 == Abandon Windows ==
    13 
    14 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.
    15 There exist [http://en.wikipedia.org/wiki/Linux_distribution user-friendly Linux distributions] that are easy to install and use.
    16 
    17 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.
    18 
    19 == Use precompiled binaries ==
    20 
    21 The people behind COIN-OR put some effort in providing binary versions of executables and libraries, especially for Windows.
    22 
    23 The binaries are available at the [http://www.coin-or.org/download/binary COIN-OR binaries download page].
    24 If binaries for the particular project you are interested in are not available, have a look if it is included in the [http://www.coin-or.org/download/binary/CoinAll archives for the CoinAll project]. [https://projects.coin-or.org/CoinBinary CoinAll] is a selection of COIN-OR projects that are known to work together.
     7We have recently put a good deal of effort into providing binary versions of executables and libraries for Windows. We now have installers that work in the way that Windows users are used to. These are available at the binary download page for the [http://www.coin-or.org/download/binary/CoinAll COIN-OR Optimization Suite]. This suite provides a coherent set of the latest releases of all the COIN-OR projects that use the common build system and are known to work together. If you do not want to install the COIN-OR Optimization Suite for some reason, you can check whether binaries are available for specific individual projects at the [http://www.coin-or.org/download/binary COIN-OR binaries download page]. However, because of the large number of projects we distribute, regularly update binaries for other projects are probably not available.
    258
    269== Using MS Visual Studio ==
    2710
    28 The developer of the Windows system, Microsoft, also provides a tool for developing applications under Windows, called Microsoft Visual Studio (MSVS).
    29 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.
     11If you are developing on Windows, you are very likely using Microsoft Visual Studio (MSVS). There are alternatives to using this IDE, which may make your life much easier (see below). However, we understand that there are many users who either have no choice or prefer the MSVC++ IDE on Windows. Therefore, we provide solution files for building under MSVC++ for most projects. The [https://projects.coin-or.org/MSVisualStudio COIN-OR Visual Studio wiki] describes the organization and use of these files and for which projects they are available.
    3012
    31 Instead, a group of fearless COIN-OR maintainers took up the task to '''provide MSVS project files''' for some projects. The [https://projects.coin-or.org/MSVisualStudio COIN-OR Visual Studio wiki] describes the organization and use of these files and for which projects they are available.
     13== Building under Cygwin and/or MSys/MinGW ==
    3214
    33 == Using Cygwin ==
     15[http://www.cygwin.com CYGWIN] is a port of many of the tools available on Unix-based systems to Windows. CYGWIN provides a Unix shell and standard set of Linux tools, thus allowing one to work as if in a Unix-based system within a Windows environment. This makes it possible to use the COIN-OR build system, which in turn makes it much easier to build with certain options than Visual Studio. CYGWIN is, however, a rather heavy-weight installation. A lighter-weight alternative is the MSys shell th is provided by the [http://www.mingw.org MinGW] project. MSys provides a shell and a minimal set of standard Unix tools, which can be used to deploy the COIN-OR build system in the same way as on a Unix-based platform. Note that with Msys, one also needs to install the MinGW compiler suite if the Microsoft compilers are not available.
    3416
    35 [http://www.cygwin.com Cygwin] is a project that tries to emulate a Linux running on top of Windows.
    36 I.e., it provides a Unix shell and standard Linux tools, thus allowing one to work as under a real Linux system.
    37 Thus, it makes it possible to use the default COIN-OR build system under Cygwin.
     17Note that there are now two version of CYGWIN available---a full 64-bit version and the legacy 32-bit version. In general, the 32-bit version seems to be a bit more stable and is all that most people need. You may consider the 64-bt version if you plan to solver very large-scale instances that require a lot of memory or processing power.
    3818
    3919=== Building with GNU compilers ===
    4020
    41 Cygwin also includes the GNU compiler collection, including {{{gcc}}}, {{{g++}}}, and {{{gfortran}}}.
    42 The strong emulation of Linux by Cygwin allows to build most COIN-OR projects that also build under Linux with GNU compilers.
     21With CYGWIN, one has the option to install the GNU compiler collection, including {{{gcc}}}, {{{g++}}}, and {{{gfortran}}}. It is recommended to install the MinGW versions of these compilers, which build binaries that do not depend on the CYGWIN DLL. Note that building with these compilers is technically considered "cross-compiling" and requires an addition configure option. Once the GNU compilers are installed, building proceeds exactly as in the [https://projects.coin-or.org/BuildTools/wiki/downloadUnix Unix]. First, download the code as explained [https://projects.coin-or.org/BuildTools/wiki/downloadUnix here] and then the usual incactation should work.
    4322
    44 '''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.[[BR]]
    45 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.
    46 This compiler flag can be added by using the configure option {{{--enable-doscompile=mingw}}}.
     23{{{
     24configure
     25make
     26make install
     27}}}
    4728
    48 Note further, that some Cygwin distributions include a '''buggy make''' binary, which may result in failing builds.
    49 Regarding this issue and '''other issues''' with Cygwin builds, please consult the [wiki:current-issues current issues page].
     29You will have to add the option {{{--host=i686-pc-mingw32}}} to use the 32-bit MinGW compilers or the option {{{--host=x86_64-w64-mingw32}}} to use the 64-bit MinGW compilers. It is recommended to use the compilers matching the version of CYGWIN you have.
    5030
    51 === Building with MS or Intel compilers ===
     31Under MSys, the same incantation should work, but using the MinGW compilers is not cross-compiling there.
    5232
    53 It is also possible to use MS or Intel compilers while still using COIN-OR build system under Cygwin.
    54 The way it works is that Unix-paths are translated into Windows-paths using the {{{cygpath}}} tool at the time the compiler is called.
    55 The whole system is a bit fragile, so don't be surprised if some things don't work.
     33=== Building MinGW DLLs ===
    5634
    57 Note that setting up the '''{{{$PATH}}} variable''' under Cygwin in a way that it finds the MS or Intel compilers is important.
     35It is now possible to build DLLs using the MinGW compilers. To do that is add the options
    5836
    59 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.
     37{{{
     38--enable-shared --enable-static --enable-dependency-linking lt_cv_deplibs_check_method=pass_all
     39}}}
    6040
    61 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.
    62 This does not work for Fortran90.[[BR]]
    63 See the [source:stable/0.7/compile_f2c/INSTALL INSTALL file] on instructions on how to install {{{compile_f2c}}}.
    64 If configure is called with {{{--enable-doscompile=msvc}}} and no other Fortran compiler is available, compile_f2c will be chosen automatically.
     41along with the appropriate flag for cross-compiling. Both DLLs and statoc libraries will be produced.
    6542
    66 == Using MinGW / MSYS ==
     43=== Building with the MSVC++ compilers ===
    6744
    68 [http://www.mingw.org MinGW] is a sort of minimal version of Cygwin.
    69 It brings a shell and a set of standard Unix tools, but does not try to emulate a full Linux system.
     45It is possible to use MSVC++ compilers to build COIN-OR codes using the auto tools from within CYGWIN or MSys. This will utilize the power of the build system while still producing MSVC++-compatible binaries in a fully automated way without having to invoke the MSVC++ IDE, which can be difficult. Note that setting up the '''{{{$PATH}}} variable''' under Cygwin in a way that it finds the MS or Intel compilers is important (see discussion [https://projects.coin-or.org/BuildTools/wiki/current-issues#Configuration here]). Adding the Intel compiler suite allows the compilation of Fortran codes. Alternatively, 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.
     46This does not work for Fortran90. See the [source:stable/0.7/compile_f2c/INSTALL INSTALL file] on instructions on how to install {{{compile_f2c}}}.
    7047
    71 However, it includes enough tools to use the COIN-OR build system, i.e., to run configure and co.
     48To build with MSVC++ compilers, make sure that you have run the proper batch scripts to set up the environment ({{{vcvarsall.bat}}} and or {{{ifortvars.bat}}}) and that these environment variables have been peroperly inherited into your CYGWIN or MSys shell. Then follow the instructions for Unix-based systems [https://projects.coin-or.org/BuildTools/wiki/downloadUnix here], but when configuring, add the option
    7249
    73 The difference between MinGW and MSYS seem to be that MinGW includes the GNU compiler collection.
    74 Thus, it can be used to build COIN-OR projects mostly as under Linux.
     50{{{
     51configure --enable-msvc=MD
     52}}}
    7553
    76 Further, using MS or Intel compilers and the {{{compile_f2c}}} script should be possible, see the corresponding notes in the Cygwin section.
     54The argument to {{{--enable-msvc}}} specifies the run-time library flag to be used (see discussion [http://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx here]). The flag {{{\MD}}} is the default for COIN and is the right one for building Python extensions, among other things.
    7755
    78 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.
    79 See also the note on the [wiki:current-issues#MinGWPath current issues page].