14 | | a good tool for extracting tar-files is 7-zip from http://www.7-zip.org |
15 | | |
16 | | '''1. Installing Minimalist GNU for Windows (MinGW)''' |
17 | | |
18 | | Download Automated MinGW Installer (Current - MinGW-5.1.4) from http://sourceforge.net/project/showfiles.php?group_id=2435 |
19 | | |
20 | | (http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/MinGW-5.1.4.exe/download) |
21 | | 1. Run the setup file and choose everything (except possibly Ada) |
22 | | 2. Accept the default Install location of C:\MinGW |
| 14 | == Useful Utilities == |
| 15 | |
| 16 | A good tool for extracting tar-files is 7-zip from http://www.7-zip.org |
| 17 | |
| 18 | == 1. Installing Minimalist GNU for Windows (MinGW) == |
| 19 | |
| 20 | Download Automated MinGW Installer (Current - MinGW-5.1.4) from http://sourceforge.net/project/showfiles.php?group_id=2435 (http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/MinGW-5.1.4.exe/download) |
| 21 | |
| 22 | 1. Run the setup file and choose everything (except possibly Ada) |
| 23 | 2. Accept the default Install location of C:\MinGW |
24 | | '''2. Installing Minimal System (Msys)''' |
25 | | |
26 | | Msys provides you with a unix shell environment for compiling code under windows[[BR]] |
27 | | Download Msys http://sourceforge.net/projects/mingw/files/MSYS%20Base%20System/MSYS-1.0.11-rc-1.exe/download |
28 | | |
29 | | (this is listed in http://sourceforge.net/project/showfiles.php?group_id=2435) |
30 | | |
31 | | 1. Say y to post Installation |
32 | | 2. When prompted do you have MinGW -> y |
33 | | 3. When prompted for where it is type -> C:\MinGW |
34 | | |
35 | | |
36 | | '''3. Installing Msy Development Toolkit''' |
| 25 | == 2. Installing Minimal System (MSYS) == |
| 26 | |
| 27 | MSYS provides you with a unix shell environment for compiling code under windows. |
| 28 | |
| 29 | Download MSYS version 1.0.11. http://sourceforge.net/projects/mingw/files/MSYS%20Base%20System/MSYS-1.0.11-rc-1.exe/download (this is listed in http://sourceforge.net/project/showfiles.php?group_id=2435) |
| 30 | |
| 31 | 1. Say y to post Installation |
| 32 | 2. When prompted do you have MinGW -> y |
| 33 | 3. When prompted for where it is type -> C:\MinGW |
| 34 | |
| 35 | == 3. Installing Msy Development Toolkit == |
41 | | '''4. MSYS Core 1.0.11''' (note you do not need this if you installed MSYS-1.0.11.exe) |
42 | | |
43 | | 1. Download MSYS Core 1.0.11 from http://downloads.sourceforge.net/mingw/msysCORE-1.0.11-2007.01.19-1.tar.bz2 |
44 | | 2. untar them and copy all content to c:\msys\1.0 and and click ok to overwrite existing files and folders. |
45 | | |
46 | | '''5. Download and install the following from gnuwin32.sourceforge.net/packages.html''' |
47 | | |
48 | | (Make sure to Change install directory to c:\mingw) |
49 | | 1. Bison, http://kent.dl.sourceforge.net/sourceforge/gnuwin32/bison-2.1.exe |
50 | | 2. zlib, http://kent.dl.sourceforge.net/sourceforge/gnuwin32/zlib-1.2.3.exe |
51 | | 3. Flex, http://kent.dl.sourceforge.net/sourceforge/gnuwin32/flex-2.5.4a-1.exe |
52 | | 4. !GetText, http://kent.dl.sourceforge.net/sourceforge/gnuwin32/gettext-0.14.4.exe |
53 | | |
54 | | '''Note for iconv we are going to compile our own instead of install from gnuwin since gnuwin changed some constants''' |
55 | | 5. !LibIconv |
56 | | a. download source from http://ftp.gnu.org/gnu/libiconv (we are going to use libiconv-1.13.1.tar.gz) |
57 | | b. gzip -d -c libiconv-1.13.1.tar.gz | tar xvf - |
58 | | c. cd libiconv-1.13.1 |
59 | | d. ./configure --prefix=/c/mingw |
60 | | e. make && make install |
61 | | f. verify you are running the latest with -- iconv --version |
62 | | |
63 | | |
64 | | '''6. update m4'''[[BR]] |
65 | | 1. download from: http://downloads.sourceforge.net/mingw/m4-1.4.7-MSYS.tar.bz2 |
66 | | 2. untar and copy the m4.exe-file in the end of the path to C:\msys\1.0\bin |
67 | | |
68 | | |
69 | | '''7. Update environment variable''' |
70 | | |
71 | | The below is copied direct from http://www.mingw.org/wiki/HOWTO_Install_the_MinGW_GCC_Compiler_Suite |
72 | | ---- |
73 | | Environment Settings[[BR]] |
74 | | When you install command line tools, such as MinGW, or !GnuWin32 tools, you have to tell the command line interpreter where to find them; this is usually accomplished by adding the appropriate directory names to the PATH variable in your environment. Typically, it is your responsibility to do this; please do not expect the installer, (if you used one), to do it for you.[[BR]] |
75 | | Warning: Adding entries to the PATH is normally benign. However, if you delete, you may mess up your PATH string, and you could seriously compromise the functioning of your computer. Please be careful.[[BR]] |
| 41 | == 4. Installing GNUWin Support Packages == |
| 42 | |
| 43 | Download and install the following from gnuwin32.sourceforge.net/packages.html |
| 44 | |
| 45 | 1. Bison, http://kent.dl.sourceforge.net/sourceforge/gnuwin32/bison-2.1.exe |
| 46 | 2. zlib, http://kent.dl.sourceforge.net/sourceforge/gnuwin32/zlib-1.2.3.exe |
| 47 | 3. Flex, http://kent.dl.sourceforge.net/sourceforge/gnuwin32/flex-2.5.4a-1.exe |
| 48 | 4. !GetText, http://kent.dl.sourceforge.net/sourceforge/gnuwin32/gettext-0.14.4.exe |
| 49 | 5. Zip, http://kent.dl.sourceforge.net/sourceforge/gnuwin32/zip-3.0-setup.exe |
| 50 | |
| 51 | Run each file and be sure to change the install directory to c:\MinGW |
| 52 | |
| 53 | == 5. Installing LibIconf == |
| 54 | |
| 55 | For iconv we are going to compile our own instead of install from GNUWin since GNUWin changed some constants. |
| 56 | |
| 57 | 1. download source from http://ftp.gnu.org/gnu/libiconv (we are going to use libiconv-1.13.1.tar.gz) |
| 58 | 2. gzip -d -c libiconv-1.13.1.tar.gz | tar xvf - |
| 59 | 3. cd libiconv-1.13.1 |
| 60 | 4. ./configure --prefix=/c/mingw |
| 61 | 5. make && make install |
| 62 | 6. verify you are running the latest with -- iconv --version |
| 63 | |
| 64 | == 6. Update m4 == |
| 65 | |
| 66 | 1. download from: http://downloads.sourceforge.net/mingw/m4-1.4.7-MSYS.tar.bz2 |
| 67 | 2. untar and copy the m4.exe-file in the end of the path to C:\msys\1.0\bin |
| 68 | |
| 69 | == 7. Update environment variables == |
| 70 | |
| 71 | The below is copied direct from http://www.mingw.org/wiki/HOWTO_Install_the_MinGW_GCC_Compiler_Suite#toc33 |
| 72 | |
| 73 | ''Environment Settings'' |
| 74 | |
| 75 | When you install command line tools, such as MinGW, or !GnuWin32 tools, you have to tell the command line interpreter where to find them; this is usually accomplished by adding the appropriate directory names to the PATH variable in your environment. Typically, it is your responsibility to do this; please do not expect the installer, (if you used one), to do it for you. |
| 76 | |
| 77 | Warning: Adding entries to the PATH is normally benign. However, if you delete, you may mess up your PATH string, and you could seriously compromise the functioning of your computer. Please be careful.[[BR]] |
100 | | make a folder c:\thesrc and untar the source-files there |
101 | | |
102 | | '''Launch MSys from Start->Programs->MinGW->msys''' |
103 | | |
104 | | You now get a terminal-window that understands a bunch of unix/linux-commands (at least enough for compiling)[[BR]] |
105 | | print: |
106 | | 1. ''cd /c/thesrc'' |
107 | | 2. ''ls'' |
108 | | Now you will get the folders you have copied to the directory listed.[[BR]] |
109 | | The names of the folders will be different than in this example if you have newer releases of the tools.[[BR]] |
110 | | move into one of the folders: |
111 | | 3. ''cd autoconf-2.63'' |
112 | | |
113 | | ok, now we are in the directory with the autoconf source-code[[BR]] |
114 | | print:[[BR]] |
115 | | ''ls''[[BR]] |
116 | | if you just see a new folder called autoconf-2.63 you have to go into that one to:[[BR]] |
117 | | ''cd autoconf-2.63''[[BR]] |
118 | | when you se a lot of folders like bin and lib and a lot of files, then you are right[[BR]] |
119 | | now we shall configure and make this tool[[BR]] |
120 | | print: |
121 | | 4. ''configure --prefix=/c/mingw && make && make install'' |
122 | | now a lot of text shall appear in the window and after a while you will hopefully get no error-messages but jut get back to your prompt.[[BR]] |
123 | | |
124 | | To verify you are not running autoconf-2.63 do the following: |
125 | | |
126 | | autoconf --version |
127 | | |
| 102 | Make a folder c:\thesrc and untar the source-files there. |
| 103 | |
| 104 | Launch MSys from Start->Programs->MinGW->msys or from the desktop MSYS icon. |
| 105 | |
| 106 | You now get a terminal-window that understands a bunch of unix/linux-commands (at least enough for compiling) |
| 107 | {{{ |
| 108 | # cd /c/thesrc |
| 109 | # ls |
| 110 | }}} |
| 111 | Now you will get the folders you have copied to the directory listed. The names of the folders will be different than in this example if you have newer releases of the tools. Configure, compile and install autoconf. |
| 112 | {{{ |
| 113 | # cd autoconf-2.65 |
| 114 | # ./configure --prefix=/c/mingw |
| 115 | # make |
| 116 | # make install |
| 117 | # autoconf --version |
| 118 | }}} |
141 | | '''9. Compiling PostgreSQL'''[[BR]] |
142 | | Download latest PostgreSQL source from http://www.postgresql.org/ftp/source/ and untar in C:\thesrc[[BR]] |
143 | | move to folder[[BR]] |
144 | | 1. ''cd /c/thesrc/postgresql-8.3.7'' (the version of today) |
145 | | 2. ''configure --prefix=/c/postgres && make && make install'' |
146 | | 3. If you want to be able to do a full make check on PostGIS, [UsersWikiWinCompileInitdb Initialize the postgresql database cluster] |
| 138 | == 9. Compiling PostgreSQL == |
| 139 | |
| 140 | Download latest [http://www.postgresql.org/ftp/source/ PostgreSQL source] and untar in C:\thesrc |
| 141 | {{{ |
| 142 | # tar xvfz postgresql-8.4.1.tar.gz |
| 143 | # cd postgresql-8.4.1 |
| 144 | # ./configure --prefix=/c/postgres |
| 145 | # make |
| 146 | # make install |
| 147 | }}} |
| 148 | If you want to be able to do a full make check on PostGIS, [UsersWikiWinCompileInitdb Initialize the postgresql database cluster] first. |
148 | | note that we now have changed the install-directory from mingw to postgres |
149 | | |
150 | | if you get an error something like:[[BR]] |
151 | | e:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/sspi.h:60: error: syntax error before SECURITY_STRING[[BR]] |
152 | | In file included from e:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/security.h:39, [[BR]] |
153 | | from libpq-int.h:57, [[BR]] |
154 | | from fe-auth.h:18, [[BR]] |
155 | | from fe-auth.c:48: [[BR]] |
| 150 | Note that we now have changed the install-directory from /c/MingW to /c/postgres. |
| 151 | |
| 152 | === PostgreSQL 8.3 === |
| 153 | |
| 154 | If you are compiling PostgreSQL 8.3 and you get a compilation error like this: |
| 155 | {{{ |
| 156 | e:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/sspi.h:60: error: syntax error before SECURITY_STRING |
| 157 | In file included from e:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/security.h:39, |
| 158 | from libpq-int.h:57, |
| 159 | from fe-auth.h:18, |
| 160 | from fe-auth.c:48: |
157 | | |
158 | | the solution is to edit two of the source-files.[[BR]] |
159 | | In both files: [[BR]] |
160 | | postgresql-8.3.7/src/include/libpq/libpq-be.h [[BR]] |
161 | | and [[BR]] |
162 | | postgresql-8.3.7/src/interfaces/libpq/libpq-int.h: |
163 | | |
164 | | add a new include-file:[[BR]] |
165 | | #ifdef ENABLE_SSPI[[BR]] |
166 | | #define SECURITY_WIN32[[BR]] |
167 | | #include <ntsecapi.h> '''<- Add this include'''[[BR]] |
168 | | #include <security.h>[[BR]] |
169 | | #undef SECURITY_WIN32[[BR]] |
170 | | |
171 | | you can read about this here:[[BR]] |
172 | | http://pgolub.wordpress.com/2008/12/15/building-postgresql-client-library-using-mingw-under-winxp-sp3/ [[BR]] |
173 | | and[[BR]] |
174 | | http://postgresqlorg.blogspot.com/2008/09/hackers-83-4-vista-mingw-initdb.html [[BR]] |
175 | | |
176 | | '''10. Compiling GEOS'''[[BR]] |
177 | | Download latest GEOS-source from trac.osgeo.org/geos/ ( http://download.osgeo.org/geos/geos-3.1.1.tar.bz2 ) |
178 | | and copy into C:\thesrc |
179 | | |
180 | | Extract with: |
181 | | cd /thesrc |
182 | | |
183 | | bzip2 -d -c geos-3.1.1.tar.bz2 | tar -xvf - |
184 | | |
185 | | |
186 | | Do the same as with postgresql, extract to c:\thesrc [[BR]] |
187 | | in msys terminal move to the GEOS source-code directory[[BR]] |
188 | | 1. ''configure --prefix=/c/postgres && make && make install'' |
189 | | 2. To strip all the debug info weight from the libgeos-3-1-1.dll run |
190 | | |
191 | | strip /c/postgres/bin/libgeos-3-1-1.dll |
192 | | |
193 | | NOTE: If you are compiling the latest GEOS 3.2 (geos/trunk, you may get an error because of a bug in MingW). GEOS 3.2 is needed |
194 | | to take advantage of the new ST_Buffer enhancements in PostGIS 1.5+ and also some fixes for topology exceptions in intersects and intersection. |
195 | | |
196 | | I had to comment out like below -- change lines (159, 166) to below (in C:\MinGW\include\c++\3.4.5\cwchar (same issue exists under gcc 4.4.0) |
| 162 | }}} |
| 163 | The solution is to edit two of the PostgreSQL source files, src/include/libpq/libpq-be.h and src/interfaces/libpq/libpq-int.h, and add a new line in them in the ENABLE_SSPI block: |
| 164 | {{{ |
| 165 | #ifdef ENABLE_SSPI |
| 166 | #define SECURITY_WIN32 |
| 167 | #include <ntsecapi.h> <- Add this include line |
| 168 | #include <security.h> |
| 169 | #undef SECURITY_WIN32 |
| 170 | }}} |
| 171 | You can read about this issue [http://pgolub.wordpress.com/2008/12/15/building-postgresql-client-library-using-mingw-under-winxp-sp3/ here] and |
| 172 | [http://postgresqlorg.blogspot.com/2008/09/hackers-83-4-vista-mingw-initdb.html here]. |
| 173 | |
| 174 | === PostgreSQL 8.4 === |
| 175 | |
| 176 | The above problem has been fixed in PostgreSQL 8.4. |
| 177 | |
| 178 | == 10. Compiling GEOS == |
| 179 | |
| 180 | Download latest GEOS source from http://trac.osgeo.org/geos/ either the [http://download.osgeo.org/geos/geos-3.1.1.tar.bz2 3.1.1 version] or the [http://download.osgeo.org/geos/geos-svn.tar.bz2 3.2SVN version]. |
| 181 | {{{ |
| 182 | # bzip2 -d -c geos-svn.tar.bz2 | tar xvf - |
| 183 | # ./configure --prefix=/c/postgres |
| 184 | # make |
| 185 | # make install |
| 186 | }}} |
| 187 | To strip all the debug info weight from the libgeos DLL files, run |
| 188 | {{{ |
| 189 | # strip /c/postgres/bin/libgeos-3-2-0.dll |
| 190 | }}} |
| 191 | |
| 192 | === GEOS 3.2 === |
| 193 | |
| 194 | If you are compiling the latest GEOS 3.2 (the SVN version), you may get an error because of a bug in MinGW. GEOS 3.2 is needed to take advantage of the new ST_Buffer enhancements in PostGIS 1.5+ and also some fixes for topology exceptions in intersects and intersection. |
| 195 | |
| 196 | I had to comment out the lines as seen below, lines 159 and 166 in C:\MinGW\include\c++\3.4.5\cwchar (the same issue still exists under gcc 4.4.0) |
| 197 | {{{ |
212 | | |
213 | | As alluded to here http://www.nabble.com/GCC-4.4.0-fails-with-GMP-td24191439.html |
214 | | |
215 | | |
216 | | '''11. Compiling Proj'''[[BR]] |
217 | | Download latest Proj from trac.osgeo.org/proj/ (http://download.osgeo.org/proj/proj-4.6.1.zip ) [[BR]] |
218 | | in msys terminal move to the Proj source-code directory[[BR]] |
219 | | 1. ''./configure --prefix=/c/postgres --enable-shared --disable-static '' |
220 | | 2. ''make && make install'' |
221 | | --Make the libproj.dll and make it dynamically linked |
222 | | 3. cd /c/postgres/lib |
223 | | 4. gcc -shared -o libproj.dll -Wl,--out-implib=libproj.dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive libproj.a -Wl,--no-whole-archive /c/mingw/lib/libmingw32.a |
224 | | |
225 | | |
226 | | '''12. Installing C-Unit -- needed for PostGIS 1.4 and above make check''' |
| 211 | }}} |
| 212 | As alluded to [http://www.nabble.com/GCC-4.4.0-fails-with-GMP-td24191439.html here]. |
| 213 | |
| 214 | == 11. Compiling Proj4 == |
| 215 | |
| 216 | Download [http://trac.osgeo.org/proj/ the latest Proj4 from the web site, and the datum shifts grid file. |
| 217 | |
| 218 | * http://download.osgeo.org/proj/proj-4.7.0.tar.gz |
| 219 | * http://download.osgeo.org/proj/proj-datumgrid-1.5.zip |
| 220 | |
| 221 | The datum grid file must be unzipped into the "nad" subdirectory of the Proj4 source tree. |
| 222 | |
| 223 | {{{ |
| 224 | # tar xvfz proj-4.7.0.tar.gz |
| 225 | # cd proj-4.7.0 |
| 226 | # cd nad |
| 227 | # unzip ../../proj-datumgrid-1.5.zip |
| 228 | # cd .. |
| 229 | # ./configure --prefix=/c/postgres --enable-shared --disable-static --without-mutex |
| 230 | # make |
| 231 | # make install |
| 232 | }}} |
| 233 | Make the libproj.dll and make it dynamically linked |
| 234 | {{{ |
| 235 | # cd /c/postgres/lib |
| 236 | # gcc -shared -o libproj.dll -Wl,--out-implib=libproj.dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive libproj.a -Wl,--no-whole-archive /c/mingw/lib/libmingw32.a |
| 237 | }}} |
| 238 | |
| 239 | == 12. Installing C-Unit == |
| 240 | |
| 241 | C-Unit is a testing framework, and is needed by PostGIS 1.4 and above to run the "make check" testing step. |
| 242 | |