[HelpOnLanguages] [TitleIndex] [WordIndex]

HowToCompileOnWindows

We are currently trying to compile openModeller using cygwin/mingw to run it on Windows. Instructions about the older compilation method can be found in CompilingWithVcpp.

1. Testing and setup of your environment

1. Download and install Cygwin with all development tools. Versions of relevant packages:

autoconf v2.59
automake v1.9.5
libtool v1.5.18

2. Download and install MinGW (I used package version 4.1). Version of relevant packages:

gcc v3.4.2 (mingw-special)
ld v2.15.91

3. Open a Cygwin bash shell and set the PATH environment variable to include MinGW bin directory before Cygwin /usr/bin. Also we will graft the Qt4 installed mingw into the cyg directory hierach using a symlink. If Cygwin and MinGW were installed in their default paths (C:\cygwin and C:\MinGW, respectively) you can use the command as follows:

cd /usr
ln -sf /cygdrive/c/MingW mingw
echo "export PATH=/usr/mingw/bin:/usr/bin:/cygdrive/c/WINDOWS/system32" >> ~/.bashrc
source ~/.bashrc

Your path should now be set appropriately each time you log in.

4. Test your setup with the following commands.

which gcc

Which should show something like:

/usr/mingw/bin/gcc

and ...

libtool --version

which should show something like:

ltmain.sh (GNU libtool) 1.5.18 (1.1220.2.246 2005/05/16 10:00:18)

Copyright (C) 2005  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Make sure you get MinGW version of gcc and libtool version 1.5.x or later.

I suggest you checkout / unarchive any sources into /usr/local/src to prevent any potential issues with space laden paths that may occur if your default home dir is off somewhere in Documents and settings/foouser:

cd /usr/local
mkdir src

Lastly you should make the default .cvspass file for cvs checkouts described below:

touch ~/.cvspass

2. Compiling dependencies

2.1. Expat

Checkout a version of Expat from SourceForge CVS site. The latest packaged source distribution won't work because it uses a buggy version of libtool (v1.4.x). To check out expat from CVS, use the following commands:

cd /usr/local/src
cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/expat login 
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/expat co -P expat

Build and install Expat using the following commands:

cd expat
./buildconf.sh
./configure --prefix=/usr/mingw --host=mingw32
make install

Find and delete file /usr/mingw/lib/libexpat.la I found that this libtool script file was confusing later steps of the build.

rm /usr/mingw/lib/libexpat.la

2.2. PROJ

cd /usr/local/src
cvs -d :pserver:cvsanon@cvs.maptools.org:/cvs/maptools/cvsroot login
cvs -d :pserver:cvsanon@cvs.maptools.org:/cvs/maptools/cvsroot co proj
cd proj
./configure --prefix=/usr/mingw --build=mingw32 --target=mingw32 --without-libtool
make install

2.3. HDF

cd /usr/local/src
wget ftp://ftp.ncsa.uiuc.edu/HDF/pub/outgoing/hdf4/hdf4.2r1/hdf4.2r1.tar.gz
tar xvfz hdf4.2r1.tar.gz
cd hdf4.2r1



=== GDAL ===

Download the source version of GDAL. I have used latest version from CVS HEAD from March 3, 2006. 

e.g.

{{{
cd /usr/local/src
export CVSROOT=:pserver:cvsanon@cvs.maptools.org:/cvs/maptools/cvsroot
cvs co gdal
cd gdal

Edit C:\cygwin\usr\local\src\gdal\frmts\jpeg\libjpeg\jmorecfg.h and edit around line 230 this:

#ifndef HAVE_BOOLEAN
# if defined (_WIN32)
#  ifndef __RPCNDR_H__
    typedef unsigned char boolean;
#  endif
# else
    typedef int boolean;
# endif
#endif
#ifndef FALSE                   /* in case these macros already exist */
#define FALSE   0               /* values of boolean */
#endif
#ifndef TRUE
#define TRUE    1
#endif

to look like this:

typedef int boolean;
#define FALSE   0               /* values of boolean */
#define TRUE    1
#ifndef INT32
typedef long INT32;
#endif

Next look for around line 158 you will find

/* INT32 must hold at least signed 32-bit values. */

#ifndef XMD_H                   /* X11/xmd.h correctly defines INT32 */
#ifndef _BASETSD_H
typedef long INT32;
#endif
#endif

and comment out the definition of INT32:

/* INT32 must hold at least signed 32-bit values. */

#ifndef XMD_H                   /* X11/xmd.h correctly defines INT32 */
#ifndef _BASETSD_H
//typedef long INT32;
#endif
#endif

Next edit C:\cygwin\usr\local\src\gdal\GDALMake.opt and add jpeg to the GDALFormats variable:

GDAL_FORMATS =  gxf gtiff hfa aigrid aaigrid ceos ceos2 iso8211 xpm \
                sdts raw dted mem jdem envisat elas fit vrt usgsdem l1b \
                nitf bmp pcidsk airsar rs2 ilwis rmf rik leveller sgi \
                bsb gif png pcraster zlib

becomes

GDAL_FORMATS =  gxf gtiff hfa aigrid aaigrid ceos ceos2 iso8211 xpm \
                sdts raw dted mem jdem envisat elas fit vrt usgsdem l1b \
                nitf bmp pcidsk airsar rs2 ilwis rmf rik leveller sgi \
                bsb gif png pcraster zlib jpeg

Configure GDAL it using the following command:

./configure --prefix=/usr/mingw --build=mingw32 --target=mingw32 --without-libtool --with-python=no  --enable-static --enable-fast-install --with-libz=internal --with-pcraster=internal --with-png=internal --with-libtiff=internal --with-geotiff=internal --with-jpeg=internal --with-gif=internal --with-hdf4

Now build GDAL.

make install

2.4. GSL

GSL (The gnu scientific library) is needed for the CSM algorithm. There are prebuild mingw binaries and developer files available for it from the GnuWin32 project. {http://kent.dl.sourceforge.net/sourceforge/gnuwin32/gsl-1.6.exe Download the installer] and then install into c:\temp or somewhere impermanent. Now copy the files into your c:\MinGW folder. You can do this any way you prefer - just make sure your bin, lib, include etc directories are grafted into the same place in the c:\MinGW tree.

2.5. PThreads

Winodws does not natively support the pthreads standard, so you need to install the win32 version of pthreads. Grab the precompiled headers and libs from the pthreads download page. Paste the lib and include dirs into c:\mingw\

3. Compiling openModeller itself

There are two ways to build:

3.1. Building with qmake

To use this method you need to have qt4 installed (instructions for doing this are provided on the omgui windows build page) Use tortoise to check out the om sources:

protocol: pserver
user : anonymous
server : openmodeller.cvs.sourceforge.net
cvsroot: /cvsroot/openmodeller
module : om

Then open the qt4 console and

cd c:\dev\cpp\om
qmake
make

3.2. Building in Cygwin

/!\ Note This method is not currently working for me. We will check out the sources anonymously from CVS into /usr/local/src and then build them into our mingw directory:

cd /usr/local/src
cvs -d:pserver:anonymous@openmodeller.cvs.sourceforge.net:/cvsroot/openmodeller login
cvs -z3 -d:pserver:anonymous@openmodeller.cvs.sourceforge.net:/cvsroot/openmodeller co -P om
cd om
export PATH=$PATH:/cygrive/c/mingw/bin
./autogen.sh
./configure --prefix=/usr/mingw --build=mingw32 --target=mingw32 --without-libool
make install

4. Building the openModeller GUI

Now follow the instructions at the omgui windows build page to build the openModeller gui.


2014-08-13 10:36