wiki:DevWikiWinMingW64

Version 39 (modified by robe, 14 years ago) ( diff )

--

Compiling using MingGW-w64 for both 32-bit and 64-bit

Back to Compiling in Windows

1. Installing Minimalist GNU for Windows-w64 (MinGW-w64)

The objective will be to try to use the MingGW-w64 toolchain instead of the standard MingW since it has support for both 32-bit and 64-bit compiling. Note: We are not successful yet, but just writing down our steps as we go along.

Details of the prefixes of files can be found at What to download

MingW-w64 site is http://mingw-w64.sourceforge.net

starting with mingw-w64-1.0-bin_i686-mingw_

mingw-w32-1.0-bin_i686-mingw_ (for my purposes I used mingw-w32-1.0-bin_i686-mingw_20110408.zip)

  • Extract your respective zip into a folder called C:\mingw_w64 or c:\mingw_w32
  • Add c:\mingw_w64\bin (or c:\mingw_w32\bin) to your windows environment path variable in System Control Panel Advanced Settings -- PATH

2. Installing Msys

MSys is 32-bit but you can use it with your 32-bit or 64-bit mingw-w64. Instructions are here mingw-w64 with MSYS and repeated here for completeness

  • download Msys MSYS-20110309.zip
  • Extract into a folder called C:\Msys
  • launch msys.bat
  • type
sh /postinstall/pi.sh

When prompted type in C:/mingw_w64/mingw or C:/mingw_w32/mingw depending on which tool chain you chose Once done, type logout and the console should exit.

3. Installing Autoconf, Automake and Libtool

Relaunch C:\mysy\msys.bat

Verify which versions of these you have with

autoconf --version etc.

If they are not newer (or you get not found) than below then download and install. Download the source code from the GNU site and save to c:\projects

cd /c/projects
tar -xvf autoconf-2.65.tar.gz
cd autoconf-2.65
./configure --build=i686-w64-mingw32 --host=i686-w64-mingw32 (if you are building for 64-bit then use --build=x86_64-w64-mingw32)
make && make install
autoconf --version

repeat same exercise for automake

For libtool

cd /c/projects
tar -xvf libtool-2.4.10.tar.gz
cd libtool-2.4
./configure --build=i686-w64-mingw32 --host=i686-w64-mingw32 --target=i686-w64-mingw32  --disable-shared 
#if you are building for 64-bit then use --host=x86_64-w64-mingw32 for the build,host,target
make clean && make && make install
libtool --version

4. Compiling GEOS

Download latest GEOS source from http://trac.osgeo.org/geos/ either the http://download.osgeo.org/geos/geos-3.3.0.tar.bz2 or http://download.osgeo.org/geos/geos-svn.tar.bz2 and copy to c:\projects\geos. You can also use the trunk svn version https://svn.osgeo.org/geos/trunk. If you are using svn version, make sure to run:

sh autogen.sh

(THIS WE DON'T THINK IS NECESSARY ANYMORE and we didn't do it)

I had to comment out the lines as seen below, lines 159 and 166 in your mingw*\include\c++\4.4.6\cwchar

  //using ::swprintf;  
  //using ::vswprintf;


We don't think this is necessary either If you get errors about g++ and libstdc++ moved try this If you are runnning gcc 4.4.0+ and you get complaints about link g++ you probably need to do this too. Changing file: mingw*\i686-w64-mingw32\lib32\libstdc++.la

library_names='libstdc++.dll.a'

to

#library_names='libstdc++.dll.a' 
library_names='libstdc++.a'

#this currently fails at linker phase with a whole bunch of

simplify/.libs/libsimplify.a(TopologyPreservingSimplifier.o):TopologyPreservingS
implifier.cpp:(.rdata+0x1f0): undefined reference to `geos::geom::util::GeometryTransformer::transformGeometryCollection(geos::geom::GeometryCollection const*,
geos::geom::Geometry const*)'

and bunch of other classes in util::GeometryTransformer..
the .la file gets created so seems to be at linker phase.
cd /c/projects/geos
bzip2 -d -c geos-svn.tar.bz2 | tar xvf -
./configure --prefix=/c/projects/geos/rel-3.3.0 --build=i686-w64-mingw32 --host=i686-w64-mingw32 --target=i686-w64-mingw32
make
make install

To strip all the debug info weight from the libgeos DLL files, run

# strip /c/projects/bin/geos/rel-3.3.0/*.dll
Note: See TracWiki for help on using the wiki.