| 1 | == Compiling using MingGW-w64 for 64-bit == |
| 2 | [wiki:UsersWikiWinCompile Back to Compiling in Windows] |
| 3 | |
| 4 | There are issues with GEOS compile above 4.5.4 or so, in 4.6.1+, the make check crashes and so does |
| 5 | 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 |
| 6 | 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 ) |
| 7 | |
| 8 | == 1. Installing Minimalist GNU for Windows-w64 (MinGW-w64) == |
| 9 | We will use MingGW-w64 toolchain instead of the standard MingW since it has support for both 32-bit and 64-bit compiling. |
| 10 | 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. |
| 11 | |
| 12 | Details of the prefixes of files can be found at [http://sourceforge.net/apps/trac/mingw-w64/wiki/download%20filename%20structure What to download] |
| 13 | |
| 14 | MingW-w64 site is [http://mingw-w64.sourceforge.net] |
| 15 | |
| 16 | * If you are building for 64-bit Windows download the sezero personal build from [http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/sezero_4.5_20111101/] with name |
| 17 | starting with '''mingw-w64-bin_x86_64-mingw_20111101_sezero.zip''' |
| 18 | |
| 19 | * 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 |
| 20 | '''mingw-w32-bin_i686-mingw_20111101_sezero.zip''' |
| 21 | |
| 22 | * Extract your respective zip into a folder called C:\ming64\mingw64 or c:\ming32\mingw32 |
| 23 | * 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. |
| 24 | |
| 25 | |
| 26 | |
| 27 | /** NOTE to self: This may not be necessary anymore **/ |
| 28 | 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 |
| 29 | described in |
| 30 | #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] |
| 31 | mingw64 is picking up the 32-bit dlls from syswow64 instead of the 64-bit dlss from windows/system32 |
| 32 | I only needed to copy ws2_32.dll for geos to compile without errors |
| 33 | Others may be needed not sure. |
| 34 | with windows explorer copy the files from windows/system32 |
| 35 | |
| 36 | {{{ |
| 37 | ws2_32.dll |
| 38 | }}} |
| 39 | |
| 40 | To your folder: C:\ming64\x86_64-w64-mingw32\lib |
| 41 | and then rename them adding a lib extensions so you have |
| 42 | {{{ |
| 43 | libws2_32.dll |
| 44 | # these ones didn't seem necessary for PostGIS: libmsimg32.dll,libgdi32.dll, libcrypt32.dll and libwldap32.dll |
| 45 | }}} |
| 46 | |
| 47 | 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 packaged as instructed in the above link to bin of my msys. |
| 48 | |
| 49 | |
| 50 | == prefixed files == |
| 51 | These sometimes exist only with the prefixes and cause issues during compilation so you'll need prefixless versions |
| 52 | |
| 53 | {{{ |
| 54 | cp /mingw/bin/x86_64-w64-mingw32-cpp.exe /mingw/bin/cpp.exe |
| 55 | cp /mingw/bin/x86_64-w64-mingw32-strip.exe /mingw/bin/strip.exe |
| 56 | }}} |
| 57 | |
| 58 | == 2. Installing Msys == |
| 59 | |
| 60 | 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 |
| 61 | here for completeness |
| 62 | |
| 63 | * 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) |
| 64 | * Extract into a folder called C:\Msys |
| 65 | * launch msys.bat |
| 66 | * type |
| 67 | |
| 68 | {{{ |
| 69 | sh /postinstall/pi.sh |
| 70 | }}} |
| 71 | |
| 72 | When prompted type in |
| 73 | {{{C:/ming64/mingw64}}} or {{{C:/ming32/mingw32}}} depending on which tool chain you chose |
| 74 | Once done, type logout and the console should exit. |
| 75 | |
| 76 | == 3a. Installing Autoconf, Automake and Libtool == |
| 77 | Relaunch C:\mysy\msys.bat |
| 78 | |
| 79 | {{{ |
| 80 | export PROJECTS=/c/ming64/projects |
| 81 | }}} |
| 82 | |
| 83 | |
| 84 | Verify which versions of these you have with |
| 85 | |
| 86 | autoconf --version |
| 87 | |
| 88 | etc. |
| 89 | |
| 90 | If they are not newer (or you get not found) than below then download and install. |
| 91 | Download the source code from the GNU site and save to c:\projects |
| 92 | |
| 93 | * http://ftp.gnu.org/gnu/autoconf/autoconf-2.65.tar.gz |
| 94 | * http://ftp.gnu.org/gnu/automake/automake-1.11.1.tar.gz |
| 95 | * http://ftp.gnu.org/gnu/libtool/libtool-2.4.tar.gz |
| 96 | |
| 97 | |
| 98 | {{{ |
| 99 | |
| 100 | cd ${PROJECTS} |
| 101 | tar -xvf autoconf-2.65.tar.gz |
| 102 | cd autoconf-2.65 |
| 103 | ./configure --host=x86_64-w64-mingw32 --prefix=/mingw (if you are building for 32-bit then use --host=i686-w64-mingw32) |
| 104 | make && make install |
| 105 | autoconf --version |
| 106 | }}} |
| 107 | |
| 108 | repeat same exercise for automake |
| 109 | |
| 110 | For libtool |
| 111 | {{{ |
| 112 | cd ${PROJECTS} |
| 113 | tar -xvf libtool-2.4.10.tar.gz |
| 114 | |
| 115 | cd libtool-2.4.10 |
| 116 | ./configure --host=x86_64-w64-mingw32 --disable-shared --prefix=/mingw |
| 117 | #if you are building on 32-bit then use --host=i686-w64-mingw32 for the host |
| 118 | #if you get a message that gcc is not usable, then you probably set your |
| 119 | # mingw setting wrong or did not install automake/autotools in /mingw |
| 120 | #try to fix by rerunning the sh /postinstall/pi.sh again |
| 121 | make clean && make && make install |
| 122 | libtool --version |
| 123 | |
| 124 | }}} |
| 125 | |
| 126 | == 3.b create project folders == |
| 127 | |
| 128 | {{{ |
| 129 | export PROJECTS=/c/ming64/projects |
| 130 | cd ${PROJECTS} |
| 131 | mkdir pg |
| 132 | mkdir postgresql |
| 133 | mkdir geos |
| 134 | mkdir proj |
| 135 | mkdir docbook |
| 136 | ls |
| 137 | |
| 138 | }}} |
| 139 | |
| 140 | == GDAL == |
| 141 | {{{ |
| 142 | export GDAL_VER=1.9.1 |
| 143 | cd ${PROJECTS}/gdal |
| 144 | wget http://download.osgeo.org/gdal/gdal-${GDAL_VER}.tar.gz |
| 145 | tar xvfz gdal-1.9.1.tar.gz |
| 146 | cd gdal-${GDAL_VER} |
| 147 | ./configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --with-threads=no --prefix=${PROJECTS}/gdal/rel-${GDAL_VER}w64 |
| 148 | make && make install |
| 149 | cd ${PROJECTS}/gdal/rel-${GDAL_VER}w64/bin |
| 150 | strip *.dll |
| 151 | }}} |
| 152 | |
| 153 | == DOWNLOAD DOCBOOK == |
| 154 | cd ${PROJECTS}/docbook |
| 155 | Download the latest Docbook from http://sourceforge.net/projects/docbook/files/docbook-xsl/ |
| 156 | into that folder and untar. |
| 157 | |
| 158 | Extract somewhere. In this case I chose my projects folder. You'll need to set this folder for the --with-xsldir |
| 159 | setting |
| 160 | |
| 161 | You should have a folder now docbook/docbook-xsl-1.76.1 or something similar |
| 162 | |
| 163 | |
| 164 | == 4. Compiling GEOS == |
| 165 | |
| 166 | Download latest GEOS source from http://trac.osgeo.org/geos/ either the http://download.osgeo.org/geos/geos-3.3.3.tar.bz2 |
| 167 | You can also use the trunk svn version https://svn.osgeo.org/geos/trunk. If you are using svn version, make sure to run: |
| 168 | |
| 169 | {{{ |
| 170 | sh autogen.sh |
| 171 | }}} |
| 172 | |
| 173 | |
| 174 | this fails at linker phase with a whole bunch of errors if you compile without doing |
| 175 | #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] |
| 176 | mingw64 is picking up the 32-bit dlls from syswow64 instead of the 64-bit dlss from windows/system32 |
| 177 | I may have over-copied, but to remedy before evening starting configure |
| 178 | with windows explorer copy the files from windows/system32 |
| 179 | |
| 180 | {{{ |
| 181 | ws2_32.dll, kernel32.dll, advapi32.dll, mscvrt.dll, user32.dll |
| 182 | }}} |
| 183 | |
| 184 | To your folder: C:\mingw\mingw64\x86_64-w64-mingw32\lib |
| 185 | and then rename them adding a lib extensions so you have |
| 186 | {{{ |
| 187 | libws2_32.dll, libkernel32.dll, libadvapi32.dll, libmscvrt.dll, libuser32.dll |
| 188 | }}} |
| 189 | |
| 190 | # hack described in [http://www.gaia-gis.it/spatialite-3.0.0-BETA/mingw64_how_to.html#libgeos] |
| 191 | |
| 192 | {{{ |
| 193 | simplify/.libs/libsimplify.a(TopologyPreservingSimplifier.o):TopologyPreservingS |
| 194 | implifier.cpp:(.rdata+0x1f0): undefined reference to `geos::geom::util::GeometryTransformer::transformGeometryCollection(geos::geom::GeometryCollection const*, |
| 195 | geos::geom::Geometry const*)' |
| 196 | |
| 197 | and bunch of other classes in util::GeometryTransformer.. |
| 198 | the .la file gets created so seems to be at linker phase. |
| 199 | }}} |
| 200 | |
| 201 | -- follow instructions in [http://www.gaia-gis.it/spatialite-3.0.0-BETA/mingw64_how_to.html#libgeos] |
| 202 | {{{ |
| 203 | export GEOS_VER=3.3.5 |
| 204 | cd ${PROJECTS}/geos |
| 205 | tar xjf geos-${GEOS_VER}.tar.bz2 |
| 206 | cd geos-${GEOS_VER} |
| 207 | ./configure --host=x86_64-w64-mingw32 --prefix=${PROJECTS}/geos/rel-${GEOS_VER}w64 | tee /c/geos_configure_3.3.log |
| 208 | make |
| 209 | make install |
| 210 | }}} |
| 211 | To strip all the debug info weight from the libgeos DLL files, run |
| 212 | {{{ |
| 213 | strip ${PROJECTS}/bin/geos/rel-${GEOS_VER}w64/*.dll |
| 214 | }}} |
| 215 | |
| 216 | == Installing !LibIconv == |
| 217 | |
| 218 | For iconv we are going to compile our own copy instead of installing from GNUWin. |
| 219 | |
| 220 | * http://ftp.gnu.org/gnu/libiconv/libiconv-1.13.1.tar.gz |
| 221 | |
| 222 | Save the source in your C:\ming64\projects directory. Open up the MSYS terminal. Ignore the errors in the configure process. |
| 223 | {{{ |
| 224 | cd ${PROJECTS} |
| 225 | tar xvfz libiconv-1.13.1.tar.gz |
| 226 | cd libiconv-1.13.1 |
| 227 | ./configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=${PROJECTS}/rel-libiconv-1.13.1w64 |
| 228 | make |
| 229 | make install |
| 230 | }}} |
| 231 | Copy rel-.. contents int c:\mingw\mingw64 folder. For some reason using libiconv-prefix did not work for configuring postgis. |
| 232 | Verify if the version of iconv you are running is the same as the one you just compiled (1.13): |
| 233 | {{{ |
| 234 | # iconv --version |
| 235 | }}} |
| 236 | |
| 237 | == Compiling Proj == |
| 238 | Download Proj4 from the web site, and the datum shifts grid file. |
| 239 | |
| 240 | * http://download.osgeo.org/proj/proj-4.8.0.tar.gz |
| 241 | * http://download.osgeo.org/proj/proj-datumgrid-1.5.zip |
| 242 | |
| 243 | and copy to c:\ming64\projects\proj |
| 244 | The datum grid file must be unzipped into the "nad" subdirectory of the Proj4 source tree. |
| 245 | {{{ |
| 246 | #set this to whereever you plan to keep your source |
| 247 | #I have one for 32-bit and one for 64-bit |
| 248 | export PROJECTS=/c/ming64/projects |
| 249 | cd ${PROJECTS}/proj |
| 250 | wget http://download.osgeo.org/proj/proj-4.8.0.tar.gz |
| 251 | wget http://download.osgeo.org/proj/proj-datumgrid-1.5.zip |
| 252 | tar xvfz proj-4.8.0.tar.gz |
| 253 | cd proj-4.8.0 |
| 254 | cd nad |
| 255 | unzip ../../proj-datumgrid-1.5.zip |
| 256 | cd .. |
| 257 | ./configure --prefix=${PROJECTS}/proj/rel-4.8.0w64 --host=x86_64-w64-mingw32 --enable-shared |
| 258 | make clean |
| 259 | make && make install |
| 260 | }}} |
| 261 | |
| 262 | == Compiling and Installing C-Unit == |
| 263 | Download from http://sourceforge.net/projects/cunit/ into c:\projects |
| 264 | |
| 265 | {{{ |
| 266 | cd ${PROJECTS} |
| 267 | wget http://iweb.dl.sourceforge.net/project/cunit/CUnit/2.1-2/CUnit-2.1-2-src.tar.bz2 |
| 268 | tar -xvf CUnit-2.1-2-src.tar.bz2 |
| 269 | cd CUnit-2.1-2 |
| 270 | #if you are building for 64-bit then use x86_64-w64-mingw32 for the build,host,target |
| 271 | #32 bit uses i686-w64-mingw32 for build, host, target |
| 272 | ./configure --host=x86_64-w64-mingw32 --prefix=/mingw |
| 273 | make && make install |
| 274 | }}} |
| 275 | |
| 276 | For some reason, PostGIS couldn't find my cunit install. So I had to copy the files: |
| 277 | from C:\ming64\mingw64\include\CUnit to C:\ming64\mingw64\x86_64-w64-mingw32\include\CUnit |
| 278 | == 7. Compiling LibXML2 == |
| 279 | |
| 280 | {{{ |
| 281 | mkdir ${PROJECTS}/libxml |
| 282 | cd ${PROJECTS}/libxml |
| 283 | wget ftp://xmlsoft.org/libxml2/libxml2-2.7.8.tar.gz |
| 284 | }}} |
| 285 | |
| 286 | |
| 287 | {{{ |
| 288 | tar xvfz libxml2-2.7.8.tar.gz |
| 289 | cd libxml2-2.7.8 |
| 290 | #if you are building for 64-bit then use x86_64-w64-mingw32 for the build,host,target |
| 291 | #32 bit uses i686-w64-mingw32 for build, host, target |
| 292 | ./configure --prefix=/c/projects/libxml/rel-libxml2-2.7.8w64 --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --enable-shared --with-threads=no CFLAGS=-O2 |
| 293 | #Note to self: used to have CCFLAGS=LDFLAGS="-Wl,-static" in here will see how it goes without |
| 294 | #If you have pthreads installed, libxml picks it up and royally screws up thus the need for --with-threads=no |
| 295 | make |
| 296 | make install |
| 297 | }}} |
| 298 | |
| 299 | You might get an error during the configure process |
| 300 | {{{ |
| 301 | /bin/rm: cannot lstat `libtoolT': No such file or directory |
| 302 | }}} |
| 303 | |
| 304 | That error seems safe to ignore. |
| 305 | |
| 306 | == 8. Compiling PostgreSQL 9.1 == |
| 307 | Download source from: |
| 308 | [http://ftp.postgresql.org/pub/source/v9.1.3/postgresql-9.1.3.tar.bz2] |
| 309 | |
| 310 | {{{ |
| 311 | mkdir ${PROJECTS}/pgx64 |
| 312 | cd postgresql |
| 313 | tar -xvjf postgresql-9.1.3.tar.bz2 |
| 314 | cd postgresql-9.1.3 |
| 315 | #if you are building for 64-bit then use x86_64-w64-mingw32 for the build,host,target |
| 316 | #32 bit uses i686-w64-mingw32 for build, host, target |
| 317 | #EnterpriseDb VC++ 64-bit builds are compiled with disable float8 by val. |
| 318 | #If we don't include this line, the modules compiled against mingw64 will be incompatible with edb builds |
| 319 | ./configure --prefix=${PROJECTS}/pgx64/pg91 \ |
| 320 | --build=x86_64-w64-mingw32 \ |
| 321 | --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 \ |
| 322 | --with-pgport=5441 --enable-cassert --enable-debug \ |
| 323 | --enable-integer-datetimes --disable-float8-byval --without-zlib |
| 324 | |
| 325 | make |
| 326 | make install |
| 327 | #initialize the database cluster |
| 328 | /c/projects/pgx64/pg91/bin/initdb -U postgres -D ${PROJECTS}/pgx64/pg91/data -A trust |
| 329 | }}} |
| 330 | |
| 331 | == Compiling JSON-C == |
| 332 | This is needed if you want ST_GeomFromGeoJSON to be functional. |
| 333 | Download [http://oss.metaparadigm.com/json-c/json-c-0.9.tar.gz] and save to c:\ming64\projects\json-c |
| 334 | {{{ |
| 335 | cd ${PROJECTS}/json-c |
| 336 | wget http://oss.metaparadigm.com/json-c/json-c-0.9.tar.gz |
| 337 | tar xvfz json-c-0.9.tar.gz |
| 338 | cd json-c-0.9 |
| 339 | ## had to compile with -w (disable warnings otherwise it gave errors) |
| 340 | ## if using 32-bit (ming32), use i686-w64-mingw32 for host/build |
| 341 | ./configure --build=x86_64-w64-mingw32 \ |
| 342 | --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 \ |
| 343 | --prefix=/c/projects/json-c/rel-0.9w64 CFLAGS=-w |
| 344 | make clean |
| 345 | make |
| 346 | make install |
| 347 | }}} |
| 348 | == Copy over needed dlls to PostgreSQL folders == |
| 349 | |
| 350 | {{{ |
| 351 | export PATHOLD=$PATH |
| 352 | export PATH=$PATH:/c/projects/pgx64/pg91edb/bin:/mingw |
| 353 | export PGHOST=localhost |
| 354 | export PGPORT=5441 |
| 355 | export PGUSER=postgres |
| 356 | cp /c/projects/geos/rel-3.3.3w64/bin/*.dll /c/projects/pgx64/pg91edb/bin |
| 357 | cp /c/projects/gdal/rel-1.9.0w64/bin/*.dll /c/projects/pgx64/pg91edb/bin |
| 358 | cp /c/projects/proj/rel-4.7.0w64/bin/*.dll /c/projects/pgx64/pg91edb/bin |
| 359 | cp /c/mingw/mingw64/bin/libgcc_s_sjlj-1.dll /c/projects/pgx64/pg91edb/bin |
| 360 | cp /c/projects/geos/rel-3.3.3w64/bin/*.dll /c/projects/pgx64/pg91/bin |
| 361 | cp /c/projects/gdal/rel-1.9.0w64/bin/*.dll /c/projects/pgx64/pg91/bin |
| 362 | cp /c/projects/proj/rel-4.7.0w64/bin/*.dll /c/projects/pgx64/pg91/bin |
| 363 | cp /c/mingw/mingw64/bin/libgcc_s_sjlj-1.dll /c/projects/pgx64/pg91/bin |
| 364 | }}} |
| 365 | |
| 366 | == Getting GTK == |
| 367 | If you want to build the shp2pgsql-gui loader in 64-bit, you can use the pre-compiled gtk bundle |
| 368 | which already has the needed headers |
| 369 | |
| 370 | {{{ |
| 371 | export PORJECTS=/c/ming64/projects/gtk |
| 372 | cd ${PROJECTS} |
| 373 | mkdir gtk |
| 374 | cd gtk |
| 375 | wget |
| 376 | http://ftp.gnome.org/pub/gnome/binaries/win64/gtk+/2.22/gtk+-bundle_2.22.1-20101229_win64.zip |
| 377 | unzip gtk+-bundle_2.22.1-20101229_win64.zip |
| 378 | }}} |
| 379 | |
| 380 | |
| 381 | |
| 382 | == Compiling PostGIS 2.0 == |
| 383 | * There is a problem at least for my Mingw64 that prevents functions like ST_AsText and ST_AsKML that makes it leave out digits randomly |
| 384 | * This also causes issues for shp2pgsql. The issue is the fact that the MingW64 chain uses |
| 385 | * Microsoft's vsprintf version instead of the C99 one. This version when space is not enough returns an error code instead of length of output the write |
| 386 | * To work around this issue, I put in this pretty ugly hack in the liblwgeom/string_buffer.c around line 210 |
| 387 | change: |
| 388 | {{{ |
| 389 | if ( len < 0 ) |
| 390 | return len; |
| 391 | }}} |
| 392 | |
| 393 | to: |
| 394 | {{{ |
| 395 | if ( len < 0 ) |
| 396 | len = _vscprintf(fmt, ap2); |
| 397 | }}} |
| 398 | |
| 399 | Details of this issue are outlined in #1668 |
| 400 | |
| 401 | {{{ |
| 402 | export PROJECTS=/c/ming64/projects |
| 403 | export PG_VER=91 |
| 404 | export PGWINVER=${PG_VER}edb |
| 405 | export GEOS_VER=3.3.5 |
| 406 | # had to override the paths since cunit was picking up 32-bit junk and crashing |
| 407 | export PATHOLD=".:/bin:/include:/mingw/bin:/mingw/include:/c/Windows/system32:/c/Windows:/c/ming64/mingw64/include" |
| 408 | export PATH="${PATHOLD}:${PROJECTS}/pgx64/pg${PG_VER}/bin:${PROJECTS}/pgx64/pg${PG_VER}/lib" |
| 409 | #needed to build comments and shp2pgsql-gui |
| 410 | export PATH="${PATH}:${PROJECTS}/xsltproc:${PROJECTS}/gtk/bin" |
| 411 | export POSTGIS_SRC=${PROJECTS}/postgis/postgis-${POSTGIS_MICRO_VER} |
| 412 | cd /c/ming64/projects |
| 413 | mkdir postgis |
| 414 | cd postgis |
| 415 | wget http://www.postgis.org/download/postgis-${POSTGIS_MICRO_VER}.tar.gz |
| 416 | tar xvf postgis-${POSTGIS_MICRO_VER}.tar.gz |
| 417 | cd ${POSTGIS_SRC} |
| 418 | |
| 419 | CPPFLAGS="-I${PROJECTS}/pgx64/pg${PG_VER}/include -I${PROJECTS}/gettextrel-gettext-0.18.1/include -I${PROJECTS}/rel-libiconv-1.13.1w64/include" \ |
| 420 | LDFLAGS="-L${PROJECTS}/pgx64/pg${PG_VER}/lib -L${PROJECTS}/gdal/rel-${GDAL_VER}/lib -L${PROJECTS}/gettext/rel-gettext-0.18.1/lib -L${PROJECTS}/rel-libiconv-1.13.1w64/lib" ./configure \ |
| 421 | --host=x86_64-w64-mingw32 \ |
| 422 | --with-xml2config=${PROJECTS}/libxml/rel-libxml2-2.7.8w64/bin/xml2-config \ |
| 423 | --with-pgconfig=${PROJECTS}/pgx64/pg${PG_VER}/bin/pg_config \ |
| 424 | --with-geosconfig=${PROJECTS}/geos/rel-${GEOS_VER}/bin/geos-config \ |
| 425 | --with-projdir=${PROJECTS}/proj/rel-4.7.0w64 \ |
| 426 | --with-gdalconfig=${PROJECTS}/gdal/rel-${GDAL_VER}/bin/gdal-config \ |
| 427 | --with-jsondir=${PROJECTS}/json-c/rel-0.9w64 \ |
| 428 | --with-libiconv=${PROJECTS}/rel-libiconv-1.13.1w64 \ |
| 429 | --with-xsldir=${PROJECTS}/docbook/docbook-xsl-1.76.1 \ |
| 430 | --with-gui --with-gettext=no |
| 431 | }}} |
| 432 | |
| 433 | #this part is a hack, but again didn't work without it |
| 434 | #you can try without doing this, but if you get errors about |
| 435 | # conflicting type def boolean during PostGIS compile, you need this. |
| 436 | #In my case I got this: |
| 437 | {{{ |
| 438 | In file included from c:/ming64/projects/json-c/rel-0.9w64/include/json/json_util.h:1 |
| 439 | |
| 440 | from c:/projects/json-c/rel-0.9w64/include/json/json.h:23, |
| 441 | from lwgeom_in_geojson.c:31: |
| 442 | c:/ming64/projects/json-c/rel-0.9w64/include/json/json_object.h:32: error: conflictin |
| 443 | types for 'boolean' |
| 444 | c:\mingw\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.4.7/../../../../x86_64-w6 |
| 445 | mingw32/include/rpcndr.h:52: note: previous declaration of 'boolean' was here |
| 446 | make[1]: *** [lwgeom_in_geojson.o] Error 1 |
| 447 | }}} |
| 448 | |
| 449 | * Open up /c/projects/json-c/rel-0.9/include/json/json_object.h |
| 450 | * remark out line 32 that reads |
| 451 | {{{ typedef int boolean }}} |
| 452 | * so it should now read |
| 453 | {{{ /** typedef int boolean; **/ }}} |
| 454 | * During the PostGIS configure process, you have to put this back the way it was otherwise configure complains json.h or something is not usable and refuses to configure with JSON-C support. Then you remark the line out again during compile. Crazy I know, but json-c won't compile without that line so can't take it out before json-c compile. |
| 455 | |
| 456 | If you run into problems with your build, pipe the output into a file for further analysis. The GUI requires that pkg-config be on your PATH, check that it is there by running 'which pkg-config'. |
| 457 | {{{ |
| 458 | make 2>&1 | tee /c/build.log |
| 459 | make check |
| 460 | make install |
| 461 | }}} |