forked from mbernasocchi/QGIS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathosx.t2t
471 lines (336 loc) · 14.5 KB
/
osx.t2t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
= Building on MacOS X =
In this approach I will try to avoid as much as possible building dependencies
from source and rather use frameworks wherever possible.
The base system here is Mac OS X 10.4 (__Tiger__), with a single architecture
build. Included are notes for building on Mac OS X 10.5 (__Leopard__) and 10.6
(__Snow Leopard__). Make sure to read each section completely before typing
the first command you see.
__General note on Terminal usage:__ When I say "cd" to a folder in a Terminal,
it means type "cd " (without the quotes, make sure to type a space after) and
then type the path to said folder, then <return>. A simple way to do this
without having to know and type the full path is, after type the "cd " part,
drag the folder (use the icon in its window title bar, or drag a folder from
within a window) from the Desktop to the Terminal, then tap <return>.
__Parallel Compilation:__ On multiprocessor/multicore Macs, it's possible to
speed up compilation, but it's not automatic. Whenever you type "make" (but
NOT "make install"), instead type:
```
make -j [n]
```
Replace [n] with the number of cores and/or processors your Mac has. On recent
models with hyperthreading processors this can be double the physical count of
processors and cores.
ie: Mac Pro "8 Core" model (2 quad core processors) = 8
ie: Macbook Pro i5 (hyperthreading) = 2 cores X 2 = 4
== Install Qt4 from disk image ==
You need a minimum of Qt-4.4.0. I suggest getting the latest. There is no need
for the full Qt SDK, so save yourself some download time and get the frameworks
only.
__Snow Leopard note:__ If you are building on Snow Leopard, you will need to
decide between 32-bit support in the older, Qt Carbon branch, or 64-bit
support in the Qt Cocoa branch. Appropriate installers are available for both
as of Qt-4.5.2. Qt 4.6+ is recommended for Cocoa.
__PPC note:__ The readymade Qt Cocoa installers don't include PPC support, you'd
have to compile Qt yourself. But, there appear to be issues with Qt Cocoa on
PPC Macs anyways. Qt Carbon is recommended on PPC Macs.
http://qt.nokia.com/downloads
If you want debug frameworks, Qt also provides a separate download with these.
These are in addition to the non-debug frameworks.
Once downloaded open the disk image and run the installer. Note you need admin
privileges to install.
__Qt note:__ Starting in Qt 4.4, libQtCLucene was added, and in 4.5
libQtUiTools was added, both in /usr/lib. When using a system SDK
these libraries will not be found. To fix this problem,
add symlinks to /usr/local:
```
sudo ln -s /usr/lib/libQtUiTools.a /usr/local/lib/
sudo ln -s /usr/lib/libQtCLucene.dylib /usr/local/lib/
```
These should then be found automatically on Leopard and above. Earlier systems
may need some help by adding '-L/usr/local/lib' to CMAKE_SHARED_LINKER_FLAGS,
CMAKE_MODULE_LINKER_FLAGS and CMAKE_EXE_LINKER_FLAGS in the cmake build.
== Install development frameworks for QGIS dependencies ==
Download William Kyngesburye's excellent GDAL Complete package that includes
PROJ, GEOS, GDAL, SQLite3, Spatialite, and image libraries, as frameworks.
There is also a GSL framework.
http://www.kyngchaos.com/wiki/software/frameworks
Once downloaded, open and install the frameworks.
William provides an additional installer package for Postgresql (for PostGIS
support). Qgis just needs the libpq client library, so unless you want to
setup the full Postgres + PostGIS server, all you need is the client-only
package. It's available here:
http://www.kyngchaos.com/wiki/software/postgres
Also available is a GRASS application:
http://www.kyngchaos.com/wiki/software/grass
=== Additional Dependencies: General compatibility note ===
There are some additional dependencies that, at the time of writing, are not
provided as frameworks or installers so we will need to build these from source.
If you are wanting to build Qgis as a 64-bit application, you will need to
provide the appropriate build commands to produce 64-bit support in dependencies.
Likewise, for 32-bit support on Snow Leopard, you will need to override the
default system architecture, which is 64-bit, according to instructions for
individual dependency packages.
Stable release versions are preferred. Beta and other development versions may
have problems and you are on your own with those.
=== Additional Dependencies: Expat ===
__Snow Leopard note:__ Snow Leopard includes a usable expat, so this step is
not necessary on Snow Leopard.
Get the expat sources:
http://sourceforge.net/project/showfiles.php?group_id=10127
Double-click the source tarball to unpack, then, in Terminal.app, cd to the
source folder and:
```
./configure
make
sudo make install
```
=== Additional Dependencies: Python ===
__Leopard and Snow Leopard note:__ Leopard and Snow Leopard include a usable
Python 2.5 and 2.6, respectively. So there is no need to install Python on
Leopard and Snow Leopard. You can still install Python from python.org if
preferred.
If installing from python.org, make sure you install at least the latest Python
2.x from
http://www.python.org/download/
Python 3 is a major change, and may have compatibility issues, so try it at
your own risk.
=== Additional Dependencies: SIP ===
Retrieve the python bindings toolkit SIP from
http://www.riverbankcomputing.com/software/sip/download
Double-click the source tarball to unpack it, then, in Terminal.app,
cd to the source folder. Then for your chosen Python:
__python.org Python__
```
python configure.py
make
sudo make install
```
__Leopard system Python__
SIP wants to install in the system path -- this is not a good idea.
More configuration is needed to install outside the system path:
```
python configure.py -n -d /Library/Python/2.5/site-packages -b /usr/local/bin \
-e /usr/local/include -v /usr/local/share/sip -s MacOSX10.5.sdk
```
__Snow Leopard system Python__
Similar to Leopard, you should install outside the system Python path.
Also, you need to specify the architecture you want (requires at least SIP
4.9), and make sure to run the versioned python binary (this one responds to
the 'arch' command, 'python' does not).
If you are using 32-bit Qt (Qt Carbon):
```
python2.6 configure.py -n -d /Library/Python/2.6/site-packages -b /usr/local/bin \
-e /usr/local/include -v /usr/local/share/sip --arch=i386 -s MacOSX10.6.sdk
```
For 64-bit Qt (Qt Cocoa), use this configure line:
```
python2.6 configure.py -n -d /Library/Python/2.6/site-packages -b /usr/local/bin \
-e /usr/local/include -v /usr/local/share/sip --arch=x86_64 -s MacOSX10.6.sdk
```
__continue...__
Then continue with compilation and installation:
```
make
sudo make install
```
=== Additional Dependencies: PyQt ===
Retrieve the python bindings toolkit for Qt from
http://www.riverbankcomputing.com/software/pyqt/download
Double-click the source tarball to unpack it, then, in Terminal.app,
cd to the source folder. Then for your chosen Python:
__python.org Python__
```
python configure.py
yes
```
__Leopard system Python__
PyQt wants to install in the system path -- this is not a good idea.
More configuration is needed to install outside the system path:
```
python configure.py -d /Library/Python/2.5/site-packages -b /usr/local/bin
```
__Snow Leopard system Python__
Similar to Leopard, you should install outside the system Python path.
Also, you need to specify the architecture you want (requires at least PyQt 4.6),
and make sure to run the versioned python binary (this one responds to the
'arch' command, which is important for pyuic4, 'python' does not).
If you are using 32-bit Qt (Qt Carbon):
```
python2.6 configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin --use-arch i386
```
For 64-bit Qt (Qt Cocoa), use this configure line:
```
python2.6 configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin --use-arch x86_64
```
__continue...__
There is a problem with the configuration that needs to be fixed now
(it affects PyQwt compilation later). Edit pyqtconfig.py and change the qt_dir
line to:
```
'qt_dir': '/usr',
```
Then continue with compilation and installation (this is a good place to use
parallel compilation, if you can):
```
make
sudo make install
```
If there is a problem with undefined symbols in QtOpenGL on Leopard, edit
QtOpenGL/makefile and add ""-undefined dynamic_lookup"" to LFLAGS.
Then make again.
=== Additional Dependencies: Qwt/PyQwt ===
The GPS tracking feature uses Qwt. Some popular 3rd-party plugins use PyQwt.
You can take care of both with the PyQwt source from:
http://pyqwt.sourceforge.net/
Double-click the tarball to unpack it. The following assumes PyQwt v5.2.0
(comes with Qwt 5.2.1). Normal compilation does both Qwt and PyQwt at the same
time, but Qwt is statically linked into PyQwt, and Qgis can't use it. So, we
need to split the build.
Now, cd into the qwt-5.2 subdir in a Terminal. Type these commands to build
and install:
```
cat >> qwtconfig.pri <<EOF
CONFIG += release QwtDll
EOF
qmake -spec macx-g++
make
sudo make install
sudo install_name_tool -id /usr/local/qwt-5.2.1-svn/lib/libqwt.5.dylib \
/usr/local/qwt-5.2.1-svn/lib/libqwt.5.dylib
```
The Qwt shared library is now installed in /usr/local/qwt-5.x.x[-svn] (x.x is
the minor.point version, and it may be an SVN version). Remember this for
QGIS and PyQwt configuration.
Now for PyQwt. Still in the Terminal (for all Pythons, except see Snow Leopard
Carbon note below):
```
cd ../configure
python configure.py --extra-include-dirs=/usr/local/qwt-5.2.1-svn/include \
--extra-lib-dirs=/usr/local/qwt-5.2.1-svn/lib --extra-libs=qwt
make
sudo make install
```
Make sure to use the qwt install path from the Qwt build above.
__Snow Leopard note__
If using Qt Carbon, you need to specify which architectures to build, otherwise
it will default to a combination that does not work (ie x86_64 for a Carbon Qt).
This is not needed for Qt Cocoa. Configure as follows:
```
python configure.py --extra-cflags="-arch i386" --extra-cxxflags="-arch i386" \
--extra-lflags="-arch i386" --extra-include-dirs=/usr/local/qwt-5.2.1-svn/include \
--extra-lib-dirs=/usr/local/qwt-5.2.1-svn/lib --extra-libs=qwt
```
=== Additional Dependencies: Bison ===
__Leopard and Snow Leopard note:__ Leopard and Snow Leopard include Bison 2.3,
so this step can be skipped on Leopard and Snow Leopard.
The version of bison available by default on Mac OS X 10.4 is too old so you
need to get a more recent one on your system. Download at least version 2.3 from:
```
ftp.gnu.org/gnu/bison/
```
Now build and install it to a prefix of /usr/local.Ê Double-click the source
tarball to unpack it, then cd to the source folder and:
```
./configure --prefix=/usr/local
make
sudo make install
```
== Install CMake for OSX ==
Get the latest source release from here:
http://www.cmake.org/cmake/resources/software.html
Binary installers are available for OS X, but they are not recommended
(2.4 versions install in /usr instead of /usr/local, and 2.6+ versions are a
strange application). Instead, download the source, double-click the source
tarball, then cd to the source folder and:
```
./bootstrap --docdir=/share/doc/CMake --mandir=/share/man
make
sudo make install
```
== QGIS source ==
Unzip the QGIS source tarball to a working folder of your choice
(/usr/somewhere is not a good choice as it's hidden and requires root
privileges). If you are reading this from the source, you've already done
this.
If you want to experiment with the latest development sources, go to the github
QGIS project page:
http://github.com/qgis/Quantum-GIS
It should default to the master branch. Click the __Downloads__ button and
select __Download .tar.gz__.
Double-click the tarball to unzip it.
== Configure the build ==
CMake supports out of source build so we will create a 'build' dir for the
build process. OS X uses ${HOME}/Applications as a standard user app folder (it
gives it the system app folder icon). If you have the correct permissions you
may want to build straight into your /Applications folder. The instructions
below assume you are building into a pre-existing ${HOME}/Applications directory.
In a Terminal cd to the qgis source folder previously downloaded, then:
```
mkdir build
cd build
cmake -D CMAKE_INSTALL_PREFIX=~/Applications \
-D CMAKE_BUILD_TYPE=MinSizeRel \
-D WITH_INTERNAL_SPATIALITE=FALSE -D WITH_MAPSERVER=TRUE \
-D QWT_LIBRARY=/usr/local/qwt-5.2.1-svn/lib/libqwt.dylib \
-D QWT_INCLUDE_DIR=/usr/local/qwt-5.2.1-svn/include \
..
```
This will automatically find and use the previously installed frameworks, and
the GRASS application if installed.
Or, to use a Unix-style build of GRASS, use the following cmake invocation
(minimum GRASS version as stated in the Qgis requirements, substitute the GRASS
path and version as required):
```
cmake -D CMAKE_INSTALL_PREFIX=~/Applications -D CMAKE_BUILD_TYPE=Release \
-D CMAKE_BUILD_TYPE=MinSizeRel \
-D WITH_INTERNAL_SPATIALITE=FALSE -D WITH_MAPSERVER=TRUE \
-D QWT_LIBRARY=/usr/local/qwt-5.2.1-svn/lib/libqwt.dylib \
-D QWT_INCLUDE_DIR=/usr/local/qwt-5.2.1-svn/include \
-D GRASS_PREFIX=/user/local/grass-6.4.1 \
..
```
__Snow Leopard note:__ To handle 32-bit Qt (Carbon), create a 32bit python wrapper
script and add arch flags to the configuration:
```
sudo cat >/usr/local/bin/python32 <<EOF
#!/bin/sh
exec arch -i386 /usr/bin/python2.6 \${1+"\$@"}
EOF
sudo chmod +x /usr/local/bin/python32
cmake -D CMAKE_INSTALL_PREFIX=~/Applications -D \
-D CMAKE_BUILD_TYPE=MinSizeRel \
-D WITH_INTERNAL_SPATIALITE=FALSE -D WITH_MAPSERVER=TRUE \
-D QWT_LIBRARY=/usr/local/qwt-5.2.1-svn/lib/libqwt.dylib \
-D QWT_INCLUDE_DIR=/usr/local/qwt-5.2.1-svn/include \
-D CMAKE_OSX_ARCHITECTURES=i386 -D PYTHON_EXECUTABLE=/usr/local/bin/python32 \
..
```
__Bundling note:__ Older Qt versions may have problems with some Qt plugins and
Qgis. The way to handle this is to bundle Qt inside the Qgis application. You
can do this now or wait to see if there are immediate crashes when running Qgis.
It's also a good idea to bundle Qt if you need to copy Qgis to other Macs (where
you would have to install Xcode just so Qt would install!).
To bundle Qt, add the following line before the last line (the ".." line) in
the above cmake configurations:
```
-D QGIS_MACAPP_BUNDLE=1 \
```
Even better for distribution purposes, to also bundle any extra non-framework,
non-standard, libs (ie postgres' libpq) bump the bundle number to 2:
```
-D QGIS_MACAPP_BUNDLE=2 \
```
== Building ==
Now we can start the build process (remember the parallel compilation note at
the beginning, this is a good place to use it, if you can):
```
make
```
If all built without errors you can then install it:
```
make install
```
or, for an /Applications build:
```
sudo make install
```