7 | | == 1. Installing Minimalist GNU for Windows-w64 (MinGW-w64) == |
8 | | The 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. |
9 | | |
10 | | We will use MingGW-w64 toolchain instead of the standard MingW since it has support for both 32-bit and 64-bit compiling. |
11 | | For 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''. |
12 | | |
13 | | Details of the prefixes of files can be found at [http://sourceforge.net/apps/trac/mingw-w64/wiki/download%20filename%20structure What to download] |
14 | | |
15 | | MingW-w64 site is [http://mingw-w64.sourceforge.net] |
16 | | There are issues with GEOS compile above 4.5.4 or so, in 4.6.1+, the make check crashes and so does |
17 | | PostGIS 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 |
18 | | Issues 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 ) |
19 | | |
20 | | * 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 |
21 | | starting with '''mingw-w64-bin_x86_64-mingw_20111101_sezero.zip''' |
22 | | |
23 | | * 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 |
24 | | '''mingw-w32-bin_i686-mingw_20111101_sezero.zip''' |
25 | | |
26 | | * Extract your respective zip into a folder called C:\ming64\mingw64 or c:\ming32\mingw32 |
27 | | * 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. |
28 | | |
29 | | |
30 | | |
31 | | /** NOTE to self: This may not be necessary anymore **/ |
32 | | GEOS 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 |
33 | | described in |
34 | | #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] |
35 | | mingw64 is picking up the 32-bit dlls from syswow64 instead of the 64-bit dlls from windows/system32 |
36 | | I only needed to copy ws2_32.dll for geos to compile without errors |
37 | | Others may be needed not sure. |
38 | | with windows explorer copy the files from windows/system32 |
39 | | |
40 | | {{{ |
41 | | ws2_32.dll |
42 | | }}} |
43 | | |
44 | | To your folder: C:\ming64\x86_64-w64-mingw32\lib |
45 | | and then rename them adding a lib extensions so you have |
46 | | {{{ |
47 | | libws2_32.dll |
48 | | # these ones didn't seem necessary for PostGIS: libmsimg32.dll,libgdi32.dll, libcrypt32.dll and libwldap32.dll |
49 | | }}} |
50 | | |
51 | | |
52 | | == prefixed files == |
53 | | These sometimes exist only with the prefixes and cause issues during compilation so you'll need prefixless versions |
54 | | |
55 | | {{{ |
56 | | cp /mingw/bin/x86_64-w64-mingw32-cpp.exe /mingw/bin/cpp.exe |
57 | | cp /mingw/bin/x86_64-w64-mingw32-strip.exe /mingw/bin/strip.exe |
58 | | }}} |
59 | | |
60 | | == 2. Installing Msys == |
61 | | |
62 | | MSys 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 |
63 | | here for completeness |
64 | | |
65 | | * 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) |
66 | | * Extract into a folder called C:\Ming64\msys (or C:\Ming32\msys) |
67 | | * launch msys.bat |
68 | | * type |
69 | | |
70 | | {{{ |
71 | | sh /postinstall/pi.sh |
72 | | }}} |
73 | | |
74 | | When prompted type in |
75 | | {{{C:/ming64/mingw64}}} or {{{C:/ming32/mingw32}}} depending on which tool chain you chose |
76 | | Once done, type logout and the console should exit. |
77 | | Note: You can have both if you are using windows 64-bit and we do. |
78 | | |
79 | | GEOS 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. |
80 | | |
81 | | == 3a. Installing Autoconf, Automake and Libtool == |
82 | | Relaunch C:\ming64\msys\msys.bat (or c:\ming32\msys\msys.bat) |
83 | | |
84 | | |
85 | | |
86 | | |
87 | | We create a file with commands like this |
88 | | and make sure this is included in all my compile scripts |
89 | | |
90 | | {{{ |
91 | | #if you are building for 32-bit change ming64 to ming32 |
92 | | export PROJECTS=/c/ming64/projects |
93 | | #for a 64-bit build |
94 | | export MINGHOST=x86_64-w64-mingw32 |
95 | | #if you are building for 32-bit change to this |
96 | | #export MINGHOST=i686-w64-mingw32 |
97 | | |
98 | | #this part is not necessary |
99 | | #but we like to prefix our binary folders with |
100 | | #version |
101 | | export OS_BUILD=64 #change to 32 if building for 32 |
102 | | }}} |
103 | | |
104 | | {{{ |
105 | | #if you are building for 32-bit change ming64 to ming32 |
106 | | mkdir ${PROJECTS} |
107 | | }}} |
108 | | |
109 | | |
110 | | Verify which versions of these you have with |
111 | | |
112 | | autoconf --version |
113 | | |
114 | | etc. |
115 | | |
116 | | If they are not newer (or you get not found) than below then download and install. |
117 | | Download the source code from the GNU site and save to c:\projects |
118 | | |
119 | | * http://ftp.gnu.org/gnu/autoconf/autoconf-2.65.tar.gz |
120 | | * http://ftp.gnu.org/gnu/automake/automake-1.11.1.tar.gz |
121 | | * http://ftp.gnu.org/gnu/libtool/libtool-2.4.tar.gz |
122 | | |
123 | | |
124 | | {{{ |
125 | | |
126 | | cd ${PROJECTS} |
127 | | tar -xvf autoconf-2.65.tar.gz |
128 | | cd autoconf-2.65 |
129 | | ./configure --host=${MINGHOST} --prefix=/mingw (if you are building for 32-bit then use --host=i686-w64-mingw32) |
130 | | make && make install |
131 | | autoconf --version |
132 | | }}} |
133 | | |
134 | | repeat same exercise for automake |
135 | | |
136 | | For libtool |
137 | | {{{ |
138 | | cd ${PROJECTS} |
139 | | tar -xvf libtool-2.4.10.tar.gz |
140 | | |
141 | | cd libtool-2.4.10 |
142 | | ./configure --host=${MINGHOST} --disable-shared --prefix=/mingw |
143 | | #if you get a message that gcc is not usable, then you probably set your |
144 | | # mingw setting wrong or did not install automake/autotools in /mingw |
145 | | #try to fix by rerunning the sh /postinstall/pi.sh again |
146 | | make clean && make && make install |
147 | | libtool --version |
148 | | |
149 | | }}} |
150 | | |
| 7 | If you want to start with your own mingw64 install and then add additional items refer to [DevWikiMingW64_Setup] |