Changes between Initial Version and Version 1 of DevWikiMingW64_Setup


Ignore:
Timestamp:
May 2, 2013, 10:15:25 PM (11 years ago)
Author:
robe
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • DevWikiMingW64_Setup

    v1 v1  
     1= Building with MingW64 w64, w32 chains =
     2== 1. Installing Minimalist GNU for Windows-w64 (MinGW-w64) ==
     3The mingw64 for build 32-bit binaries only works for PostgreSQL 9.2+.  There are changes they did in 9.2 that were never backported to 9.1 and below. So to compile PostGIS for 32-bit for 9.1 and below you need to use the regular old Msys instructions. mingw64 chain will work for 64-bit 9.0-9.3 and for 32-bit 9.2-9.3.
     4
     5We will use MingGW-w64 toolchain instead of the standard MingW since it has support for both 32-bit and 64-bit compiling.
     6For this discussion we are using the binaries built for running on Windows. We haven't tried the builds designed for building windows binaries under ''Linux/Unix''.
     7
     8Details of the prefixes of files can be found at [http://sourceforge.net/apps/trac/mingw-w64/wiki/download%20filename%20structure What to download]
     9
     10MingW-w64 site is [http://mingw-w64.sourceforge.net]
     11There are issues with GEOS compile above 4.5.4 or so, in 4.6.1+, the make check crashes and so does
     12PostGIS tests when compiled with GCC 4.6+.  That said you should pick a build lower than GCC 4.6. We like GCC 4.5.4
     13Issues are documented in http://trac.osgeo.org/geos/ticket/518 (also similar issue compiling Geos under windows 64-bit SDK http://trac.osgeo.org/geos/ticket/528 )
     14
     15 * If you are building for 64-bit Windows download the personal build from [http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/sezero_4.5_20111101/] with name
     16starting with '''mingw-w64-bin_x86_64-mingw_20111101_sezero.zip'''
     17
     18 * If you are building for 32-bit Windows download one of the binary packages from [http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/sezero_4.5_20111101/] with name starting with
     19'''mingw-w32-bin_i686-mingw_20111101_sezero.zip'''
     20
     21 * Extract your respective zip into a folder called C:\ming64\mingw64 or c:\ming32\mingw32
     22 * Download the latest patch in same folder e.g. sezero_20111101-w32-update-rev.5151.zip for win32, sezero_20111101-w64-update-rev.5151.zip for win64 and extract into same respective folders. There might be a newer patch use that one.
     23
     24
     25
     26/** NOTE to self: This may not be necessary anymore **/
     27GEOS fails to link if it picks up 32-bit dlls so to overcome this, I copied over the dlls from windows/sytem32 and renamed them as
     28described in
     29#linking errors seems to be caused by as described here [http://www.gaia-gis.it/spatialite-3.0.0-BETA/mingw64_how_to.html#env]
     30mingw64 is picking up the 32-bit dlls from syswow64 instead of the 64-bit dlls from windows/system32
     31I only needed to copy ws2_32.dll for geos to compile without errors
     32Others may be needed not sure.
     33with windows explorer copy the files from windows/system32
     34
     35{{{
     36ws2_32.dll
     37}}}
     38
     39To your folder: C:\ming64\x86_64-w64-mingw32\lib
     40and then rename them adding a lib extensions so you have
     41{{{
     42libws2_32.dll
     43# these ones didn't seem necessary for PostGIS: libmsimg32.dll,libgdi32.dll, libcrypt32.dll and libwldap32.dll
     44}}}
     45
     46
     47== prefixed files ==
     48These sometimes exist only with the prefixes and cause issues during compilation so you'll need prefixless versions
     49
     50{{{
     51cp /mingw/bin/x86_64-w64-mingw32-cpp.exe /mingw/bin/cpp.exe
     52cp /mingw/bin/x86_64-w64-mingw32-strip.exe /mingw/bin/strip.exe
     53}}}
     54
     55== 2. Installing Msys ==
     56
     57MSys is 32-bit but you can use it with your 32-bit or 64-bit mingw-w64.  Instructions are here [http://sourceforge.net/apps/trac/mingw-w64/wiki/MSYS mingw-w64 with MSYS] and repeated
     58here for completeness
     59
     60 *  download [http://sourceforge.net/projects/mingw-w64/files/External%20binary%20packages%20%28Win64%20hosted%29/MSYS%20%2832-bit%29/ Msys] MSYS-20110309.zip (update there is now a newer MSYS -- MSYS-20110526.zip)
     61 * Extract into a folder called C:\Ming64\msys (or C:\Ming32\msys)
     62 * launch msys.bat
     63 * type
     64
     65{{{
     66sh /postinstall/pi.sh
     67}}}
     68
     69When prompted type in
     70{{{C:/ming64/mingw64}}} or {{{C:/ming32/mingw32}}}  depending on which tool chain you chose
     71Once done, type logout and the console should exit.
     72Note: You can have both if you are using windows 64-bit and we do.
     73
     74GEOS also gives missing vtable message during link.  I think this was caused by msys missing find.exe, so I copied the find.exe from regular msys package ( as instructed in the [http://www.gaia-gis.it/spatialite-3.0.0-BETA/mingw64_how_to.html#env] to bin of respective ming64/ming32 msys folders.
     75
     76== 3a. Installing Autoconf, Automake and Libtool ==
     77Relaunch C:\ming64\msys\msys.bat (or c:\ming32\msys\msys.bat)
     78
     79
     80
     81
     82We create a file with commands like this
     83and make sure this is included in all my compile scripts
     84
     85{{{
     86#if you are building for 32-bit change ming64 to ming32
     87export PROJECTS=/c/ming64/projects
     88#for a 64-bit build
     89export MINGHOST=x86_64-w64-mingw32
     90#if you are building for 32-bit change to this
     91#export MINGHOST=i686-w64-mingw32
     92
     93#this part is not necessary
     94#but we like to prefix our binary folders with
     95#version
     96export OS_BUILD=64 #change to 32 if building for 32
     97}}}
     98
     99{{{
     100#if you are building for 32-bit change ming64 to ming32
     101mkdir ${PROJECTS}
     102}}}
     103
     104
     105Verify which versions of these you have with
     106
     107autoconf --version
     108
     109etc.
     110
     111If they are not newer (or you get not found) than below then download and install.
     112Download the source code from the GNU site and save to c:\projects
     113
     114 * http://ftp.gnu.org/gnu/autoconf/autoconf-2.65.tar.gz
     115 * http://ftp.gnu.org/gnu/automake/automake-1.11.1.tar.gz
     116 * http://ftp.gnu.org/gnu/libtool/libtool-2.4.tar.gz
     117
     118
     119{{{
     120
     121cd ${PROJECTS}
     122tar -xvf autoconf-2.65.tar.gz
     123cd autoconf-2.65
     124./configure --host=${MINGHOST} --prefix=/mingw  (if you are building for 32-bit then use --host=i686-w64-mingw32)
     125make && make install
     126autoconf --version
     127}}}
     128
     129repeat same exercise for automake
     130
     131For libtool
     132{{{
     133cd ${PROJECTS}
     134tar -xvf libtool-2.4.10.tar.gz
     135
     136cd libtool-2.4.10
     137./configure --host=${MINGHOST} --disable-shared --prefix=/mingw
     138#if you get a message that gcc is not usable, then you probably set your
     139# mingw setting wrong or did not install automake/autotools in /mingw
     140#try to fix by rerunning the sh /postinstall/pi.sh again
     141make clean && make && make install
     142libtool --version
     143
     144}}}
     145