mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-24 00:47:57 -05:00
3390 lines
96 KiB
HTML
3390 lines
96 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>QGIS</title>
|
|
<meta name="generator" content="http://txt2tags.org">
|
|
<link rel="stylesheet" href="style.css">
|
|
<style>
|
|
body{background-color:#fff;color:#000;}
|
|
hr{background-color:#000;border:0;color:#000;}
|
|
hr.heavy{height:5px;}
|
|
hr.light{height:1px;}
|
|
img{border:0;display:block;}
|
|
img.right{margin:0 0 0 auto;}
|
|
img.center{border:0;margin:0 auto;}
|
|
table th,table td{padding:4px;}
|
|
.center,header{text-align:center;}
|
|
table.center {margin-left:auto; margin-right:auto;}
|
|
.right{text-align:right;}
|
|
.left{text-align:left;}
|
|
.tableborder,.tableborder td,.tableborder th{border:1px solid #000;}
|
|
.underline{text-decoration:underline;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<hgroup>
|
|
<h1>QGIS</h1>
|
|
<h2>Building QGIS from source - step by step</h2>
|
|
<h3>2020-02-12</h3>
|
|
</hgroup>
|
|
</header>
|
|
<article>
|
|
|
|
<nav>
|
|
<div class="body" id="body">
|
|
|
|
<ol>
|
|
<li><a href="#toc1">Introduction</a>
|
|
</li>
|
|
<li><a href="#toc2">Overview</a>
|
|
</li>
|
|
<li><a href="#toc3">Building on GNU/Linux</a>
|
|
<ul>
|
|
<li><a href="#toc4">3.1. Building QGIS with Qt 5.x</a>
|
|
</li>
|
|
<li><a href="#toc5">3.2. Prepare apt</a>
|
|
</li>
|
|
<li><a href="#toc6">3.3. Install build dependencies</a>
|
|
</li>
|
|
<li><a href="#toc7">3.4. Setup ccache (Optional, but recommended)</a>
|
|
</li>
|
|
<li><a href="#toc8">3.5. Prepare your development environment</a>
|
|
</li>
|
|
<li><a href="#toc9">3.6. Check out the QGIS Source Code</a>
|
|
</li>
|
|
<li><a href="#toc10">3.7. Starting the compile</a>
|
|
</li>
|
|
<li><a href="#toc11">3.8. Building Debian packages</a>
|
|
</li>
|
|
<li><a href="#toc12">3.9. On Fedora Linux</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#toc13">Building on Windows</a>
|
|
<ul>
|
|
<li><a href="#toc14">4.1. Building with Microsoft Visual Studio</a>
|
|
</li>
|
|
<li><a href="#toc15">4.2. Building using MinGW</a>
|
|
</li>
|
|
<li><a href="#toc16">4.3. Creation of MSYS environment for compilation of QGIS</a>
|
|
</li>
|
|
<li><a href="#toc17">4.4. Building on Linux with mxe</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#toc18">Building on MacOS X</a>
|
|
<ul>
|
|
<li><a href="#toc19">5.1. Install Developer Tools</a>
|
|
</li>
|
|
<li><a href="#toc20">5.2. Install Qt4 from disk image</a>
|
|
</li>
|
|
<li><a href="#toc21">5.3. Install CMake for OSX</a>
|
|
</li>
|
|
<li><a href="#toc22">5.4. Install development frameworks for QGIS dependencies</a>
|
|
</li>
|
|
<li><a href="#toc23">5.5. API documentation</a>
|
|
</li>
|
|
<li><a href="#toc24">5.6. QGIS source</a>
|
|
</li>
|
|
<li><a href="#toc25">5.7. Configure the build</a>
|
|
</li>
|
|
<li><a href="#toc26">5.8. Building</a>
|
|
</li>
|
|
<li><a href="#toc27">5.9. Post-Install</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#toc28">Setting up the WCS test server on GNU/Linux</a>
|
|
<ul>
|
|
<li><a href="#toc29">6.1. Preparation</a>
|
|
</li>
|
|
<li><a href="#toc30">6.2. Setup mapserver</a>
|
|
</li>
|
|
<li><a href="#toc31">6.3. Create a home page</a>
|
|
</li>
|
|
<li><a href="#toc32">6.4. Now deploy it</a>
|
|
</li>
|
|
<li><a href="#toc33">6.5. Debugging</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#toc34">Setting up a Jenkins Build Server</a>
|
|
</li>
|
|
<li><a href="#toc35">Debug output and running tests</a>
|
|
</li>
|
|
<li><a href="#toc36">Authors and Acknowledgments</a>
|
|
</li>
|
|
</ol>
|
|
|
|
</div>
|
|
</nav>
|
|
<div class="body" id="body">
|
|
<p>
|
|
Last Updated: 2020-02-12
|
|
Last Change : 2020-02-12
|
|
</p>
|
|
|
|
<section id="toc1">
|
|
<h1>1. Introduction</h1>
|
|
|
|
<p>
|
|
This document is the original installation guide of the described software
|
|
QGIS. The software and hardware descriptions named in this
|
|
document are in most cases registered trademarks and are therefore subject
|
|
to the legal requirements. QGIS is subject to the GNU General Public
|
|
License. Find more information on the QGIS Homepage:
|
|
<a href="http://qgis.org">http://qgis.org</a>
|
|
</p>
|
|
<p>
|
|
The details, that are given in this document have been written and verified
|
|
to the best of knowledge and responsibility of the editors. Nevertheless,
|
|
mistakes concerning the content are possible. Therefore, all data are not
|
|
liable to any duties or guarantees. The editors and publishers do not take
|
|
any responsibility or liability for failures and their consequences. You are
|
|
always welcome for indicating possible mistakes.
|
|
</p>
|
|
<p>
|
|
Because the code of QGIS evolves from release to release, These instructions are
|
|
regularly updated to match the corresponding release. Instructions for the current
|
|
master branch are available at
|
|
<a href="http://htmlpreview.github.io/?https://raw.github.com/qgis/QGIS/master/doc/INSTALL.html.">http://htmlpreview.github.io/?https://raw.github.com/qgis/QGIS/master/doc/INSTALL.html.</a>
|
|
If you wish to build another version of QGIS, ensure to checkout the appropriate
|
|
release branch. The QGIS source code can be found <a href="https://github.com/qgis/QGIS">in the repository</a>.
|
|
</p>
|
|
<p>
|
|
Please visit <a href="http://qgis.org">http://qgis.org</a> for information on joining our mailing lists
|
|
and getting involved in the project further.
|
|
</p>
|
|
<p>
|
|
/!\ <strong>Note to document writers:</strong> Please use this document as the central
|
|
place for describing build procedures. Please do not remove this notice.
|
|
</p>
|
|
<p>
|
|
/!\ <strong>Note to document writers:</strong> This document is generated from
|
|
doc/INSTALL.t2t - if you need to edit this document, be sure to edit that
|
|
file rather than the generated INSTALL document found in the root of the
|
|
source directory.
|
|
</p>
|
|
|
|
</section>
|
|
<section id="toc2">
|
|
<h1>2. Overview</h1>
|
|
|
|
<p>
|
|
QGIS, like a number of major projects (e.g., KDE 4.0), uses CMake
|
|
(<a href="http://www.cmake.org">http://www.cmake.org</a>) for building from source.
|
|
</p>
|
|
<p>
|
|
Following a summary of the required dependencies for building:
|
|
</p>
|
|
<p>
|
|
Required build tools:
|
|
</p>
|
|
|
|
<ul>
|
|
<li>CMake >= 3.0.0
|
|
</li>
|
|
<li>Flex >= 2.5.6
|
|
</li>
|
|
<li>Bison >= 2.4
|
|
</li>
|
|
<li>Python 3
|
|
</li>
|
|
</ul>
|
|
|
|
<p>
|
|
Required build dependencies:
|
|
</p>
|
|
|
|
<ul>
|
|
<li>Qt >= 5.9.0
|
|
</li>
|
|
<li>Proj >= 4.9.3
|
|
</li>
|
|
<li>GEOS >= 3.4
|
|
</li>
|
|
<li>Sqlite3 >= 3.0.0
|
|
</li>
|
|
<li>SpatiaLite >= 4.2.0
|
|
</li>
|
|
<li>libspatialindex
|
|
</li>
|
|
<li>GDAL/OGR >= 2.1
|
|
</li>
|
|
<li>Qwt >= 5.0 & (< 6.1 with internal QwtPolar)
|
|
</li>
|
|
<li>expat >= 1.95
|
|
</li>
|
|
<li>QScintilla2
|
|
</li>
|
|
<li>QCA
|
|
</li>
|
|
<li>qtkeychain (>= 0.5)
|
|
</li>
|
|
<li>libzip
|
|
</li>
|
|
</ul>
|
|
|
|
<p>
|
|
Optional dependencies:
|
|
</p>
|
|
|
|
<ul>
|
|
<li>for GRASS providers and plugin - GRASS >= 7.0.0.
|
|
</li>
|
|
<li>for georeferencer - GSL >= 1.8
|
|
</li>
|
|
<li>for PostGIS support - PostgreSQL >= 8.0.x
|
|
</li>
|
|
<li>for gps plugin - gpsbabel
|
|
</li>
|
|
<li>for mapserver export and PyQGIS - Python >= 3.3
|
|
</li>
|
|
<li>for python support - SIP >= 4.12, PyQt >= 5.3 must match Qt version, Qscintilla2
|
|
</li>
|
|
<li>for qgis mapserver - FastCGI
|
|
</li>
|
|
<li>for oracle provider - Oracle OCI library
|
|
</li>
|
|
</ul>
|
|
|
|
<p>
|
|
Indirect dependencies:
|
|
</p>
|
|
<p>
|
|
Some proprietary formats (e.g., ECW and MrSid) supported by GDAL require
|
|
proprietary third party libraries. QGIS doesn't need any of those itself to
|
|
build, but will only support those formats if GDAL is built accordingly. Refer
|
|
to <a href="http://gdal.org/formats_list.html">http://gdal.org/formats_list.html</a> ff. for instructions how to include
|
|
those formats in GDAL.
|
|
</p>
|
|
|
|
</section>
|
|
<section id="toc3">
|
|
<h1>3. Building on GNU/Linux</h1>
|
|
|
|
<section id="toc4">
|
|
<h2>3.1. Building QGIS with Qt 5.x</h2>
|
|
|
|
<p>
|
|
<strong>Requires:</strong> Ubuntu / Debian derived distro
|
|
</p>
|
|
<p>
|
|
/!\ <strong>Note:</strong> Refer to the section Building Debian packages for building
|
|
debian packages. Unless you plan to develop on QGIS, that is probably the
|
|
easiest option to compile and install QGIS.
|
|
</p>
|
|
<p>
|
|
These notes are for Ubuntu - other versions and Debian derived distros may
|
|
require slight variations in package names.
|
|
</p>
|
|
<p>
|
|
These notes are for if you want to build QGIS from source. One of the major
|
|
aims here is to show how this can be done using binary packages for <strong>*all*</strong>
|
|
dependencies - building only the core QGIS stuff from source. I prefer this
|
|
approach because it means we can leave the business of managing system packages
|
|
to apt and only concern ourselves with coding QGIS!
|
|
</p>
|
|
<p>
|
|
This document assumes you have made a fresh install and have a 'clean' system.
|
|
These instructions should work fine if this is a system that has already been
|
|
in use for a while, you may need to just skip those steps which are irrelevant
|
|
to you.
|
|
</p>
|
|
|
|
</section>
|
|
<section id="toc5">
|
|
<h2>3.2. Prepare apt</h2>
|
|
|
|
<p>
|
|
The packages QGIS depends on to build are available in the "universe" component
|
|
of Ubuntu. This is not activated by default, so you need to activate it:
|
|
</p>
|
|
|
|
<ol>
|
|
<li>Edit your /etc/apt/sources.list file.
|
|
</li>
|
|
<li>Uncomment all the lines starting with "deb"
|
|
</li>
|
|
</ol>
|
|
|
|
<p>
|
|
Also you will need a recent enough distribution in order for all dependencies
|
|
to be met. The supported distributions are listed in the following section.
|
|
</p>
|
|
<p>
|
|
Now update your local sources database:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
sudo apt-get update
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section id="toc6">
|
|
<h2>3.3. Install build dependencies</h2>
|
|
|
|
<table class="tableborder">
|
|
<tr>
|
|
<th>Distribution</th>
|
|
<th>install command for packages</th>
|
|
</tr>
|
|
<tr>
|
|
<td>buster</td>
|
|
<td><code>apt-get install bison ca-certificates ccache cmake cmake-curses-gui dh-python doxygen expect flex flip gdal-bin git graphviz grass-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpq-dev libproj-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqscintilla2-qt5-dev libqt5opengl5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5webkit5-dev libqt5xmlpatterns5-dev libqwt-qt5-dev libspatialindex-dev libspatialite-dev libsqlite3-dev libsqlite3-mod-spatialite libyaml-tiny-perl libzip-dev lighttpd locales ninja-build ocl-icd-opencl-dev opencl-headers pkg-config poppler-utils pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dateutil python3-dev python3-future python3-gdal python3-httplib2 python3-jinja2 python3-lxml python3-markupsafe python3-mock python3-nose2 python3-owslib python3-plotly python3-psycopg2 python3-pygments python3-pyproj python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-requests python3-sip python3-sip-dev python3-six python3-termcolor python3-tz python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qt5-default qt5keychain-dev qtbase5-dev qtbase5-private-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools saga spawn-fcgi txt2tags xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>bionic</td>
|
|
<td><code>apt-get install bison ca-certificates ccache cmake cmake-curses-gui dh-python doxygen expect flex flip gdal-bin git graphviz grass-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpq-dev libproj-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqscintilla2-qt5-dev libqt5opengl5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5webkit5-dev libqt5xmlpatterns5-dev libqwt-qt5-dev libspatialindex-dev libspatialite-dev libsqlite3-dev libsqlite3-mod-spatialite libyaml-tiny-perl libzip-dev lighttpd locales ninja-build ocl-icd-opencl-dev opencl-headers pkg-config poppler-utils pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dateutil python3-dev python3-future python3-gdal python3-httplib2 python3-jinja2 python3-lxml python3-markupsafe python3-mock python3-nose2 python3-owslib python3-plotly python3-psycopg2 python3-pygments python3-pyproj python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-requests python3-sip python3-sip-dev python3-six python3-termcolor python3-tz python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qt5-default qt5keychain-dev qtbase5-dev qtbase5-private-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools saga spawn-fcgi txt2tags xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>eoan</td>
|
|
<td><code>apt-get install bison ca-certificates ccache cmake cmake-curses-gui dh-python doxygen expect flex flip gdal-bin git graphviz grass-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpq-dev libproj-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqscintilla2-qt5-dev libqt5opengl5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5webkit5-dev libqt5xmlpatterns5-dev libqwt-qt5-dev libspatialindex-dev libspatialite-dev libsqlite3-dev libsqlite3-mod-spatialite libyaml-tiny-perl libzip-dev lighttpd locales ninja-build ocl-icd-opencl-dev opencl-headers pkg-config poppler-utils pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dateutil python3-dev python3-future python3-gdal python3-httplib2 python3-jinja2 python3-lxml python3-markupsafe python3-mock python3-nose2 python3-owslib python3-plotly python3-psycopg2 python3-pygments python3-pyproj python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-requests python3-sip python3-sip-dev python3-six python3-termcolor python3-tz python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qt5-default qt5keychain-dev qtbase5-dev qtbase5-private-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools saga spawn-fcgi txt2tags xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>focal</td>
|
|
<td><code>apt-get install bison ca-certificates ccache cmake cmake-curses-gui dh-python doxygen expect flex flip gdal-bin git graphviz grass-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpq-dev libproj-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqscintilla2-qt5-dev libqt5opengl5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5webkit5-dev libqt5xmlpatterns5-dev libqwt-qt5-dev libspatialindex-dev libspatialite-dev libsqlite3-dev libsqlite3-mod-spatialite libyaml-tiny-perl libzip-dev lighttpd locales ninja-build ocl-icd-opencl-dev opencl-headers pkg-config poppler-utils pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dateutil python3-dev python3-future python3-gdal python3-httplib2 python3-jinja2 python3-lxml python3-markupsafe python3-mock python3-nose2 python3-owslib python3-plotly python3-psycopg2 python3-pygments python3-pyproj python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-requests python3-sip python3-sip-dev python3-six python3-termcolor python3-tz python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qt5-default qt5keychain-dev qtbase5-dev qtbase5-private-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools saga spawn-fcgi txt2tags xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb</code></td>
|
|
</tr>
|
|
<tr>
|
|
<td>sid</td>
|
|
<td><code>apt-get install bison ca-certificates ccache cmake cmake-curses-gui dh-python doxygen expect flex flip gdal-bin git graphviz grass-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpq-dev libproj-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqscintilla2-qt5-dev libqt5opengl5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5webkit5-dev libqt5xmlpatterns5-dev libqwt-qt5-dev libspatialindex-dev libspatialite-dev libsqlite3-dev libsqlite3-mod-spatialite libyaml-tiny-perl libzip-dev lighttpd locales ninja-build ocl-icd-opencl-dev opencl-headers pkg-config poppler-utils pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dateutil python3-dev python3-future python3-gdal python3-httplib2 python3-jinja2 python3-lxml python3-markupsafe python3-mock python3-nose2 python3-owslib python3-plotly python3-psycopg2 python3-pygments python3-pyproj python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-requests python3-sip python3-sip-dev python3-six python3-termcolor python3-tz python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qt5-default qt5keychain-dev qtbase5-dev qtbase5-private-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools saga spawn-fcgi txt2tags xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb</code></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<p>
|
|
(extracted from the control.in file in <code>debian/</code>)
|
|
</p>
|
|
<p>
|
|
See <a href="http://qgis.org/en/site/forusers/alldownloads.html#debian-ubuntu">http://qgis.org/en/site/forusers/alldownloads.html#debian-ubuntu</a> for
|
|
currently supported distributions (plain xenial's GDAL for instance is to old
|
|
and we build with GDAL2 from ubuntugis).
|
|
</p>
|
|
|
|
</section>
|
|
<section id="toc7">
|
|
<h2>3.4. Setup ccache (Optional, but recommended)</h2>
|
|
|
|
<p>
|
|
You should also setup ccache to speed up compile times:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
cd /usr/local/bin
|
|
sudo ln -s /usr/bin/ccache gcc
|
|
sudo ln -s /usr/bin/ccache g++
|
|
</pre></div>
|
|
|
|
<p>
|
|
or simply add <code>/usr/lib/ccache</code> to your <code>PATH</code>.
|
|
</p>
|
|
|
|
</section>
|
|
<section id="toc8">
|
|
<h2>3.5. Prepare your development environment</h2>
|
|
|
|
<p>
|
|
As a convention I do all my development work in $HOME/dev/<language>, so in
|
|
this case we will create a work environment for C++ development work like
|
|
this:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
mkdir -p ${HOME}/dev/cpp
|
|
cd ${HOME}/dev/cpp
|
|
</pre></div>
|
|
|
|
<p>
|
|
This directory path will be assumed for all instructions that follow.
|
|
</p>
|
|
|
|
</section>
|
|
<section id="toc9">
|
|
<h2>3.6. Check out the QGIS Source Code</h2>
|
|
|
|
<p>
|
|
There are two ways the source can be checked out. Use the anonymous method
|
|
if you do not have edit privileges for the QGIS source repository, or use
|
|
the developer checkout if you have permissions to commit source code
|
|
changes.
|
|
</p>
|
|
<p>
|
|
1. Anonymous Checkout
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
cd ${HOME}/dev/cpp
|
|
git clone git://github.com/qgis/QGIS.git
|
|
</pre></div>
|
|
|
|
<p>
|
|
2. Developer Checkout
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
cd ${HOME}/dev/cpp
|
|
git clone git@github.com:qgis/QGIS.git
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section id="toc10">
|
|
<h2>3.7. Starting the compile</h2>
|
|
|
|
<p>
|
|
I compile my development version of QGIS into my ~/apps directory to avoid
|
|
conflicts with Ubuntu packages that may be under /usr. This way for example
|
|
you can use the binary packages of QGIS on your system along side with your
|
|
development version. I suggest you do something similar:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
mkdir -p ${HOME}/apps
|
|
</pre></div>
|
|
|
|
<p>
|
|
Now we create a build directory and run ccmake:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
cd QGIS
|
|
mkdir build-master
|
|
cd build-master
|
|
ccmake ..
|
|
</pre></div>
|
|
|
|
<p>
|
|
When you run ccmake (note the .. is required!), a menu will appear where
|
|
you can configure various aspects of the build. If you want QGIS to have
|
|
debugging capabilities then set CMAKE_BUILD_TYPE to Debug. If you do not have
|
|
root access or do not want to overwrite existing QGIS installs (by your
|
|
packagemanager for example), set the CMAKE_INSTALL_PREFIX to somewhere you
|
|
have write access to (I usually use ${HOME}/apps). Now press
|
|
'c' to configure, 'e' to dismiss any error messages that may appear.
|
|
and 'g' to generate the make files. Note that sometimes 'c' needs to
|
|
be pressed several times before the 'g' option becomes available.
|
|
After the 'g' generation is complete, press 'q' to exit the ccmake
|
|
interactive dialog.
|
|
</p>
|
|
<p>
|
|
/!\ <strong>Warning:</strong> Make sure that your build directory is completely empty when you
|
|
enter the command. Do never try to "re-use" an existing <strong>Qt4</strong> build directory.
|
|
If you want to use `ccmake` or other interactive tools, run the command in
|
|
the empty build directory once before starting to use the interactive tools.
|
|
</p>
|
|
<p>
|
|
Now on with the build:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
make -jX
|
|
</pre></div>
|
|
|
|
<p>
|
|
where X is the number of available cores. Depending on your platform,
|
|
this can speed up the build time considerably.
|
|
</p>
|
|
<p>
|
|
Then you can directly run from the build directory:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
./output/bin/qgis
|
|
</pre></div>
|
|
|
|
<p>
|
|
Another option is to install to your system:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
make install
|
|
</pre></div>
|
|
|
|
<p>
|
|
After that you can try to run QGIS:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
$HOME/apps/bin/qgis
|
|
</pre></div>
|
|
|
|
<p>
|
|
If all has worked properly the QGIS application should start up and appear
|
|
on your screen. If you get the error message "error while loading shared libraries",
|
|
execute this command in your shell.
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
sudo ldconfig
|
|
</pre></div>
|
|
|
|
<p>
|
|
If that doesn't help add the install path to LD_LIBRARY_PATH:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${HOME}/apps/lib/
|
|
</pre></div>
|
|
|
|
<p>
|
|
Optionally, if you already know what aspects you want in your custom build
|
|
then you can skip the interactive ccmake .. part by using the cmake -D
|
|
option for each aspect, e.g.:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
cmake -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=${HOME}/apps ..
|
|
</pre></div>
|
|
|
|
<p>
|
|
Also, if you want to speed your build times, you can easily do it with ninja,
|
|
an alternative to make with similar build options.
|
|
</p>
|
|
<p>
|
|
For example, to configure your build you can do either one of:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
ccmake -G Ninja ..
|
|
</pre></div>
|
|
|
|
<div class="code"><pre>
|
|
cmake -G Ninja -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=${HOME}/apps ..
|
|
</pre></div>
|
|
|
|
<p>
|
|
Build and install with ninja:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
ninja (uses all cores by default; also supports the above described -jX option)
|
|
ninja install
|
|
</pre></div>
|
|
|
|
<p>
|
|
You can build just the targets you need using, for example:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
ninja qgis
|
|
ninja pycore
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section id="toc11">
|
|
<h2>3.8. Building Debian packages</h2>
|
|
|
|
<p>
|
|
Instead of creating a personal installation as in the previous step you can
|
|
also create debian package. This is done from the QGIS root directory, where
|
|
you'll find a debian directory.
|
|
</p>
|
|
<p>
|
|
First you need to install the debian packaging tools once:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
apt-get install build-essential
|
|
</pre></div>
|
|
|
|
<p>
|
|
First you need to create an changelog entry for your distribution. For example
|
|
for Ubuntu Precise:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
dch -l ~precise --force-distribution --distribution precise "precise build"
|
|
</pre></div>
|
|
|
|
<p>
|
|
The QGIS packages will be created with:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
dpkg-buildpackage -us -uc -b
|
|
</pre></div>
|
|
|
|
<p>
|
|
/!\ <strong>Note:</strong> Install <code>devscripts</code> to get <code>dch</code>.
|
|
</p>
|
|
<p>
|
|
/!\ <strong>Note:</strong> If <code>dpkg-buildpackage</code> complains about unmet build dependencies
|
|
you can install them using <code>apt-get</code> and re-run the command.
|
|
</p>
|
|
<p>
|
|
/!\ <strong>Note:</strong> If you have <code>libqgis1-dev</code> installed, you need to remove it first
|
|
using <code>dpkg -r libqgis1-dev</code>. Otherwise <code>dpkg-buildpackage</code> will complain about a
|
|
build conflict.
|
|
</p>
|
|
<p>
|
|
/!\ <strong>Note:</strong> By default tests are run in the process of building and their
|
|
results are uploaded to <a href="http://cdash.orfeo-toolbox.org/index.php?project=QGIS.">http://cdash.orfeo-toolbox.org/index.php?project=QGIS.</a>
|
|
You can turn the tests off using DEB_BUILD_OPTIONS=nocheck in front of the
|
|
build command. The upload of results can be avoided with DEB_TEST_TARGET=test.
|
|
</p>
|
|
<p>
|
|
The packages are created in the parent directory (ie. one level up).
|
|
Install them using dpkg. E.g.:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
sudo debi
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section id="toc12">
|
|
<h2>3.9. On Fedora Linux</h2>
|
|
|
|
<p>
|
|
We assume that you have the source code of QGIS ready and created a
|
|
new subdirectory called `build` or `build-qt5` in it.
|
|
</p>
|
|
|
|
<section>
|
|
<h3>3.9.1. Install build dependencies</h3>
|
|
|
|
<div class="code"><pre>
|
|
dnf install qt5-qtbase-private-devel qt5-qtwebkit-devel qt5-qtlocation-devel qt5-qttools-static qca-qt5-devel qca-qt5-ossl qt5-qt3d-devel python3-qt5-devel python3-qscintilla-qt5-devel qscintilla-qt5-devel python3-qscintilla-devel python3-qscintilla-qt5 clang flex bison geos-devel gdal-devel sqlite-devel libspatialite-devel qt5-qtsvg-devel spatialindex-devel expat-devel proj-devel qwt-qt5-devel gsl-devel postgresql-devel cmake python3-future gdal-python3 python3-psycopg2 python3-PyYAML python3-pygments python3-jinja2 python3-OWSLib qca-qt5-ossl qwt-qt5-devel qtkeychain-qt5-devel qwt-devel sip-devel libzip-devel exiv2-devel
|
|
</pre></div>
|
|
|
|
<p>
|
|
To build QGIS server additional dependencies are required:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
dnf install fcgi-devel
|
|
</pre></div>
|
|
|
|
<p>
|
|
Make sure that your build directory is completely empty when you enter the
|
|
following command. Do never try to "re-use" an existing Qt4 build directory.
|
|
If you want to use `ccmake` or other interactive tools, run the following
|
|
command in the empty build directory once before starting to use the interactive
|
|
tools.
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
cmake ..
|
|
</pre></div>
|
|
|
|
<p>
|
|
If everything went OK you can finally start to compile. (As usual append a -jX
|
|
where X is the number of available cores option to make to speed up your build
|
|
process)
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
make
|
|
</pre></div>
|
|
|
|
<p>
|
|
Run from the build directory
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
./output/bin/qgis
|
|
</pre></div>
|
|
|
|
<p>
|
|
Or install to your system
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
make install
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>3.9.2. Suggested system tweaks</h3>
|
|
|
|
<p>
|
|
By default Fedora disables debugging calls from Qt applications. This prevents
|
|
the useful debug output which is normally printed when running the unit tests.
|
|
</p>
|
|
<p>
|
|
To enable debug prints for the current user, execute:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
cat > ~/.config/QtProject/qtlogging.ini << EOL
|
|
[Rules]
|
|
default.debug=true
|
|
EOL
|
|
</pre></div>
|
|
|
|
</section>
|
|
</section>
|
|
</section>
|
|
<section id="toc13">
|
|
<h1>4. Building on Windows</h1>
|
|
|
|
<section id="toc14">
|
|
<h2>4.1. Building with Microsoft Visual Studio</h2>
|
|
|
|
<p>
|
|
This section describes how to build QGIS using Visual Studio (MSVC) 2015 on Windows.
|
|
This is currently also how the binary QGIS packages are made (earlier versions used MinGW).
|
|
</p>
|
|
<p>
|
|
This section describes the setup required to allow Visual Studio to be used to
|
|
build QGIS.
|
|
</p>
|
|
|
|
<section>
|
|
<h3>4.1.1. Visual C++ Community Edition</h3>
|
|
|
|
<p>
|
|
The free (as in free beer) Community installer is available under:
|
|
</p>
|
|
<blockquote>
|
|
<a href="http://download.microsoft.com/download/D/2/3/D23F4D0F-BA2D-4600-8725-6CCECEA05196/vs_community_ENU.exe">http://download.microsoft.com/download/D/2/3/D23F4D0F-BA2D-4600-8725-6CCECEA05196/vs_community_ENU.exe</a>
|
|
</blockquote>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>4.1.2. Other tools and dependencies</h3>
|
|
|
|
<p>
|
|
Download and install following packages:
|
|
</p>
|
|
|
|
<table class="tableborder">
|
|
<tr>
|
|
<th>Tool</th>
|
|
<th>Website</th>
|
|
</tr>
|
|
<tr>
|
|
<td>CMake</td>
|
|
<td><a href="https://cmake.org/files/v3.12/cmake-3.12.3-win64-x64.msi">https://cmake.org/files/v3.12/cmake-3.12.3-win64-x64.msi</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td>GNU flex, GNU bison and GIT</td>
|
|
<td><a href="http://cygwin.com/setup-x86.exe">http://cygwin.com/setup-x86.exe</a> (32bit) or <a href="http://cygwin.com/setup-x86_64.exe">http://cygwin.com/setup-x86_64.exe</a> (64bit)</td>
|
|
</tr>
|
|
<tr>
|
|
<td>OSGeo4W</td>
|
|
<td><a href="http://download.osgeo.org/osgeo4w/osgeo4w-setup-x86.exe">http://download.osgeo.org/osgeo4w/osgeo4w-setup-x86.exe</a> (32bit) or <a href="http://download.osgeo.org/osgeo4w/osgeo4w-setup-x86_64.exe">http://download.osgeo.org/osgeo4w/osgeo4w-setup-x86_64.exe</a> (64bit)</td>
|
|
</tr>
|
|
<tr>
|
|
<td>ninja</td>
|
|
<td><a href="https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-win.zip">https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-win.zip</a></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<p>
|
|
For the QGIS build you need to install following packages from cygwin:
|
|
</p>
|
|
|
|
<ul>
|
|
<li>bison
|
|
</li>
|
|
<li>flex
|
|
</li>
|
|
<li>git
|
|
</li>
|
|
</ul>
|
|
|
|
<p>
|
|
and from OSGeo4W (select <em>Advanced Installation</em>):
|
|
</p>
|
|
|
|
<ul>
|
|
<li>qgis-dev-deps
|
|
</li>
|
|
</ul>
|
|
|
|
<p>
|
|
This will also select packages the above packages depend on.
|
|
</p>
|
|
<p>
|
|
If you install other packages, this might cause issues. Particularly, make sure
|
|
<strong>not</strong> to install the msinttypes package. It installs a stdint.h file in
|
|
OSGeo4W[64]\include, that conflicts with Visual Studio own stdint.h, which for
|
|
example breaks the build of the virtual layer provider.
|
|
</p>
|
|
<p>
|
|
Earlier versions of this document also covered how to build all above
|
|
dependencies. If you're interested in that, check the history of this page in the Wiki
|
|
or the SVN repository.
|
|
</p>
|
|
<p>
|
|
ninja:
|
|
copy ninja.exe to d:\OSGeo4W64\bin\
|
|
</p>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>4.1.3. Setting up the Visual Studio project with CMake</h3>
|
|
|
|
<p>
|
|
/!\ Consider this section as example. It tends to outdate, when OSGeo4W and
|
|
SDKs move on. <code>ms-windows/osgeo4w/package-nightly.cmd</code> is used for the
|
|
nightly builds and constantly updated and hence might contain necessary
|
|
updates that are not yet reflected here.
|
|
</p>
|
|
<p>
|
|
To start a command prompt with an environment that both has the VC++ and the OSGeo4W
|
|
variables create the following batch file (assuming the above packages were
|
|
installed in the default locations):
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
@echo off
|
|
call X:\src\qgis\ms-windows\osgeo4w\msvc-env.bat x86_64
|
|
@cmd
|
|
</pre></div>
|
|
|
|
<p>
|
|
Save the batch file as <code>d:\OSGeo4W64\OSGeo4W-dev.bat</code> and run it.
|
|
On the command prompt checkout the QGIS source from
|
|
git to the source directory <code>QGIS</code>:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
git clone git://github.com/qgis/QGIS.git
|
|
</pre></div>
|
|
|
|
<p>
|
|
And, to avoid Git in Windows reporting changes to files not actually modified:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
git config core.filemode false
|
|
</pre></div>
|
|
|
|
<p>
|
|
Using configonly.bat to create the MSVC solution file:
|
|
We will be using the file ms-windows/osgeo4w/configonly.bat to create an MSVC solution file.
|
|
There are a few options for a solution file, following are the options: ninja, native MSVC.
|
|
The advantage of using native MSVC solution is that you can find the root of build problems much easily.
|
|
configonly.bat is meant to create a configured build directory with a MSVC solution file:
|
|
</p>
|
|
<p>
|
|
```
|
|
configonly.bat
|
|
```
|
|
</p>
|
|
<p>
|
|
Compiling QGIS with MSVC:
|
|
We will need to run MSVC with all the environment variables set, thus we will run it as follows:
|
|
Run the batch file OSGeo4W-dev.bat you created before. On the command prompt run: <code>devenv</code>
|
|
From MSVC, open the solution file
|
|
<code>d:\OSGeo4W64\QGIS\ms-windows\osgeo4w\build-qgis-test-x86_64\qgis.sln</code>
|
|
Try to build the solution <a href="while">go grab a cup of tea, it may take a</a>.
|
|
If it fails, run it again and again until there are [hopefully] no errors.
|
|
</p>
|
|
<p>
|
|
Running QGIS from within MSVC:
|
|
Edit the properties of the project ALL_BUILD:
|
|
Debugging -> Command -> D:\OSGeo4W64\QGIS\ms-windows\osgeo4w\build-qgis-test-x86_64\output\bin\RelWithDebInfo\qgis.exe
|
|
Run.
|
|
Ignore the "These projects are out of date" message, it appears even if no files were changed.
|
|
</p>
|
|
<p>
|
|
Old alternative method that might still work using cmake-gui:
|
|
Create a 'build' directory somewhere. This will be where all the build output
|
|
will be generated.
|
|
</p>
|
|
<p>
|
|
Now run <code>cmake-gui</code> (still from <code>cmd</code>) and in the <em>Where is the source code:</em>
|
|
box, browse to the top level QGIS directory.
|
|
</p>
|
|
<p>
|
|
In the <em>Where to build the binaries:</em> box, browse to the 'build' directory you
|
|
created.
|
|
</p>
|
|
<p>
|
|
If the path to bison and flex contains blanks, you need to use the short name
|
|
for the directory (i.e. <code>C:\Program Files</code> should be rewritten to
|
|
<code>C:\Progra~n</code>, where <code>n</code> is the number as shown in `dir /x C:\``).
|
|
</p>
|
|
<p>
|
|
Verify that the 'BINDINGS_GLOBAL_INSTALL' option is not checked, so that python
|
|
bindings are placed into the output directory when you run the INSTALL target.
|
|
</p>
|
|
<p>
|
|
Hit <code>Configure</code> to start the configuration and select <code>Visual Studio 9 2008</code>
|
|
and keep <code>native compilers</code> and click <code>Finish</code>.
|
|
</p>
|
|
<p>
|
|
The configuration should complete without any further questions and allow you to
|
|
click <code>Generate</code>.
|
|
</p>
|
|
<p>
|
|
Now close <code>cmake-gui</code> and continue on the command prompt by starting
|
|
<code>vcexpress</code>. Use File / Open / Project/Solutions and open the
|
|
qgis-x.y.z.sln File in your project directory.
|
|
</p>
|
|
<p>
|
|
Change <code>Solution Configuration</code> from <code>Debug</code> to <code>RelWithDebInfo</code> (Release
|
|
with Debug Info) or <code>Release</code> before you build QGIS using the ALL_BUILD
|
|
target (otherwise you need debug libraries that are not included).
|
|
</p>
|
|
<p>
|
|
After the build completed you should install QGIS using the INSTALL target.
|
|
</p>
|
|
<p>
|
|
Install QGIS by building the INSTALL project. By default this will install to
|
|
c:\Program Files\qgis<version> (this can be changed by changing the
|
|
CMAKE_INSTALL_PREFIX variable in cmake-gui).
|
|
</p>
|
|
<p>
|
|
You will also either need to add all the dependency DLLs to the QGIS install
|
|
directory or add their respective directories to your PATH.
|
|
</p>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>4.1.4. Packaging</h3>
|
|
|
|
<p>
|
|
To create a standalone installer there is a perl script named 'creatensis.pl'
|
|
in 'qgis/ms-windows/osgeo4w'. It downloads all required packages from OSGeo4W
|
|
and repackages them into an installer using NSIS.
|
|
</p>
|
|
<p>
|
|
The script can be run on both Windows and Linux.
|
|
</p>
|
|
<p>
|
|
On Debian/Ubuntu you can just install the 'nsis' package.
|
|
</p>
|
|
<p>
|
|
NSIS for Windows can be downloaded at:
|
|
</p>
|
|
<blockquote>
|
|
<a href="http://nsis.sourceforge.net">http://nsis.sourceforge.net</a>
|
|
</blockquote>
|
|
<p>
|
|
And Perl for Windows (including other requirements like 'wget', 'unzip', 'tar'
|
|
and 'bzip2') is available at:
|
|
</p>
|
|
<blockquote>
|
|
<a href="http://cygwin.com">http://cygwin.com</a>
|
|
</blockquote>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>4.1.5. Packaging your own build of QGIS</h3>
|
|
|
|
<p>
|
|
Assuming you have completed the above packaging step, if you want to include
|
|
your own hand built QGIS executables, you need to copy them in from your
|
|
windows installation into the ms-windows file tree created by the creatensis
|
|
script.
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
cd ms-windows/
|
|
rm -rf osgeo4w/unpacked/apps/qgis/*
|
|
cp -r /tmp/qgis1.7.0/* osgeo4w/unpacked/apps/qgis/
|
|
</pre></div>
|
|
|
|
<p>
|
|
Now create a package.
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
./quickpackage.sh
|
|
</pre></div>
|
|
|
|
<p>
|
|
After this you should now have a nsis installer containing your own build
|
|
of QGIS and all dependencies needed to run it on a windows machine.
|
|
</p>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>4.1.6. Osgeo4w packaging</h3>
|
|
|
|
<p>
|
|
The actual packaging process is currently not documented, for now please take a
|
|
look at:
|
|
</p>
|
|
<p>
|
|
<em>ms-windows/osgeo4w/package.cmd</em>
|
|
</p>
|
|
|
|
</section>
|
|
</section>
|
|
<section id="toc15">
|
|
<h2>4.2. Building using MinGW</h2>
|
|
|
|
<p>
|
|
<strong>Note:</strong> This section might be outdated as nowadays Visual C++ is use to build
|
|
the "official" packages.
|
|
</p>
|
|
<p>
|
|
<strong>Note:</strong> For a detailed account of building all the dependencies yourself you
|
|
can visit Marco Pasetti's website here:
|
|
</p>
|
|
<p>
|
|
<a href="http://www.webalice.it/marco.pasetti/qgis+grass/BuildFromSource.html">http://www.webalice.it/marco.pasetti/qgis+grass/BuildFromSource.html</a>
|
|
</p>
|
|
<p>
|
|
Read on to use the simplified approach with pre-built libraries...
|
|
</p>
|
|
|
|
<section>
|
|
<h3>4.2.1. MSYS</h3>
|
|
|
|
<p>
|
|
MSYS provides a unix style build environment under windows. We have created a
|
|
zip archive that contains just about all dependencies.
|
|
</p>
|
|
<p>
|
|
Get this:
|
|
</p>
|
|
<p>
|
|
<a href="http://download.osgeo.org/qgis/win32/msys.zip">http://download.osgeo.org/qgis/win32/msys.zip</a>
|
|
</p>
|
|
<p>
|
|
and unpack to c:\msys
|
|
</p>
|
|
<p>
|
|
If you wish to prepare your msys environment yourself rather than using
|
|
our pre-made one, detailed instructions are provided elsewhere in this
|
|
document.
|
|
</p>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>4.2.2. Qt</h3>
|
|
|
|
<p>
|
|
Download Qt opensource precompiled edition exe and install (including the
|
|
download and install of mingw) from here:
|
|
</p>
|
|
<p>
|
|
<a href="http://qt.nokia.com/downloads/">http://qt.nokia.com/downloads/</a>
|
|
</p>
|
|
<p>
|
|
When the installer will ask for MinGW, you don't need to download and install
|
|
it, just point the installer to c:\msys\mingw
|
|
</p>
|
|
<p>
|
|
When Qt installation is complete:
|
|
</p>
|
|
<p>
|
|
Edit C:\Qt\5.9.1\bin\qtvars.bat and add the following lines:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
set PATH=%PATH%;C:\msys\local\bin;c:\msys\local\lib
|
|
set PATH=%PATH%;"C:\Program Files\Subversion\bin"
|
|
</pre></div>
|
|
|
|
<p>
|
|
I suggest you also add C:\Qt\5.9.1\bin\ to your Environment Variables Path in
|
|
the windows system preferences.
|
|
</p>
|
|
<p>
|
|
If you plan to do some debugging, you'll need to compile debug version of Qt:
|
|
C:\Qt\5.9.1\bin\qtvars.bat compile_debug
|
|
</p>
|
|
<p>
|
|
Note: there is a problem when compiling debug version of Qt 4.7, the script ends with
|
|
this message "mingw32-make: *** No rule to make target `debug'. Stop.". To
|
|
compile the debug version you have to go out of src directory and execute the
|
|
following command:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
c:\Qt\5.9.1 make
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>4.2.3. Flex and Bison</h3>
|
|
|
|
<p>
|
|
Get Flex
|
|
<a href="http://sourceforge.net/project/showfiles.php?group_id=23617&package_id=16424">http://sourceforge.net/project/showfiles.php?group_id=23617&package_id=16424</a>
|
|
(the zip bin) and extract it into c:\msys\mingw\bin
|
|
</p>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>4.2.4. Python</h3>
|
|
|
|
<p>
|
|
Follow this section in case you would like to use Python bindings for QGIS. To
|
|
be able to compile bindings, you need to compile SIP and PyQt5 from sources as
|
|
their installer doesn't include some development files which are necessary.
|
|
</p>
|
|
<p>
|
|
Note that even if you compile without the Python bindings, Python3 is still
|
|
a necessary dependency for building QGIS.
|
|
</p>
|
|
|
|
<section>
|
|
<h4>4.2.4.1. Download and install Python - use Windows installer</h4>
|
|
|
|
<p>
|
|
(It doesn't matter to what folder you'll install it)
|
|
</p>
|
|
<p>
|
|
<a href="http://python.org/download/">http://python.org/download/</a>
|
|
</p>
|
|
|
|
</section>
|
|
<section>
|
|
<h4>4.2.4.2. Download SIP and PyQt5 sources</h4>
|
|
|
|
<p>
|
|
<a href="http://www.riverbankcomputing.com/software/sip/download">http://www.riverbankcomputing.com/software/sip/download</a>
|
|
<a href="http://www.riverbankcomputing.com/software/pyqt/download">http://www.riverbankcomputing.com/software/pyqt/download</a>
|
|
</p>
|
|
<p>
|
|
Extract each of the above zip files in a temporary directory. Make sure
|
|
to get versions that match your current Qt installed version.
|
|
</p>
|
|
|
|
</section>
|
|
<section>
|
|
<h4>4.2.4.3. Compile SIP</h4>
|
|
|
|
<div class="code"><pre>
|
|
c:\Qt\5.9.1\bin\qtvars.bat
|
|
python configure.py -p win32-g++
|
|
make
|
|
make install
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section>
|
|
<h4>4.2.4.4. Compile PyQt</h4>
|
|
|
|
<div class="code"><pre>
|
|
c:\Qt\5.9.1\bin\qtvars.bat
|
|
python configure.py
|
|
make
|
|
make install
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section>
|
|
<h4>4.2.4.5. Final python notes</h4>
|
|
|
|
<p>
|
|
/!\ You can delete the directories with unpacked SIP and PyQt5 sources after a
|
|
successful install, they're not needed anymore.
|
|
</p>
|
|
|
|
</section>
|
|
</section>
|
|
<section>
|
|
<h3>4.2.5. git</h3>
|
|
|
|
<p>
|
|
In order to check out QGIS sources from the repository, you need a git client.
|
|
This installer should work fine:
|
|
</p>
|
|
<p>
|
|
<a href="https://git-scm.com/download/win">https://git-scm.com/download/win</a>
|
|
</p>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>4.2.6. CMake</h3>
|
|
|
|
<p>
|
|
CMake is build system used by QGIS. Download it from here:
|
|
</p>
|
|
<p>
|
|
<a href="https://cmake.org/files/v3.9/cmake-3.9.3-win64-x64.msi">https://cmake.org/files/v3.9/cmake-3.9.3-win64-x64.msi</a>
|
|
</p>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>4.2.7. QGIS</h3>
|
|
|
|
<p>
|
|
Start a cmd.exe window ( Start -> Run -> cmd.exe ) Create development
|
|
directory and move into it
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
md c:\dev\cpp
|
|
cd c:\dev\cpp
|
|
</pre></div>
|
|
|
|
<p>
|
|
Check out sources from GIT:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
git clone git://github.com/qgis/QGIS.git
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>4.2.8. Compiling</h3>
|
|
|
|
<p>
|
|
As a background read the generic building with CMake notes at the end of
|
|
this document.
|
|
</p>
|
|
<p>
|
|
Start a cmd.exe window ( Start -> Run -> cmd.exe ) if you don't have one
|
|
already. Add paths to compiler and our MSYS environment:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
c:\Qt\5.9.1\bin\qtvars.bat
|
|
</pre></div>
|
|
|
|
<p>
|
|
For ease of use add c:\Qt\5.9.1\bin\ to your system path in system
|
|
properties so you can just type qtvars.bat when you open the cmd console.
|
|
Create build directory and set it as current directory:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
cd c:\dev\cpp\qgis
|
|
md build
|
|
cd build
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>4.2.9. Configuration</h3>
|
|
|
|
<div class="code"><pre>
|
|
cmakesetup ..
|
|
</pre></div>
|
|
|
|
<p>
|
|
<strong>Note:</strong> You must include the '..' above.
|
|
</p>
|
|
<p>
|
|
Click 'Configure' button. When asked, you should choose 'MinGW Makefiles' as
|
|
generator.
|
|
</p>
|
|
<p>
|
|
There's a problem with MinGW Makefiles on Win2K. If you're compiling on this
|
|
platform, use 'MSYS Makefiles' generator instead.
|
|
</p>
|
|
<p>
|
|
All dependencies should be picked up automatically, if you have set up the
|
|
Paths correctly. The only thing you need to change is the installation
|
|
destination (CMAKE_INSTALL_PREFIX) and/or set 'Debug'.
|
|
</p>
|
|
<p>
|
|
For compatibility with NSIS packaging scripts I recommend to leave the install
|
|
prefix to its default c:\program files\
|
|
</p>
|
|
<p>
|
|
When configuration is done, click 'OK' to exit the setup utility.
|
|
</p>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>4.2.10. Compilation and installation</h3>
|
|
|
|
<div class="code"><pre>
|
|
make make install
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>4.2.11. Run qgis.exe from the directory where it's installed (CMAKE_INSTALL_PREFIX)</h3>
|
|
|
|
<p>
|
|
Make sure to copy all .dll:s needed to the same directory as the qgis.exe
|
|
binary is installed to, if not already done so, otherwise QGIS will complain
|
|
about missing libraries when started.
|
|
</p>
|
|
<p>
|
|
A possibility is to run qgis.exe when your path contains c:\msys\local\bin and
|
|
c:\msys\local\lib directories, so the DLLs will be used from that place.
|
|
</p>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>4.2.12. Create the installation package: (optional)</h3>
|
|
|
|
<p>
|
|
Download and install NSIS from (<a href="http://nsis.sourceforge.net/Main_Page">http://nsis.sourceforge.net/Main_Page</a>)
|
|
</p>
|
|
<p>
|
|
Now using windows explorer, enter the win_build directory in your QGIS source
|
|
tree. Read the READMEfile there and follow the instructions. Next right click
|
|
on qgis.nsi and choose the option 'Compile NSIS Script'.
|
|
</p>
|
|
|
|
</section>
|
|
</section>
|
|
<section id="toc16">
|
|
<h2>4.3. Creation of MSYS environment for compilation of QGIS</h2>
|
|
|
|
<section>
|
|
<h3>4.3.1. Initial setup</h3>
|
|
|
|
<section>
|
|
<h4>4.3.1.1. MSYS</h4>
|
|
|
|
<p>
|
|
This is the environment that supplies many utilities from UNIX world in Windows and is needed
|
|
by many dependencies to be able to compile.
|
|
</p>
|
|
<p>
|
|
Download from here:
|
|
</p>
|
|
<blockquote>
|
|
<a href="http://puzzle.dl.sourceforge.net/sourceforge/mingw/MSYS-1.0.11-2004.04.30-1.exe">http://puzzle.dl.sourceforge.net/sourceforge/mingw/MSYS-1.0.11-2004.04.30-1.exe</a>
|
|
</blockquote>
|
|
<p>
|
|
Install to <code>c:\msys</code>
|
|
</p>
|
|
<p>
|
|
All stuff we're going to compile is going to get to this directory (resp. its subdirs).
|
|
</p>
|
|
|
|
</section>
|
|
<section>
|
|
<h4>4.3.1.2. MinGW</h4>
|
|
|
|
<p>
|
|
Download from here:
|
|
</p>
|
|
<blockquote>
|
|
<a href="http://puzzle.dl.sourceforge.net/sourceforge/mingw/MinGW-5.1.3.exe">http://puzzle.dl.sourceforge.net/sourceforge/mingw/MinGW-5.1.3.exe</a>
|
|
</blockquote>
|
|
<p>
|
|
Install to <code>c:\msys\mingw</code>
|
|
</p>
|
|
<p>
|
|
It suffices to download and install only <code>g++</code> and <code>mingw-make</code> components.
|
|
</p>
|
|
|
|
</section>
|
|
<section>
|
|
<h4>4.3.1.3. Flex and Bison</h4>
|
|
|
|
<p>
|
|
Flex and Bison are tools for generation of parsers, they're needed for GRASS and also QGIS compilation.
|
|
</p>
|
|
<p>
|
|
Download the following packages:
|
|
</p>
|
|
<blockquote>
|
|
<a href="http://gnuwin32.sourceforge.net/downlinks/flex-bin-zip.php">http://gnuwin32.sourceforge.net/downlinks/flex-bin-zip.php</a>
|
|
</blockquote>
|
|
<blockquote>
|
|
<a href="http://gnuwin32.sourceforge.net/downlinks/bison-bin-zip.php">http://gnuwin32.sourceforge.net/downlinks/bison-bin-zip.php</a>
|
|
</blockquote>
|
|
<blockquote>
|
|
<a href="http://gnuwin32.sourceforge.net/downlinks/bison-dep-zip.php">http://gnuwin32.sourceforge.net/downlinks/bison-dep-zip.php</a>
|
|
</blockquote>
|
|
<p>
|
|
Unpack them all to <code>c:\msys\local</code>
|
|
</p>
|
|
|
|
</section>
|
|
</section>
|
|
<section>
|
|
<h3>4.3.2. Installing dependencies</h3>
|
|
|
|
<section>
|
|
<h4>4.3.2.1. Getting ready</h4>
|
|
|
|
<p>
|
|
Paul Kelly did a great job and prepared a package of precompiled libraries for GRASS.
|
|
The package currently includes:
|
|
</p>
|
|
|
|
<ul>
|
|
<li>zlib-1.2.3
|
|
</li>
|
|
<li>libpng-1.2.16-noconfig
|
|
</li>
|
|
<li>xdr-4.0-mingw2
|
|
</li>
|
|
<li>freetype-2.3.4
|
|
</li>
|
|
<li>fftw-2.1.5
|
|
</li>
|
|
<li>PDCurses-3.1
|
|
</li>
|
|
<li>proj-4.5.0
|
|
</li>
|
|
<li>gdal-1.4.1
|
|
</li>
|
|
</ul>
|
|
|
|
<p>
|
|
It's available for download here:
|
|
</p>
|
|
<blockquote>
|
|
<a href="http://www.stjohnspoint.co.uk/grass/wingrass-extralibs.tar.gz">http://www.stjohnspoint.co.uk/grass/wingrass-extralibs.tar.gz</a>
|
|
</blockquote>
|
|
<p>
|
|
Moreover he also left the notes how to compile it (for those interested):
|
|
</p>
|
|
<blockquote>
|
|
<a href="http://www.stjohnspoint.co.uk/grass/README.extralibs">http://www.stjohnspoint.co.uk/grass/README.extralibs</a>
|
|
</blockquote>
|
|
<p>
|
|
Unpack the whole package to <code>c:\msys\local</code>
|
|
</p>
|
|
|
|
</section>
|
|
<section>
|
|
<h4>4.3.2.2. GRASS</h4>
|
|
|
|
<p>
|
|
Grab sources from CVS or use a weekly snapshot, see:
|
|
</p>
|
|
<blockquote>
|
|
<a href="http://grass.itc.it/devel/cvs.php">http://grass.itc.it/devel/cvs.php</a>
|
|
</blockquote>
|
|
<p>
|
|
In MSYS console go to the directory where you've unpacked or checked out sources
|
|
(e.g. <code>c:\msys\local\src\grass-6.3.cvs</code>)
|
|
</p>
|
|
<p>
|
|
Run these commands:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
export PATH="/usr/local/bin:/usr/local/lib:$PATH"
|
|
./configure --prefix=/usr/local --bindir=/usr/local --with-includes=/usr/local/include --with-libs=/usr/local/lib --with-cxx --without-jpeg \
|
|
--without-tiff --with-postgres=yes --with-postgres-includes=/local/pgsql/include --with-pgsql-libs=/local/pgsql/lib --with-opengl=windows --with-fftw \
|
|
--with-freetype --with-freetype-includes=/mingw/include/freetype2 --without-x --without-tcltk --enable-x11=no --enable-shared=yes \
|
|
--with-proj-share=/usr/local/share/proj
|
|
make
|
|
make install
|
|
</pre></div>
|
|
|
|
<p>
|
|
It should get installed to <code>c:\msys\local\grass-6.3.cvs</code>
|
|
</p>
|
|
<p>
|
|
By the way, these pages might be useful:
|
|
</p>
|
|
|
|
<ul>
|
|
<li><a href="http://grass.gdf-hannover.de/wiki/WinGRASS_Current_Status">http://grass.gdf-hannover.de/wiki/WinGRASS_Current_Status</a>
|
|
</li>
|
|
<li><a href="http://geni.ath.cx/grass.html">http://geni.ath.cx/grass.html</a>
|
|
</li>
|
|
</ul>
|
|
|
|
</section>
|
|
<section>
|
|
<h4>4.3.2.3. GEOS</h4>
|
|
|
|
<p>
|
|
Download the sources:
|
|
</p>
|
|
<blockquote>
|
|
<a href="http://geos.refractions.net/geos-2.2.3.tar.bz2">http://geos.refractions.net/geos-2.2.3.tar.bz2</a>
|
|
</blockquote>
|
|
<p>
|
|
Unpack to e.g. <code>c:\msys\local\src</code>
|
|
</p>
|
|
<p>
|
|
To compile, I had to patch the sources: in file <code>source/headers/timeval.h</code> line 13.
|
|
Change it from:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
#ifdef _WIN32
|
|
</pre></div>
|
|
|
|
<p>
|
|
to:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
#if defined(_WIN32) && defined(_MSC_VER)
|
|
</pre></div>
|
|
|
|
<p>
|
|
Now, in MSYS console, go to the source directory and run:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
./configure --prefix=/usr/local
|
|
make
|
|
make install
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section>
|
|
<h4>4.3.2.4. SQLITE</h4>
|
|
|
|
<p>
|
|
You can use precompiled DLL, no need to compile from source:
|
|
</p>
|
|
<p>
|
|
Download this archive:
|
|
</p>
|
|
<blockquote>
|
|
<a href="http://www.sqlite.org/sqlitedll-3_3_17.zip">http://www.sqlite.org/sqlitedll-3_3_17.zip</a>
|
|
</blockquote>
|
|
<p>
|
|
and copy sqlite3.dll from it to <code>c:\msys\local\lib</code>
|
|
</p>
|
|
<p>
|
|
Then download this archive:
|
|
</p>
|
|
<blockquote>
|
|
<a href="http://www.sqlite.org/sqlite-source-3_3_17.zip">http://www.sqlite.org/sqlite-source-3_3_17.zip</a>
|
|
</blockquote>
|
|
<p>
|
|
and copy sqlite3.h to <code>c:\msys\local\include</code>
|
|
</p>
|
|
|
|
</section>
|
|
<section>
|
|
<h4>4.3.2.5. GSL</h4>
|
|
|
|
<p>
|
|
Download sources:
|
|
</p>
|
|
<blockquote>
|
|
<a href="ftp://ftp.gnu.org/gnu/gsl/gsl-1.9.tar.gz">ftp://ftp.gnu.org/gnu/gsl/gsl-1.9.tar.gz</a>
|
|
</blockquote>
|
|
<p>
|
|
Unpack to <code>c:\msys\local\src</code>
|
|
</p>
|
|
<p>
|
|
Run from MSYS console in the source directory:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
./configure
|
|
make
|
|
make install
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section>
|
|
<h4>4.3.2.6. EXPAT</h4>
|
|
|
|
<p>
|
|
Download sources:
|
|
</p>
|
|
<blockquote>
|
|
<a href="http://dfn.dl.sourceforge.net/sourceforge/expat/expat-2.0.0.tar.gz">http://dfn.dl.sourceforge.net/sourceforge/expat/expat-2.0.0.tar.gz</a>
|
|
</blockquote>
|
|
<p>
|
|
Unpack to <code>c:\msys\local\src</code>
|
|
</p>
|
|
<p>
|
|
Run from MSYS console in the source directory:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
./configure
|
|
make
|
|
make install
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section>
|
|
<h4>4.3.2.7. POSTGRES</h4>
|
|
|
|
<p>
|
|
We're going to use precompiled binaries. Use the link below for download:
|
|
</p>
|
|
<blockquote>
|
|
<a href="http://wwwmaster.postgresql.org/download/mirrors-ftp?file=%2Fbinary%2Fv8.2.4%2Fwin32%2Fpostgresql-8.2.4-1-binaries-no-installer.zip">http://wwwmaster.postgresql.org/download/mirrors-ftp?file=%2Fbinary%2Fv8.2.4%2Fwin32%2Fpostgresql-8.2.4-1-binaries-no-installer.zip</a>
|
|
</blockquote>
|
|
<p>
|
|
copy contents of pgsql directory from the archive to <code>c:\msys\local</code>
|
|
</p>
|
|
|
|
</section>
|
|
</section>
|
|
<section>
|
|
<h3>4.3.3. Cleanup</h3>
|
|
|
|
<p>
|
|
We're done with preparation of MSYS environment. Now you can delete all stuff in <code>c:\msys\local\src</code> - it takes quite a lot
|
|
of space and it's not necessary at all.
|
|
</p>
|
|
|
|
</section>
|
|
</section>
|
|
<section id="toc17">
|
|
<h2>4.4. Building on Linux with mxe</h2>
|
|
|
|
<p>
|
|
With this approach you can cross build a Windows binary on Linux using MXE (M cross environment).
|
|
You can find the build script and a README.md file in the ms-windows/mxe directory.
|
|
</p>
|
|
<p>
|
|
For now, Python buildings cannot be built with mxe.
|
|
</p>
|
|
|
|
<section>
|
|
<h3>4.4.1. Building with Docker</h3>
|
|
|
|
<p>
|
|
This is the simplest way, but you need to have Docker installed
|
|
on your system.
|
|
</p>
|
|
<p>
|
|
You can use a Docker image to cross build QGIS by calling
|
|
the script ms-windows/mxe/build.sh from the root directory of QGIS repository.
|
|
</p>
|
|
<p>
|
|
=== Building without Docker ====
|
|
</p>
|
|
<p>
|
|
This requires to install mxe toolchain on your system and build
|
|
all dependencies by yourself.
|
|
</p>
|
|
|
|
<section>
|
|
<h4>4.4.1.1. Initial setup</h4>
|
|
|
|
<p>
|
|
Please follow the instructions on mxe website to setup your building toolchain <a href="http://mxe.cc/">http://mxe.cc/</a>,
|
|
take note of the path where you have installed mxe.
|
|
</p>
|
|
|
|
</section>
|
|
<section>
|
|
<h4>4.4.1.2. Building the dependencies</h4>
|
|
|
|
<p>
|
|
Please see README.md under ms-windows/mxe for detailed instructions and for the
|
|
list of dependencies that need to be built in mxe before attempting to build QGIS.
|
|
</p>
|
|
|
|
</section>
|
|
<section>
|
|
<h4>4.4.1.3. Cross-Building QGIS</h4>
|
|
|
|
<p>
|
|
Edit the build-mxe.sh script and optionally adjust the path where your mxe installation is located, you
|
|
can also change the build and release directories.
|
|
</p>
|
|
|
|
</section>
|
|
</section>
|
|
<section>
|
|
<h3>4.4.2. Testing QGIS</h3>
|
|
|
|
<p>
|
|
Copy and unzip on the Windows machine package produced by the build and launch the qgis binary: no installation
|
|
is required.
|
|
</p>
|
|
|
|
</section>
|
|
</section>
|
|
</section>
|
|
<section id="toc18">
|
|
<h1>5. Building on MacOS X</h1>
|
|
|
|
<p>
|
|
This document is outdated and there is currently no up to date documentation for building on mac.
|
|
You might want to consider to read an approach using Homebrew although not up to date either: <a href="https://github.com/qgis/QGIS/mac/development.md">https://github.com/qgis/QGIS/mac/development.md</a>
|
|
</p>
|
|
<p>
|
|
In this approach I will try to avoid as much as possible building dependencies
|
|
from source and rather use frameworks wherever possible.
|
|
</p>
|
|
<p>
|
|
"Universal", SDK and non-default arch builds require more complex options and
|
|
some fiddling with the system. It is best to stick with a single, default,
|
|
architecture build and follow these instructions for an initial build.
|
|
Included are notes for building on Mac OS X 10.5 (<span class="underline">Leopard</span>), 10.6
|
|
(<span class="underline">Snow Leopard</span>), 10.7 (<span class="underline">Lion</span>), 10.8 (<span class="underline">Mt. Lion</span>) and 10.9 (<span class="underline">Mavericks</span>)
|
|
(These names will be used throughout the instructions.)
|
|
Make sure to read each section completely before typing the first command you see.
|
|
</p>
|
|
<p>
|
|
<span class="underline">General note on Terminal usage:</span> 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>.
|
|
</p>
|
|
<p>
|
|
<span class="underline">Parallel Compilation:</span> 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:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
make -j [#cpus]
|
|
</pre></div>
|
|
|
|
<p>
|
|
Replace [#cpus] 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.
|
|
</p>
|
|
<p>
|
|
ie: Mac Pro "8 Core" model (2 quad core processors) = 8
|
|
</p>
|
|
<p>
|
|
ie: Macbook Pro i5 (hyperthreading) = 2 cores X 2 = 4
|
|
</p>
|
|
<p>
|
|
To find out how many CPUs you have available, run the following in Terminal:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
/usr/sbin/sysctl -n hw.ncpu
|
|
</pre></div>
|
|
|
|
<p>
|
|
which can be used in build shell scripts like:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
make -j $(/usr/sbin/sysctl -n hw.ncpu)
|
|
</pre></div>
|
|
|
|
<p>
|
|
<span class="underline">Note:</span> if you get an error in parallel compilation, try removing the -j # flag,
|
|
so it's just 'make', or using a smaller number. Sometimes make can hiccup on too
|
|
many threads.
|
|
</p>
|
|
|
|
<section id="toc19">
|
|
<h2>5.1. Install Developer Tools</h2>
|
|
|
|
<p>
|
|
Developer tools are not a part of a standard OS X installation. Up through
|
|
Snow Leopard, the Developer Tools, later called Xcode, were included with the
|
|
system install disks, though it's best to download the latest version compatible
|
|
with your system to get important updates fixing various issues.
|
|
Starting with Lion, Xcode is available as a download and from the App Store.
|
|
</p>
|
|
<p>
|
|
Downloading Xcode/Developer Tools for up through Snow Leopard requires a free developer account at
|
|
developer.apple.com. Up through Snow Leopard, get the latest <span class="underline">Xcode</span> that is
|
|
supported for your system. For Lion and above, you can get Xcode from either a
|
|
free developer account or for a minimal fee from the app store.
|
|
When installing Xcode up through Snow Leopard, make sure to
|
|
do a custom install and install the Unix Development or Command Line Tools option.
|
|
</p>
|
|
<p>
|
|
On Lion, if you have installed Xcode 4.0 - 4.2 and are upgrading to 4.3, it's
|
|
a good idea to uninstall the old version first with:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
sudo /Developer/Library/uninstall-devtools
|
|
</pre></div>
|
|
|
|
<p>
|
|
On Lion and Mt. Lion, using Xcode 4.4+, the developer command line tools can be
|
|
installed via the Xcode preferences.
|
|
</p>
|
|
<p>
|
|
Xcode 4.3+ also introduces the clang frontend to the LLVM compiler as default.
|
|
</p>
|
|
<p>
|
|
<strong>Note:</strong> In XCODE 4.5 installed from the app store, you need to install the
|
|
command line tools from XCode -> Preferences -> Downloads and choose command line tools.
|
|
</p>
|
|
<p>
|
|
<a href="http://clang.llvm.org/">http://clang.llvm.org/</a>
|
|
</p>
|
|
<p>
|
|
The supplied clang version 4 can compile QGIS, but presents many warnings
|
|
compared to just using LLVM. You can specifically use LLVM by exporting paths to
|
|
the compilers in Terminal, or shell scripts, prior to building QGIS:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
export CC=/usr/bin/llvm-gcc
|
|
export CXX=/usr/bin/llvm-g++
|
|
</pre></div>
|
|
|
|
<p>
|
|
If you have trouble building some of the dependencies listed below with clang
|
|
(e.g. OSG & osgEarth), try using only the LLVM compilers.
|
|
</p>
|
|
|
|
</section>
|
|
<section id="toc20">
|
|
<h2>5.2. Install Qt4 from disk image</h2>
|
|
|
|
<p>
|
|
You need a minimum of Qt-4.4.0. I suggest getting the latest (Qt 4, not 5). There is no need
|
|
for the full Qt SDK, so save yourself some download time and get the frameworks
|
|
only. This is available in the Libraries section of the Qt download page.
|
|
</p>
|
|
<p>
|
|
<span class="underline">Snow Leopard+ note:</span> 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, though they stopped making Carbon packages at Qt 4.7.4.
|
|
Qt 4.6+ is recommended for Cocoa.
|
|
Starting with Lion, Carbon may not work properly, if at all.
|
|
Starting with Qt 4.8, only 64bit Cocoa installers are available.
|
|
</p>
|
|
<p>
|
|
<span class="underline">General note:</span> Support for new system versions in any given Qt version may
|
|
not be present and may cause a 'This version of Mac OS X
|
|
is unsupported' error when building QGIS. Try the next Qt version.
|
|
</p>
|
|
<p>
|
|
<span class="underline">PPC note:</span> 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.
|
|
</p>
|
|
<p>
|
|
<a href="http://qt-project.org/downloads">http://qt-project.org/downloads</a>
|
|
</p>
|
|
<p>
|
|
If you want debug frameworks, Qt also provides a separate download with these.
|
|
These are in addition to the non-debug frameworks.
|
|
</p>
|
|
<p>
|
|
Earlier OS X systems may need an old Qt version - check the requirements of the
|
|
current Qt version. To get old Qt downloads, there is an FTP link at the bottom
|
|
of the download page. Files are in the qt/source (yes, even the binary packages).
|
|
</p>
|
|
<p>
|
|
Once downloaded open the disk image and run the installer. Note you need admin
|
|
privileges to install.
|
|
</p>
|
|
<p>
|
|
<span class="underline">Leopard+ note:</span> Qt includes a couple non-framework libraries in /usr/lib.
|
|
When using a system SDK these libraries will not be found. To fix this problem,
|
|
add symlinks to /usr/local:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
sudo ln -s /usr/lib/libQtUiTools.a /usr/local/lib/
|
|
sudo ln -s /usr/lib/libQtCLucene.dylib /usr/local/lib/
|
|
</pre></div>
|
|
|
|
<p>
|
|
These should then be found automatically. 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.
|
|
</p>
|
|
|
|
</section>
|
|
<section id="toc21">
|
|
<h2>5.3. Install CMake for OSX</h2>
|
|
|
|
<p>
|
|
Get the latest source release from here:
|
|
</p>
|
|
<p>
|
|
<a href="http://www.cmake.org/cmake/resources/software.html">http://www.cmake.org/cmake/resources/software.html</a>
|
|
</p>
|
|
<p>
|
|
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.
|
|
NOTE: 2.8.5 is broken for detecting part of Qt. Fixed in 2.8.6.
|
|
Double-click the source tarball to unpack it, then cd to the source folder and:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
./bootstrap --docdir=/share/doc/CMake --mandir=/share/man
|
|
make -j [#cpus]
|
|
sudo make install
|
|
</pre></div>
|
|
|
|
<section>
|
|
<h3>5.3.1. Optional setup: ccache</h3>
|
|
|
|
<p>
|
|
<span class="underline">Xcode 4.4+ note:</span> You will probably not need to install ccache if you are using
|
|
the clang frontend to LLVM compiler, a setup that already provides fairly quick
|
|
compile times.
|
|
</p>
|
|
<p>
|
|
Setup ccache to significantly speed up compile times after initial build.
|
|
(Switching git branches will again cause longer initial build times unless
|
|
separate build directories are used for each branch.)
|
|
</p>
|
|
<p>
|
|
Get the latest source release from here:
|
|
</p>
|
|
<p>
|
|
<a href="http://ccache.samba.org/">http://ccache.samba.org/</a>
|
|
</p>
|
|
<p>
|
|
Double-click the source tarball to unpack, then, in Terminal.app, cd to the
|
|
source folder and:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
./configure
|
|
make
|
|
sudo make install
|
|
</pre></div>
|
|
|
|
<p>
|
|
After install, symbolically link compilers to /usr/local/bin/ccache.
|
|
(Note: this differs from instructions at <a href="http://ccache.samba.org/manual.html">http://ccache.samba.org/manual.html</a>
|
|
Changing the /usr/bin:/usr/local/bin order in PATH is not recommended on OS X.
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
sudo mkdir /usr/local/bin/compilers && cd /usr/local/bin/compilers
|
|
sudo ln -s ../ccache gcc
|
|
sudo ln -s ../ccache g++
|
|
sudo ln -s ../ccache cc
|
|
sudo ln -s ../ccache c++
|
|
</pre></div>
|
|
|
|
<p>
|
|
Add the following to the end of your ~/.bash_profile (and optionally ~/.bashrc)
|
|
to allow your login shell to discover the symbolically linked compilers before
|
|
/usr/bin compilers and to easily toggle using ccache off, by commenting out the
|
|
line and starting a new login session in Terminal.
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
export PATH=/usr/local/bin/compilers:$PATH
|
|
</pre></div>
|
|
|
|
<p>
|
|
If you have trouble building some of the dependencies listed below (e.g. OSG &
|
|
osgEarth), try bypassing ccache.
|
|
</p>
|
|
|
|
</section>
|
|
</section>
|
|
<section id="toc22">
|
|
<h2>5.4. Install development frameworks for QGIS dependencies</h2>
|
|
|
|
<p>
|
|
Download William Kyngesburye's excellent GDAL Complete package that includes
|
|
PROJ, GEOS, GDAL, SQLite3, SpatiaLite, and image libraries, as frameworks.
|
|
There are also GSL and FreeType frameworks.
|
|
</p>
|
|
<p>
|
|
<a href="http://www.kyngchaos.com/software/frameworks">http://www.kyngchaos.com/software/frameworks</a>
|
|
</p>
|
|
<p>
|
|
Once downloaded, open and install the frameworks.
|
|
</p>
|
|
<p>
|
|
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:
|
|
</p>
|
|
<p>
|
|
<a href="http://www.kyngchaos.com/software/postgres">http://www.kyngchaos.com/software/postgres</a>
|
|
</p>
|
|
<p>
|
|
Also available is a GRASS application:
|
|
</p>
|
|
<p>
|
|
<a href="http://www.kyngchaos.com/software/grass">http://www.kyngchaos.com/software/grass</a>
|
|
</p>
|
|
<p>
|
|
Old versions of these packages for older systems are available in the
|
|
software archive section.
|
|
</p>
|
|
|
|
<section>
|
|
<h3>5.4.1. Additional dependencies: General compatibility note</h3>
|
|
|
|
<p>
|
|
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.
|
|
</p>
|
|
<p>
|
|
Stable release versions are preferred. Beta and other development versions may
|
|
have problems and you are on your own with those.
|
|
</p>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>5.4.2. Additional dependencies: Expat</h3>
|
|
|
|
<p>
|
|
<span class="underline">Snow Leopard+ note:</span> Snow Leopard includes a usable expat, so this step is
|
|
not necessary on Snow Leopard or above.
|
|
</p>
|
|
<p>
|
|
Get the expat sources:
|
|
</p>
|
|
<p>
|
|
<a href="http://sourceforge.net/project/showfiles.php?group_id=10127">http://sourceforge.net/project/showfiles.php?group_id=10127</a>
|
|
</p>
|
|
<p>
|
|
Double-click the source tarball to unpack, then, in Terminal.app, cd to the
|
|
source folder and:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
./configure
|
|
make
|
|
sudo make install
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>5.4.3. Additional dependencies: Spatialindex</h3>
|
|
|
|
<p>
|
|
Get the libspatialindex sources:
|
|
</p>
|
|
<p>
|
|
<a href="http://download.osgeo.org/libspatialindex/">http://download.osgeo.org/libspatialindex/</a>
|
|
</p>
|
|
<p>
|
|
Double-click the source tarball to unpack, then, in Terminal.app, cd to the
|
|
source folder and:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
./configure --disable-dependency-tracking CFLAGS=-Os
|
|
make
|
|
sudo make install
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>5.4.4. Additional dependencies: Python</h3>
|
|
|
|
<p>
|
|
<span class="underline">Leopard+ note:</span> Starting with Leopard a usable Python is included
|
|
in the system. This is Python 2.5, 2.6 and 2.7, respectively for Leo, Snow and Lion+.
|
|
So there is no need to install Python on Leopard and newer.
|
|
You can still install Python from python.org if preferred.
|
|
</p>
|
|
<p>
|
|
If installing from python.org, make sure you install the latest Python
|
|
2.x from
|
|
</p>
|
|
<p>
|
|
<a href="http://www.python.org/download/">http://www.python.org/download/</a>
|
|
</p>
|
|
<p>
|
|
Python 3 is a major change, and may have compatibility issues, so try it at
|
|
your own risk.
|
|
</p>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>5.4.5. Additional dependencies: SIP</h3>
|
|
|
|
<p>
|
|
<span class="underline">Mt Lion note:</span> SIP 4.15.7 appears to not work on Mt Lion. Install either
|
|
a prior version to 4.14.6 or a later version 4.16.3+
|
|
</p>
|
|
<p>
|
|
Retrieve the python bindings toolkit SIP from
|
|
</p>
|
|
<p>
|
|
<a href="http://www.riverbankcomputing.com/software/sip/download">http://www.riverbankcomputing.com/software/sip/download</a>
|
|
</p>
|
|
<p>
|
|
Double-click the source tarball to unpack it, then, in Terminal.app,
|
|
cd to the source folder. Then for your chosen Python:
|
|
</p>
|
|
<p>
|
|
<span class="underline">python.org Python</span>
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
python configure.py
|
|
make
|
|
sudo make install
|
|
</pre></div>
|
|
|
|
<p>
|
|
<span class="underline">Leopard system Python</span>
|
|
</p>
|
|
<p>
|
|
SIP wants to install in the system path -- this is not a good idea.
|
|
More configuration is needed to install outside the system path:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
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
|
|
</pre></div>
|
|
|
|
<p>
|
|
<span class="underline">Snow Leopard system Python</span>
|
|
</p>
|
|
<p>
|
|
Similar to Leopard, you should install outside the system Python path.
|
|
Also, you need to specify the architecture you want and make sure to run the
|
|
versioned python binary (this one responds to the 'arch' command, 'python' does
|
|
not). Substitute '2.7' for python version and 10.7 for SDK version below for
|
|
Lion.
|
|
</p>
|
|
<p>
|
|
If you are using 32-bit Qt (Qt Carbon):
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
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
|
|
</pre></div>
|
|
|
|
<p>
|
|
For 64-bit Qt (Qt Cocoa), use this configure line:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
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
|
|
</pre></div>
|
|
|
|
<p>
|
|
<span class="underline">Lion+ system Python</span>
|
|
</p>
|
|
<p>
|
|
Similar to Snow Leopard, you should install outside the system Python path.
|
|
The SDK option should match the system you are compiling on:
|
|
</p>
|
|
<p>
|
|
for Lion:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
python2.7 configure.py -d /Library/Python/2.7/site-packages -b /usr/local/bin \
|
|
-e /usr/local/include -v /usr/local/share/sip --arch=x86_64 -s MacOSX10.7.sdk
|
|
</pre></div>
|
|
|
|
<p>
|
|
for Mt. Lion:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
python2.7 configure.py -d /Library/Python/2.7/site-packages -b /usr/local/bin \
|
|
-e /usr/local/include -v /usr/local/share/sip --arch=x86_64 -s MacOSX10.8.sdk
|
|
</pre></div>
|
|
|
|
<p>
|
|
for Mavericks:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
python2.7 configure.py -d /Library/Python/2.7/site-packages -b /usr/local/bin \
|
|
-e /usr/local/include -v /usr/local/share/sip --arch=x86_64 -s MacOSX10.9.sdk
|
|
</pre></div>
|
|
|
|
<p>
|
|
<span class="underline">continue...</span>
|
|
</p>
|
|
<p>
|
|
Then continue with compilation and installation:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
make
|
|
sudo make install
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>5.4.6. Additional dependencies: QScintilla2</h3>
|
|
|
|
<p>
|
|
Retrieve the Qt version of the Scintilla-based text editor widget from
|
|
</p>
|
|
<p>
|
|
<a href="http://www.riverbankcomputing.co.uk/software/qscintilla/download">http://www.riverbankcomputing.co.uk/software/qscintilla/download</a>
|
|
</p>
|
|
<p>
|
|
Double-click the tarball to unpack it. Then, cd to the QScintilla2.x.x source
|
|
folder in a Terminal.
|
|
</p>
|
|
<p>
|
|
QScintilla2 wants to install in the system path -- with libraries going into
|
|
/Library/Frameworks and headers into /usr/include/Qsci -- this is not a good
|
|
idea, and it also basically breaks the QtDesigner plugin. More configuration
|
|
is needed to install outside the system path, in /usr/local/:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
cd Qt4Qt5
|
|
</pre></div>
|
|
|
|
<p>
|
|
Edit QScintilla-gpl-2.x.x/Qt4Qt5/qscintilla.pro in the following manner:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
current line --> new line
|
|
|
|
target.path = $$[QT_INSTALL_LIBS] --> target.path = /usr/local/lib
|
|
header.path = $$[QT_INSTALL_HEADERS] --> header.path = /usr/local/include
|
|
</pre></div>
|
|
|
|
<p>
|
|
Save the qscintilla.pro file and build the QScintilla2 C++ library:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
qmake -spec macx-g++ qscintilla.pro
|
|
make -j [#cpus]
|
|
sudo make install
|
|
</pre></div>
|
|
|
|
<p>
|
|
adjust the install_name_tool command for the version installed of QScintilla installed:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
sudo install_name_tool -id /usr/local/lib/libqscintilla2.11.dylib \
|
|
/usr/local/lib/libqscintilla2.11.dylib
|
|
</pre></div>
|
|
|
|
<p>
|
|
This installs QScintilla2's dylib in /usr/local/lib/ and the header files in
|
|
/usr/local/include/Qsci/, both of which should be automatically found when
|
|
building QGIS.
|
|
</p>
|
|
|
|
<section>
|
|
<h4>5.4.6.1. Optional setup: QScintilla2 QtDesigner plugin</h4>
|
|
|
|
<p>
|
|
The plugin allows QScintilla2 widgets to be used within QtDesigner.
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
cd <QScintilla2 source directory>
|
|
cd designer-Qt4Qt5
|
|
qmake -spec macx-g++ designer.pro
|
|
make
|
|
sudo make install
|
|
</pre></div>
|
|
|
|
<p>
|
|
Installs in /Developer/Applications/Qt/plugins/designer/
|
|
</p>
|
|
|
|
</section>
|
|
</section>
|
|
<section>
|
|
<h3>5.4.7. Additional dependencies: PyQt</h3>
|
|
|
|
<p>
|
|
Retrieve the python bindings toolkit for Qt from
|
|
</p>
|
|
<p>
|
|
<a href="http://www.riverbankcomputing.com/software/pyqt/download">http://www.riverbankcomputing.com/software/pyqt/download</a>
|
|
</p>
|
|
<p>
|
|
Double-click the source tarball to unpack it, then, in Terminal.app,
|
|
cd to the source folder. Then for your chosen Python:
|
|
</p>
|
|
<p>
|
|
<span class="underline">python.org Python</span>
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
python configure.py -n /usr/local/Qt4.8/qsci
|
|
yes
|
|
</pre></div>
|
|
|
|
<p>
|
|
<span class="underline">Leopard system Python</span>
|
|
</p>
|
|
<p>
|
|
PyQt wants to install in the system path -- this is not a good idea.
|
|
More configuration is needed to install outside the system path:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
python configure.py -d /Library/Python/2.5/site-packages -b /usr/local/bin -n /usr/local/Qt4.8/qsci -v /usr/local/share/sip/PyQt4
|
|
</pre></div>
|
|
|
|
<p>
|
|
<span class="underline">Snow Leopard system Python</span>
|
|
</p>
|
|
<p>
|
|
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).
|
|
Substitute '2.7' for python version and 10.7 for SDK version below for Lion.
|
|
</p>
|
|
<p>
|
|
If you are using 32-bit Qt (Qt Carbon):
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
python2.6 configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin \
|
|
-n /usr/local/Qt4.8/qsci -v /usr/local/share/sip/PyQt4 --use-arch i386
|
|
</pre></div>
|
|
|
|
<p>
|
|
For 64-bit Qt (Qt Cocoa), use this configure line:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
python2.6 configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin \
|
|
-n /usr/local/Qt4.8/qsci -v /usr/local/share/sip/PyQt4 --use-arch x86_64
|
|
</pre></div>
|
|
|
|
<p>
|
|
<span class="underline">Lion, Mt. Lion, and Mavericks system Python</span>
|
|
</p>
|
|
<p>
|
|
Similar to Snow Leopard, you should install outside the system Python path.
|
|
But you don't need the use-arch option:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
python2.7 configure.py -d /Library/Python/2.7/site-packages -b /usr/local/bin -n /usr/local/Qt4.8/qsci -v /usr/local/share/sip/PyQt4
|
|
</pre></div>
|
|
|
|
<p>
|
|
<span class="underline">continue...</span>
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
make -j [#cpus]
|
|
sudo make install
|
|
</pre></div>
|
|
|
|
<p>
|
|
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.
|
|
</p>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>5.4.8. Additional dependencies: QScintilla2 Python Module</h3>
|
|
|
|
<p>
|
|
This will create the Qsci.so module in /Library/Python/2.x/site-packages/PyQt4.
|
|
Like PyQt, it needs help to not install in system locations.
|
|
</p>
|
|
<p>
|
|
<span class="underline">Snow Leopard:</span> substitute '2.6' for Python version
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
cd <QScintilla2 source dir>
|
|
cd Python
|
|
python2.7 configure.py -o /usr/local/lib -n /usr/local/include \
|
|
-d /Library/Python/2.7/site-packages/PyQt4 -v /usr/local/share/sip/PyQt4 \
|
|
--sip-incdir=/usr/local/include --pyqt-sipdir=/usr/local/share/sip/PyQt4
|
|
cat >>Qsci.pro <<EOF
|
|
QMAKE_LFLAGS_PLUGIN -= -dynamiclib
|
|
QMAKE_LFLAGS_PLUGIN += -bundle
|
|
EOF
|
|
qmake -spec macx-g++ Qsci.pro
|
|
make -j [#cpus]
|
|
sudo make install
|
|
</pre></div>
|
|
|
|
<p>
|
|
The -o and -n options should match the QScintilla2 C++ dylib install options.
|
|
</p>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>5.4.9. Additional dependencies: Qwt</h3>
|
|
|
|
<p>
|
|
The GPS tracking feature uses Qwt.
|
|
</p>
|
|
<p>
|
|
NOTE: PyQwt is not compatible with PyQt 4.9, so we will skip that.
|
|
</p>
|
|
<p>
|
|
Download the latest Qwt 6.0 source (6.1 does not work with the QwtPolar in QGIS) from:
|
|
</p>
|
|
<p>
|
|
<a href="http://sourceforge.net/projects/qwt">http://sourceforge.net/projects/qwt</a>
|
|
</p>
|
|
<p>
|
|
Double-click the tarball to unpack it. Now, cd to the qwt source folder in a
|
|
Terminal.
|
|
</p>
|
|
<p>
|
|
Type these commands to build and install 6.0.x (assumes v6.0.2, adjust commands
|
|
for other version as needed):
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
cat >> qwtconfig.pri <<EOF
|
|
QWT_CONFIG -= QwtFramework
|
|
EOF
|
|
qmake -spec macx-g++
|
|
make -j [#cpus]
|
|
sudo make install
|
|
|
|
sudo install_name_tool -id /usr/local/qwt-6.0.2/lib/libqwt.6.dylib \
|
|
/usr/local/qwt-6.0.2/lib/libqwt.6.dylib
|
|
</pre></div>
|
|
|
|
<p>
|
|
The Qwt shared library is now installed in /usr/local/qwt-6.0.x (x is
|
|
the point version). Remember this for QGIS configuration.
|
|
</p>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>5.4.10. Additional dependencies: Bison</h3>
|
|
|
|
<p>
|
|
The version of bison available by default on Mac OS X is too old so you
|
|
need to get a more recent one on your system. Download at least version 2.4 from:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
ftp.gnu.org/gnu/bison/
|
|
</pre></div>
|
|
|
|
<p>
|
|
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:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
./configure --disable-dependency-tracking CFLAGS=-Os
|
|
make
|
|
sudo make install
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>5.4.11. Additional dependencies: gpsbabel</h3>
|
|
|
|
<p>
|
|
For integrated GPS Tools functions, a gpsbabel executable is required. You can
|
|
find this at:
|
|
</p>
|
|
<p>
|
|
<a href="http://www.gpsbabel.org/">http://www.gpsbabel.org/</a>
|
|
</p>
|
|
<p>
|
|
Download the GPSBabel OS X package, and copy GPSBabelFE.app from the disk image to
|
|
/Applications.
|
|
</p>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>5.4.12. Optional dependencies: libfcgi</h3>
|
|
|
|
<p>
|
|
If you want to use the QGIS Mapserver, you need libfcgi. This is included on
|
|
systems up through Snow Leopard, but was dropped at Lion. So, on Lion you need
|
|
to get the source from:
|
|
</p>
|
|
<p>
|
|
<a href="http://www.fastcgi.com/dist/">http://www.fastcgi.com/dist/</a>
|
|
</p>
|
|
<p>
|
|
Grab the latest fcgi SNAP package there. Double-click the source
|
|
tarball to unpack it, then cd to the source folder and:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
./configure --disable-dependency-tracking CFLAGS=-Os
|
|
make
|
|
sudo make install
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section>
|
|
<h3>5.4.13. Optional dependencies: OSG & osgEarth</h3>
|
|
|
|
<p>
|
|
If you want the Globe plugin in QGIS (default OFF), OSG and osgEarth are needed.
|
|
</p>
|
|
<p>
|
|
First, <strong>OpenSceneGraph</strong>. The main site is very out of date, just go to
|
|
github:
|
|
</p>
|
|
<p>
|
|
<a href="http://github.com/openscenegraph/osg/tags">http://github.com/openscenegraph/osg/tags</a>
|
|
</p>
|
|
<p>
|
|
Download the latest 3.1 version (you can select a tarball when you hover over
|
|
the entry). Double-click the source tarball to unpack it.
|
|
(There is a version numbering oddity in the source, but since we'll be
|
|
bundling OSG as it's meant to be, it really doesn't matter).
|
|
</p>
|
|
<p>
|
|
Installation is a bit out of touch with OS X standards, so we'll stage it to a
|
|
temporary location first. You could stage it to the folder that the OSG source
|
|
folder is in, or a common staging area like /Users/Shared/unix/osg. Pick a
|
|
folder not hidden and that doesn't need admin permissions to write to for simplicity.
|
|
</p>
|
|
<p>
|
|
If you are building on Leopard, its configure forces a old ppc/i386 32bit build.
|
|
If you want 64bit you need to fix CMakeLists.txt - in a text editor, find the
|
|
if-block that starts with:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
ELSEIF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.6" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.5")
|
|
</pre></div>
|
|
|
|
<p>
|
|
In that section before the next ELSEIF, change:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
ppc;i386
|
|
</pre></div>
|
|
|
|
<p>
|
|
to:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
i386;x86_64
|
|
</pre></div>
|
|
|
|
<p>
|
|
and change:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
mmacosx-version-min=10.5
|
|
</pre></div>
|
|
|
|
<p>
|
|
to:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
mmacosx-version-min=10.6
|
|
</pre></div>
|
|
|
|
<p>
|
|
In a new Terminal cd to the source folder and:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
mkdir build
|
|
cd build
|
|
cmake -D CMAKE_INSTALL_PREFIX=/path/to/some/staging/folder \
|
|
-D OSG_COMPILE_FRAMEWORKS=ON \
|
|
-D OSG_PLUGIN_SEARCH_INSTALL_DIR_FOR_PLUGINS=OFF \
|
|
-D JASPER_LIBRARY=/Library/Frameworks/UnixImageIO.framework \
|
|
-D JASPER_INCLUDE_DIR=/Library/Frameworks/UnixImageIO.framework/Headers \
|
|
-D TIFF_LIBRARY=/Library/Frameworks/UnixImageIO.framework \
|
|
-D TIFF_INCLUDE_DIR=/Library/Frameworks/UnixImageIO.framework/Headers \
|
|
..
|
|
make
|
|
make install
|
|
sudo mkdir -p "/Library/Application Support/OpenSceneGraph/PlugIns"
|
|
</pre></div>
|
|
|
|
<p>
|
|
Open the staging folder you chose for the CMAKE_INSTALL_PREFIX option above.
|
|
</p>
|
|
<p>
|
|
Now move all .frameworks from the lib/ folder in the staging area to /Library/Frameworks. Move the files in the osgPlugins folder in the lib/ folder
|
|
to /Library/Application Support/OpenSceneGraph/PlugIns. The bin/ executables
|
|
can be left where they are.
|
|
</p>
|
|
<p>
|
|
Next up is <strong>libzip</strong>. Get the latest tarball at:
|
|
</p>
|
|
<p>
|
|
<a href="http://nih.at/libzip/">http://nih.at/libzip/</a>
|
|
</p>
|
|
<p>
|
|
Double-click the source tarball to unpack it.
|
|
In a new Terminal cd to the source folder and:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
./configure --disable-dependency-tracking --disable-shared CFLAGS=-Os
|
|
make
|
|
sudo make install
|
|
</pre></div>
|
|
|
|
<p>
|
|
Then it's time for <strong>osgEarth</strong>. Downloads are also on github:
|
|
</p>
|
|
<p>
|
|
<a href="http://github.com/gwaldron/osgearth/tags">http://github.com/gwaldron/osgearth/tags</a>
|
|
</p>
|
|
<p>
|
|
Download a tarball for the latest stable release (sorting can be confusing here).
|
|
Double-click the source tarball to unpack it.
|
|
</p>
|
|
<p>
|
|
<span class="underline">Note:</span> for now stick with version 2.3. There are compile errors in 2.4 that need attention.
|
|
</p>
|
|
<p>
|
|
This one also needs an intermediate staging area. Choose a folder similar to OSG.
|
|
</p>
|
|
<p>
|
|
In a new Terminal cd to the source folder and:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
mkdir build
|
|
cd build
|
|
export PATH="/path/to/osg/staging/folder/bin:$PATH"
|
|
cmake -D CMAKE_INSTALL_PREFIX=/path/to/some/staging/folder \
|
|
-D CMAKE_BUILD_TYPE=MinSizeRel \
|
|
-D OSGEARTH_BUILD_FRAMEWORKS=true \
|
|
..
|
|
make
|
|
make install
|
|
sudo mkdir -p "/Library/Application Support/OpenSceneGraph/Headers"
|
|
</pre></div>
|
|
|
|
<p>
|
|
Open the staging folder you chose for the CMAKE_INSTALL_PREFIX option above.
|
|
Also open the OSG staging path /bin folder from the OSG build.
|
|
</p>
|
|
<p>
|
|
Move all the .frameworks from the lib/ folder to /Library/Frameworks.
|
|
Move the files in the osgPlugins folder in the lib/ folder to
|
|
/Library/Application Support/OpenSceneGraph/PlugIns. Move the osgEarthDrivers
|
|
folder in the include/ folder to /Library/Application Support/OpenSceneGraph/Headers.
|
|
(you may need to create this folder)
|
|
And as for OSG, you can leave the bin/ executables where they are.
|
|
</p>
|
|
|
|
</section>
|
|
</section>
|
|
<section id="toc23">
|
|
<h2>5.5. API documentation</h2>
|
|
|
|
<p>
|
|
If you want to build a local copy of the API docs (like those at
|
|
<a href="http://doc.qgis.org/api">http://doc.qgis.org/api</a>) you will need Graphviz and Doxygen installed:
|
|
</p>
|
|
<p>
|
|
<a href="http://www.graphviz.org/Download_macos.php">http://www.graphviz.org/Download_macos.php</a>
|
|
</p>
|
|
<p>
|
|
<a href="http://www.stack.nl/~dimitri/doxygen/download.html">http://www.stack.nl/~dimitri/doxygen/download.html</a>
|
|
</p>
|
|
<p>
|
|
Graphviz is simply installed via a regular Mac package installer. Install it
|
|
first. It will place some of its binaries in /usr/local/bin/.
|
|
</p>
|
|
<p>
|
|
For Doxygen, compiling the source is recommended over installing the app.
|
|
Double-click the source tarball to unpack it, then cd to the source folder and:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
./configure
|
|
make -j [#cpus]
|
|
sudo make install
|
|
</pre></div>
|
|
|
|
<p>
|
|
The documentation will be output to the build directory, and if using more complete
|
|
QGIS.app bundling on install, inside the app in:
|
|
</p>
|
|
<p>
|
|
QGIS.app/Contents/Resources/doc
|
|
</p>
|
|
|
|
</section>
|
|
<section id="toc24">
|
|
<h2>5.6. QGIS source</h2>
|
|
|
|
<p>
|
|
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.
|
|
</p>
|
|
<p>
|
|
If you want to experiment with the latest development sources, go to the github
|
|
QGIS project page:
|
|
</p>
|
|
<p>
|
|
<a href="http://github.com/qgis/QGIS">http://github.com/qgis/QGIS</a>
|
|
</p>
|
|
<p>
|
|
It should default to the master branch. Click the <span class="underline">Downloads</span> button and
|
|
select <span class="underline">Download .tar.gz</span>. Double-click the tarball to unzip it.
|
|
</p>
|
|
<p>
|
|
<em>Alternatively</em>, install git from <a href="http://git-scm.com">http://git-scm.com</a> and do the following.
|
|
</p>
|
|
<p>
|
|
Make a specific repository directory somewhere, e.g. ~/QGIS/QGIS, and cd
|
|
into it. The following will read-only clone the master branch to the directory:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
git init
|
|
git remote add -f -t master -m master qgisupstream git://github.com/qgis/QGIS.git
|
|
git merge qgisupstream
|
|
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section id="toc25">
|
|
<h2>5.7. Configure the build</h2>
|
|
|
|
<p>
|
|
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 ${HOME}/Applications directory.
|
|
</p>
|
|
<p>
|
|
You have two interactive options for configuring the build: ccmake or run
|
|
Terminal commands. ccmake is a curses interface inside Terminal for CMake and
|
|
allows a tabular layout for viewing and editing ALL available QGIS source CMake
|
|
options. To get started initially run the Terminal method.
|
|
</p>
|
|
<p>
|
|
In a Terminal cd to the qgis source folder previously downloaded, then:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
mkdir build
|
|
cd build
|
|
cmake -D CMAKE_INSTALL_PREFIX=~/Applications \
|
|
-D CMAKE_BUILD_TYPE=MINSIZEREL -D ENABLE_TESTS=FALSE \
|
|
-D SPATIALINDEX_LIBRARY=/usr/local/lib/libspatialindex.dylib \
|
|
-D SPATIALINDEX_INCLUDE_DIR=/usr/local/include/spatialindex \
|
|
-D QWT_LIBRARY=/usr/local/qwt-6.0.2/lib/libqwt.dylib \
|
|
-D QWT_INCLUDE_DIR=/usr/local/qwt-6.0.2/include \
|
|
-D BISON_EXECUTABLE=/usr/local/bin/bison \
|
|
..
|
|
</pre></div>
|
|
|
|
<p>
|
|
<span class="underline">Note:</span> Don't forget the .. on the last line, which tells CMake to look for the
|
|
source files in one directory up.
|
|
</p>
|
|
<p>
|
|
After the initial Terminal configure, you can use ccmake to make further changes:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
cd build
|
|
ccmake ..
|
|
</pre></div>
|
|
|
|
<p>
|
|
This will automatically find and use the previously installed frameworks, and
|
|
the GRASS application if installed. Remember to change the Qwt version if a
|
|
different version was installed, and possibly paths, e.g. for Qwt 6.0.2 installed
|
|
as a framework use:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
-D QWT_LIBRARY=/usr/local/qwt-6.0.2/lib/qwt.framework/qwt \
|
|
-D QWT_INCLUDE_DIR=/usr/local/qwt-6.0.2/lib/qwt.framework/Headers \
|
|
</pre></div>
|
|
|
|
<p>
|
|
If you want to use a newer PostgreSQL client than the default Mac OS X version,
|
|
e.g. install from kyngchaos.com, set the following option to pg_config's path:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
-D POSTGRES_CONFIG=/usr/local/pgsql/bin/pg_config \
|
|
</pre></div>
|
|
|
|
<p>
|
|
To build a local copy of the API docs (see API documentation section above):
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
-D WITH_APIDOC=TRUE \
|
|
</pre></div>
|
|
|
|
<p>
|
|
<span class="underline">Snow Leopard note:</span> To handle 32-bit Qt (Carbon), create a 32bit python wrapper
|
|
script and add arch flags to the configuration:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
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 CMAKE_BUILD_TYPE=MINSIZEREL -D ENABLE_TESTS=FALSE \
|
|
-D WITH_INTERNAL_SPATIALITE=FALSE \
|
|
-D SPATIALINDEX_LIBRARY=/usr/local/lib/libspatialindex.dylib \
|
|
-D SPATIALINDEX_INCLUDE_DIR=/usr/local/include/spatialindex \
|
|
-D QWT_LIBRARY=/usr/local/qwt-5.2.2/lib/libqwt.dylib \
|
|
-D QWT_INCLUDE_DIR=/usr/local/qwt-5.2.2/include \
|
|
-D BISON_EXECUTABLE=/usr/local/bin/bison \
|
|
-D CMAKE_OSX_ARCHITECTURES=i386 -D PYTHON_EXECUTABLE=/usr/local/bin/python32 \
|
|
..
|
|
</pre></div>
|
|
|
|
<p>
|
|
<span class="underline">Mapserver note:</span> The QGIS Mapserver feature requires fastcgi support. This is included in
|
|
Leopard and Snow Leopard, but was dropped at Lion. To build the Mapserver
|
|
component on Leopard and Snow, add the following line before the last line in
|
|
the above configuration:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
-D WITH_SERVER=TRUE \
|
|
</pre></div>
|
|
|
|
<p>
|
|
On Lion you are on your own to figure out how to install libfcgi and add fcgi
|
|
support to the system Apache. Not recommended for the average user.
|
|
</p>
|
|
<p>
|
|
<span class="underline">Globe plugin note:</span> If you want the Globe plugin (and you compiled and installed OSG/osgEarth),
|
|
add the following lines before the last line in the above configuration:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
-D WITH_GLOBE=true \
|
|
-D OSGEARTH_INCLUDE_DIR="/Library/Application Support/OpenSceneGraph/Headers" \
|
|
-D OSG_PLUGINS_PATH="/Library/Application Support/OpenSceneGraph/PlugIns" \
|
|
</pre></div>
|
|
|
|
<p>
|
|
<span class="underline">Bundling note:</span> 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. The
|
|
default is to bundle Qt (and osg/osgEarth, if configured).
|
|
</p>
|
|
<p>
|
|
Even better for distribution purposes, to also bundle any extra non-framework,
|
|
non-standard, libs (ie postgres' libpq) set the bundle value to 2:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
-D QGIS_MACAPP_BUNDLE=2 \
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section id="toc26">
|
|
<h2>5.8. Building</h2>
|
|
|
|
<p>
|
|
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):
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
make -j [#cpus]
|
|
</pre></div>
|
|
|
|
<p>
|
|
If all built without errors you can then install it:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
make install
|
|
</pre></div>
|
|
|
|
<p>
|
|
or, for an /Applications build:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
sudo make install
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section id="toc27">
|
|
<h2>5.9. Post-Install</h2>
|
|
|
|
<p>
|
|
A couple things to take care of.
|
|
</p>
|
|
<p>
|
|
<strong>gpsbabel</strong>
|
|
</p>
|
|
<p>
|
|
For QGIS to <em>easily</em> find gpsbabel, you need to copy the gpsbabel executable
|
|
to the QGIS application. Assuming you installed QGIS in your home folder:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
cp -fp /Applications/GPSBabelFE.app/Contents/MacOS/gpsbabel ~/QGIS.app/Contents/MacOS/bin/
|
|
</pre></div>
|
|
|
|
<p>
|
|
If you installed in /Applications, adjust the path accordingly and prefix the
|
|
whole command with 'sudo '.
|
|
</p>
|
|
<p>
|
|
<strong>QGIS Server</strong>
|
|
</p>
|
|
<p>
|
|
See the QGIS Server documentation page at:
|
|
</p>
|
|
<p>
|
|
<a href="http://docs.qgis.org/2.18/en/docs/user_manual/working_with_ogc/ogc_server_support.html">http://docs.qgis.org/2.18/en/docs/user_manual/working_with_ogc/ogc_server_support.html</a>
|
|
</p>
|
|
<p>
|
|
for instructions on setting up Apache fastcgi and testing qgis server, including
|
|
installing the mod-fastcgi that is missing on Lion.
|
|
</p>
|
|
|
|
</section>
|
|
</section>
|
|
<section id="toc28">
|
|
<h1>6. Setting up the WCS test server on GNU/Linux</h1>
|
|
|
|
<p>
|
|
<strong>Requires:</strong> Ubuntu / Debian derived distro
|
|
</p>
|
|
<p>
|
|
These notes are for Ubuntu - other versions and Debian derived distros may
|
|
require slight variations in package names.
|
|
</p>
|
|
|
|
<section id="toc29">
|
|
<h2>6.1. Preparation</h2>
|
|
|
|
<p>
|
|
Note the git repo below will change to the default QGIS repo once this work
|
|
is integrated into master.
|
|
</p>
|
|
<p>
|
|
git remote add blazek git://github.com/blazek/Quantum-GIS.git
|
|
git fetch blazek
|
|
git branch --track wcs2 blazek/wcs2
|
|
git checkout wcs2
|
|
cd /var/www/
|
|
sudo mkdir wcs
|
|
sudo chown timlinux wcs
|
|
cd wcs/
|
|
mkdir cgi-bin
|
|
cd cgi-bin/
|
|
</p>
|
|
|
|
</section>
|
|
<section id="toc30">
|
|
<h2>6.2. Setup mapserver</h2>
|
|
|
|
<p>
|
|
<code>`sudo apt-get install cgi-mapserver`</code>
|
|
</p>
|
|
<p>
|
|
Set the contents of cgi-bin/wcstest-1.9.0 to:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
#! /bin/sh
|
|
MS_MAPFILE=/var/www/wcs/testdata/qgis-1.9.0/raster/wcs.map
|
|
export MS_MAPFILE
|
|
/usr/lib/cgi-bin/mapserv
|
|
</pre></div>
|
|
|
|
<p>
|
|
Then do:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
chmod +x cgi-bin/wcstest-1.9.0
|
|
mkdir -p /var/www/wcs/testdata/qgis-1.9.0/raster/
|
|
cd /var/www/wcs/testdata/qgis-1.9.0/raster/
|
|
cp -r /home/timlinux/QGIS/tests/testdata/raster/* .
|
|
</pre></div>
|
|
|
|
<p>
|
|
Edit wcs.map and set the shapepath to this:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
SHAPEPATH "/var/www/wcs/testdata/qgis-1.9.0/raster"
|
|
</pre></div>
|
|
|
|
<p>
|
|
Then create /var/www/wcs/7-wcs.qgis.org.conf setting the contents to this:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
<VirtualHost *:80>
|
|
ServerName wcs.qgis.org
|
|
ServerAdmin tim@linfiniti.com
|
|
|
|
LogLevel warn
|
|
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{forensic-id}n\"" combined
|
|
CustomLog /var/log/apache2/wcs_qgis.org/access.log combined
|
|
ErrorLog /var/log/apache2/wcs_qgis.org/error.log
|
|
|
|
DocumentRoot /var/www/wcs/html
|
|
|
|
ScriptAlias /cgi-bin/ /var/www/wcs/cgi-bin/
|
|
<Directory "/var/www/wcs/cgi-bin">
|
|
AllowOverride None
|
|
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
|
|
Order allow,deny
|
|
Allow from all
|
|
</Directory>
|
|
|
|
RewriteEngine on
|
|
RewriteRule /1.9.0/wcs /cgi-bin/wcstest-1.9.0 [PT]
|
|
|
|
</VirtualHost>
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section id="toc31">
|
|
<h2>6.3. Create a home page</h2>
|
|
|
|
<div class="code"><pre>
|
|
mkdir html
|
|
vim html/index.html
|
|
</pre></div>
|
|
|
|
<p>
|
|
Set the contents to:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
This is the test platform for QGIS' wcs client. You can use these services
|
|
from QGIS directly (to try out WCS for example) by pointing your QGIS to:
|
|
http://wcs.qgis.org/1.9.0/wcs
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section id="toc32">
|
|
<h2>6.4. Now deploy it</h2>
|
|
|
|
<div class="code"><pre>
|
|
sudo mkdir /var/log/apache2/wcs_qgis.org
|
|
sudo chown www-data /var/log/apache2/wcs_qgis.org
|
|
cd /etc/apache2/sites-available/
|
|
sudo ln -s /var/www/wcs/7-wcs.qgis.org.conf .
|
|
cd /var/www/wcs/
|
|
sudo a2ensite 7-wcs.qgis.org.conf
|
|
sudo /etc/init.d/apache2 reload
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section id="toc33">
|
|
<h2>6.5. Debugging</h2>
|
|
|
|
<div class="code"><pre>
|
|
sudo tail -f /var/log/apache2/wcs_qgis.org/error.log
|
|
</pre></div>
|
|
|
|
</section>
|
|
</section>
|
|
<section id="toc34">
|
|
<h1>7. Setting up a Jenkins Build Server</h1>
|
|
|
|
<p>
|
|
<strong>Assumption:</strong> You know how to make a working build environment and want to
|
|
deploy it under Jenkins for continuous integration testing now.
|
|
</p>
|
|
<p>
|
|
These notes are terse, I will expand on them later as the need arises. The
|
|
procedure is:
|
|
</p>
|
|
|
|
<ul>
|
|
<li>Install Jenkins and get it configured according to your own preferences
|
|
</li>
|
|
<li>Make sure you have the git, github, junit etc plugins installed. A complete
|
|
list of the plugins I have installed follows (note that you almost certainly
|
|
don't need evey plugin listed here):
|
|
<ul>
|
|
<li>External Monitor Job Type Plugin
|
|
</li>
|
|
<li>LDAP Plugin
|
|
</li>
|
|
<li>pam-auth
|
|
</li>
|
|
<li>javadoc
|
|
</li>
|
|
<li>ant
|
|
</li>
|
|
<li>Jenkins Subversion Plug-in
|
|
</li>
|
|
<li>Git Plugin
|
|
</li>
|
|
<li>Maven 2 Project Plugin
|
|
</li>
|
|
<li>Jenkins SLOCCount Plug-in
|
|
</li>
|
|
<li>Jenkins Sounds plugin
|
|
</li>
|
|
<li>Jenkins Translation Assistance plugin
|
|
</li>
|
|
<li>ruby-runtime
|
|
</li>
|
|
<li>Jenkins CVS Plug-in
|
|
</li>
|
|
<li>Coverage/Complexity Scatter Plot PlugIn
|
|
</li>
|
|
<li>Status Monitor Plugin
|
|
</li>
|
|
<li>Git Parameter Plug-In
|
|
</li>
|
|
<li>github-api
|
|
</li>
|
|
<li>GitHub plugin
|
|
</li>
|
|
<li>Jenkins Violations plugin
|
|
</li>
|
|
<li>git-notes Plugin
|
|
</li>
|
|
<li>Twitter plugin
|
|
</li>
|
|
<li>Jenkins Cobertura Plugin
|
|
</li>
|
|
<li>Jenkins Gravatar plugin
|
|
</li>
|
|
<li>Jenkins SSH Slaves plugin
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>Create a Job called 'QGIS'
|
|
</li>
|
|
<li>Use the following options for your job:
|
|
<ul>
|
|
<li>Job Name: QGIS
|
|
</li>
|
|
<li>Job Type: Build a free-style software project
|
|
</li>
|
|
<li>Tick enable project based security (you need to elsewhere configure your
|
|
Jenkins security to per project settings)
|
|
</li>
|
|
<li>Allow Anonymous user Read and Discover access
|
|
</li>
|
|
<li>Set the github project to <a href="https://github.com/qgis/QGIS/">https://github.com/qgis/QGIS/</a>
|
|
</li>
|
|
<li>Set source code management to Git
|
|
</li>
|
|
<li>Set repository url to git://github.com/qgis/QGIS.git
|
|
</li>
|
|
<li>In advanced repository url settings set refspec to :
|
|
<p></p>
|
|
|
|
<div class="code"><pre>
|
|
+refs/heads/master:refs/remotes/origin/master
|
|
</pre></div>
|
|
|
|
<p></p>
|
|
</li>
|
|
<li>Set branch to build to master
|
|
</li>
|
|
<li>Repository Browser: Auto
|
|
</li>
|
|
<li>Build triggers: set to Poll SCM and set schedule to <code>* * * * *</code> (polls every minute)
|
|
</li>
|
|
<li>Build - Execute shell and set shell script to:
|
|
<p></p>
|
|
|
|
<div class="code"><pre>
|
|
cd build
|
|
cmake ..
|
|
xvfb-run --auto-servernum --server-num=1 \
|
|
--server-args="-screen 0 1024x768x24" \
|
|
make Experimental || true
|
|
if [ -f Testing/TAG ] ; then
|
|
xsltproc ../tests/ctest2junix.xsl \
|
|
Testing/`head -n 1 < Testing/TAG`/Test.xml > \
|
|
CTestResults.xml
|
|
fi
|
|
</pre></div>
|
|
|
|
<p></p>
|
|
</li>
|
|
<li>Add Junit post build action and set 'Publish Junit test result report' to:
|
|
<code>build/CTestResults.xml</code>
|
|
</li>
|
|
<li>Email notification: Send separate e-mails to individuals who broke the build
|
|
</li>
|
|
<li>Jenkins sounds - set up sounds for Failure, Success and Unstable.
|
|
</li>
|
|
<li>Save
|
|
</li>
|
|
</ul>
|
|
<p></p>
|
|
Now open the Job dash board and push something to QGIS and wait a minute to
|
|
validate automated builds work.
|
|
<p></p>
|
|
<strong>Note:</strong> You will need to log in to the Jenkins user account and go to
|
|
/var/lib/jenkins/jobs/QGIS/workspace, then make a <code>build</code> directory and run
|
|
the initial cmake setup and then do test build. This process is the same as
|
|
described elsewhere in this doc.
|
|
<p></p>
|
|
I based some of the set up from this nice blog article here:
|
|
<p></p>
|
|
<a href="http://alexott.blogspot.com/2012/03/jenkins-cmakectest.html">http://alexott.blogspot.com/2012/03/jenkins-cmakectest.html</a>
|
|
</li>
|
|
</ul>
|
|
|
|
</section>
|
|
<section id="toc35">
|
|
<h1>8. Debug output and running tests</h1>
|
|
|
|
<p>
|
|
If you are interested in seeing embedded debug output, change the following
|
|
CMake option:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
-D CMAKE_BUILD_TYPE=DEBUG (or RELWITHDEBINFO)
|
|
</pre></div>
|
|
|
|
<p>
|
|
This will flood your terminal or system log with lots of useful output from
|
|
QgsDebugMsg() calls in source code.
|
|
</p>
|
|
<p>
|
|
If you would like to run the test suite, you will need to do so from the build
|
|
directory, as it will not work with the installed/bundled app. First set the
|
|
CMake option to enable tests:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
-D ENABLE_TESTS=TRUE
|
|
</pre></div>
|
|
|
|
<p>
|
|
Then run all tests from build directory:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
cd build
|
|
make test
|
|
</pre></div>
|
|
|
|
<p>
|
|
To run all tests and report to <a href="http://cdash.orfeo-toolbox.org/index.php?project=QGIS">http://cdash.orfeo-toolbox.org/index.php?project=QGIS</a>
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
cd build
|
|
make Experimental
|
|
</pre></div>
|
|
|
|
<p>
|
|
You can define the host name reported via 'make Experimental' by setting a CMake
|
|
option:
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
-D SITE="my.domain.org"
|
|
</pre></div>
|
|
|
|
<p>
|
|
To run specific test(s) (see 'man ctest'):
|
|
</p>
|
|
|
|
<div class="code"><pre>
|
|
cd build
|
|
# show listing of tests, without running them
|
|
ctest --show-only
|
|
|
|
# run specific C++ or Python test(s) matching a regular expression
|
|
ctest --verbose --tests-regex SomeTestName
|
|
</pre></div>
|
|
|
|
</section>
|
|
<section id="toc36">
|
|
<h1>9. Authors and Acknowledgments</h1>
|
|
|
|
<p>
|
|
The following people have contributed to this document:
|
|
</p>
|
|
|
|
<ul>
|
|
<li>Windows MINGW Section
|
|
<ul>
|
|
<li>Tim Sutton, Godofredo Contreras 2006
|
|
</li>
|
|
<li>CMake additions Magnus Homann 2007
|
|
</li>
|
|
<li>Python additions Martin Dobias 2007
|
|
</li>
|
|
<li>With thanks to Tisham Dhar for preparing the initial msys environment
|
|
<p></p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>Windows MSVC Section (Detailed install)
|
|
<ul>
|
|
<li>David Willis 2007
|
|
</li>
|
|
<li>MSVC install additions Tim Sutton 2007
|
|
</li>
|
|
<li>PostgreSQL, Qt compile, SIP, Python, AutoExp additions Juergen Fischer 2007
|
|
<p></p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>Windows MSVC Section (Simplified install)
|
|
<ul>
|
|
<li>Tim Sutton 2007
|
|
</li>
|
|
<li>Juergen Fischer 2007
|
|
</li>
|
|
<li>Florian Hillen 2010
|
|
<p></p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>OSX Section
|
|
<ul>
|
|
<li>Tim Sutton 2007
|
|
</li>
|
|
<li>With special thanks to Tom Elwertowski and William Kyngesburye
|
|
</li>
|
|
<li>Larry Shaffer 2012
|
|
<p></p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>GNU/Linux Section
|
|
<ul>
|
|
<li>Tim Sutton 2006
|
|
</li>
|
|
<li>Debian package section: Juergen Fischer 2008
|
|
<p></p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>WCS Test Server Section
|
|
<ul>
|
|
<li>Tim Sutton, Radim Blazek 2012
|
|
<p></p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>Jenkins CI Configuration
|
|
<ul>
|
|
<li>Tim Sutton 2012
|
|
<p></p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>Latex Generator
|
|
<ul>
|
|
<li>Tim Sutton 2011
|
|
<p></p>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li>Debug Output/Tests Section
|
|
<ul>
|
|
<li>Larry Shaffer 2012, by way of 'Test Friday' Tim Sutton
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
|
|
</section>
|
|
</div>
|
|
<!-- html code generated by txt2tags 3.4 (http://txt2tags.org) -->
|
|
<!-- cmdline: txt2tags -o/home/fischer/src/qgis/debian/build/doc/INSTALL.html -t html /home/fischer/src/qgis/doc/INSTALL.t2t.tmp -->
|
|
</article></body></html>
|