wiki:BuildingWithMinGW

Version 7 (modified by Ari Jolma, 16 years ago) ( diff )

--

Get MinGW-5.1.3 exe, MSYS-1.0.10.exe, w32api-3.8.tar.gz, binutils-2.17.50-20060824-1.tar.gz and install them (this may not be a comprehensive list but start with MinGW and execute the install package and try to add gcc etc. - the tar packages you just unpack to c:\mingw). Then open MSYS prompt, go to the dir where you unpacked GDAL, and issue commands (but see below for configure switches):

./configure
make
make install

And you should have libgdal-1.dll in your c:\msys\1.0\local\bin and libgdal-1.dll.a in c:\msys\1.0\local\lib.

linking:

Edit libtool at line 6114 to sed out the MSYS-anchored absolute path and replace it by a relative path or possibly a Windows drive-based absolute path.

or

Edit GNUmakefile on lines 6-12 and replace $(GDAL_ROOT) with . (a dot).

expat:

By default configure tries to add support for Expat. To enable it, use configure switch --with-expat=/c/mingw, get libexpat.dll and create an import library into /c/mingw/lib with commands (in mingw\bin):

pexports libexpat.dll | perl def.pl >libexpat.def
dlltool -d libexpat.def -l ..\lib\libexpat.dll.a

where def.pl is a small perl program to add an underscored alias:

while (<STDIN>) {
    $a = $_;
    print $_;
    if (/^XML/) {
        chomp;
        s/\r//;
        print '_'."$_ = $a";
    }
}

see also http://trac.osgeo.org/gdal/ticket/2050

GTK+:

If you have a development version of GTK+ installed, its (old) libtiff may confuse the building. It is best to use --with-libtiff=internal and move tiff headers and libraries away from sight.

configure detects GTK+ provided libz, libpng and libjpeg but in compile time zlib.h etc are not found. This correct way to fix this is probably to use --with-jpeg=/c/gtk/include --with-libz=/c/gtk/include --with-png=/c/gtk/include.

PostgreSQL and PostGIS:

I've successfully used

--with-pg=/c/Progra~1/PostgreSQL/8.2/bin/pg_config

Note: See TracWiki for help on using the wiki.