2020-06-10 02:00:22 +02:00
Building QGIS from source - step by step
2024-11-08 10:58:11 +01:00
<!-- TOC start (generated with https://bitdowntoc.derlin.ch/) -->
2020-06-10 02:00:22 +02:00
2024-11-08 08:41:03 +01:00
- [1. Introduction ](#1-introduction )
- [2. Overview ](#2-overview )
- [3. Building on GNU/Linux ](#3-building-on-gnulinux )
2023-04-22 14:26:19 +02:00
* [3.1. Building QGIS with Qt 5.x ](#31-building-qgis-with-qt-5x )
* [3.2. Prepare apt ](#32-prepare-apt )
* [3.3. Install build dependencies ](#33-install-build-dependencies )
* [3.4. Setup ccache (Optional, but recommended) ](#34-setup-ccache-optional-but-recommended )
* [3.5. Prepare your development environment ](#35-prepare-your-development-environment )
* [3.6. Check out the QGIS Source Code ](#36-check-out-the-qgis-source-code )
* [3.7. Starting the compile ](#37-starting-the-compile )
2024-11-08 08:41:03 +01:00
+ [3.7.1 Available compilation flags ](#371-available-compilation-flags )
2023-04-22 14:26:19 +02:00
* [3.8. Compiling with 3D ](#38-compiling-with-3d )
2024-11-08 08:41:03 +01:00
+ [3.8.1. Compiling with 3D on old Debian based distributions ](#381-compiling-with-3d-on-old-debian-based-distributions )
2023-04-22 14:26:19 +02:00
* [3.9. Building different branches ](#39-building-different-branches )
* [3.10. Building Debian packages ](#310-building-debian-packages )
2024-11-08 08:41:03 +01:00
+ [3.10.1. Building packages with Oracle support ](#3101-building-packages-with-oracle-support )
2023-04-22 14:26:19 +02:00
* [3.11. On Fedora Linux ](#311-on-fedora-linux )
2024-11-08 08:41:03 +01:00
+ [3.11.1. Install build dependencies ](#3111-install-build-dependencies )
+ [3.11.2. Suggested system tweaks ](#3112-suggested-system-tweaks )
+ [3.11.3. Additional tools for QGIS development ](#3113-additional-tools-for-qgis-development )
+ [3.11.4. QT6 experimental builds with Fedora Rawhide ](#3114-qt6-experimental-builds-with-fedora-rawhide )
2025-02-04 15:21:01 +07:00
* [3.12. Building on Linux with vcpkg ](#312-building-on-linux-with-vcpkg )
2024-11-08 08:41:03 +01:00
- [4. Building on Windows ](#4-building-on-windows )
2023-04-22 14:26:19 +02:00
* [4.1. Building with Microsoft Visual Studio ](#41-building-with-microsoft-visual-studio )
2024-11-08 08:41:03 +01:00
+ [4.1.1. Visual Studio 2022 Community Edition ](#411-visual-studio-2022-community-edition )
+ [4.1.2. Other tools and dependencies ](#412-other-tools-and-dependencies )
+ [4.1.3. Clone the QGIS Source Code ](#413-clone-the-qgis-source-code )
+ [4.1.4. OSGeo4W ](#414-osgeo4w )
2023-04-22 14:26:19 +02:00
* [4.2. Building on Linux with mingw64 ](#42-building-on-linux-with-mingw64 )
2024-11-08 08:41:03 +01:00
+ [4.2.1. Building with Docker ](#421-building-with-docker )
- [4.2.1.1. Initial setup ](#4211-initial-setup )
- [4.2.1.2. Building the dependencies ](#4212-building-the-dependencies )
- [4.2.1.3. Cross-Building QGIS ](#4213-cross-building-qgis )
+ [4.2.2. Testing QGIS ](#422-testing-qgis )
* [4.3 Building on Windows with vcpkg ](#43-building-on-windows-with-vcpkg )
+ [4.3.1 Install Build Tools ](#431-install-build-tools )
+ [4.3.2 Build QGIS ](#432-build-qgis )
- [4.3.2.1 Build with an SDK ](#4321-build-with-an-sdk )
- [4.3.2.1 Build all the dependencies locally ](#4321-build-all-the-dependencies-locally )
- [5. Building on MacOS X ](#5-building-on-macos-x )
2024-12-17 10:15:27 +01:00
* [5.1. Building with Mac Packager ](#51-building-with-mac-packager )
+ [5.1.1. Install Developer Tools ](#511-install-developer-tools )
+ [5.1.2. Install CMake and other build tools ](#512-install-cmake-and-other-build-tools )
+ [5.1.3. Install Qt5 and QGIS-Deps ](#513-install-qt5-and-qgis-deps )
+ [5.1.4. QGIS source ](#514-qgis-source )
+ [5.1.5. Configure the build ](#515-configure-the-build )
+ [5.1.6. Building ](#516-building )
* [5.2. Building with vcpkg ](#52-building-with-vcpkg )
2024-11-08 08:41:03 +01:00
- [6. Setting up the WCS test server on GNU/Linux ](#6-setting-up-the-wcs-test-server-on-gnulinux )
2023-04-22 14:26:19 +02:00
* [6.1. Preparation ](#61-preparation )
* [6.2. Setup mapserver ](#62-setup-mapserver )
* [6.3. Create a home page ](#63-create-a-home-page )
* [6.4. Now deploy it ](#64-now-deploy-it )
* [6.5. Debugging ](#65-debugging )
2024-11-08 08:41:03 +01:00
- [7. Setting up a Jenkins Build Server ](#7-setting-up-a-jenkins-build-server )
- [8. Debug output and running tests ](#8-debug-output-and-running-tests )
- [9. Authors and Acknowledgments ](#9-authors-and-acknowledgments )
<!-- TOC end -->
2020-09-25 09:48:54 +02:00
2020-06-10 02:00:22 +02:00
# 1. Introduction
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:
2020-08-03 09:09:16 +02:00
https://qgis.org
2020-06-10 02:00:22 +02:00
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.
Because the code of QGIS evolves from release to release, These instructions are
regularly updated to match the corresponding release. Instructions for the current
2020-08-03 09:09:16 +02:00
master branch are available at https://github.com/qgis/QGIS/blob/master/INSTALL.md.
2020-06-10 02:00:22 +02:00
If you wish to build another version of QGIS, ensure to checkout the appropriate
release branch. The QGIS source code can be found [in the repository ](https://github.com/qgis/QGIS ).
2020-08-03 09:09:16 +02:00
Please visit https://qgis.org for information on joining our mailing lists
2020-06-10 02:00:22 +02:00
and getting involved in the project further.
**Note to document writers:** Please use this document as the central
place for describing build procedures. Please do not remove this notice.
# 2. Overview
QGIS, like a number of major projects (e.g., KDE 4.0),
2020-08-03 09:09:16 +02:00
uses [CMake ](https://www.cmake.org ) for building from source.
2020-06-10 02:00:22 +02:00
Following a summary of the required dependencies for building:
Required build tools:
2021-10-19 21:32:34 +02:00
* CMake >= 3.12.0
2020-06-10 02:00:22 +02:00
* Flex >= 2.5.6
* Bison >= 2.4
2021-04-22 13:07:17 +07:00
* Python >= 3.7
2020-06-10 02:00:22 +02:00
Required build dependencies:
2022-08-14 15:15:29 +10:00
* Qt >= 5.15.2
2025-01-29 13:24:33 +10:00
* Proj >= 8.1.0
2022-08-30 06:57:08 +10:00
* GEOS >= 3.9
2020-06-10 02:00:22 +02:00
* Sqlite3 >= 3.0.0
* SpatiaLite >= 4.2.0
* libspatialindex
2022-08-30 13:01:34 +10:00
* GDAL/OGR >= 3.2.0
2020-06-10 02:00:22 +02:00
* Qwt >= 5.0 & (< 6.1 with internal QwtPolar )
* expat >= 1.95
* QScintilla2
* QCA
* qtkeychain (>= 0.5)
* libzip
Optional dependencies:
* for GRASS providers and plugin - GRASS >= 7.0.0.
* for georeferencer - GSL >= 1.8
* for PostGIS support - PostgreSQL >= 8.0.x
* for gps plugin - gpsbabel
2021-01-10 10:26:32 +01:00
* for mapserver export and PyQGIS - Python >= 3.6
2020-06-10 02:00:22 +02:00
* for python support - SIP >= 4.12, PyQt >= 5.3 must match Qt version, Qscintilla2
* for qgis mapserver - FastCGI
* for oracle provider - Oracle OCI library
Indirect dependencies:
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
2020-08-03 09:09:16 +02:00
to [format list ](https://gdal.org/index.html ) for instructions how to include
2020-06-10 02:00:22 +02:00
those formats in GDAL.
# 3. Building on GNU/Linux
## 3.1. Building QGIS with Qt 5.x
**Requires:** Ubuntu / Debian derived distro
2023-08-21 14:09:53 +02:00
**Note:** Refer to the section [Building Debian packages ](#310-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.
2020-06-10 02:00:22 +02:00
These notes are for Ubuntu - other versions and Debian derived distros may
require slight variations in package names.
These notes are for if you want to build QGIS from source. One of the major
2020-08-03 09:09:16 +02:00
aims here is to show how this can be done using binary packages for ** *all***
2020-06-10 02:00:22 +02:00
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!
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.
## 3.2. Prepare apt
2023-04-20 10:24:10 +02:00
You will need a recent enough distribution in order for all dependencies
2020-06-10 02:00:22 +02:00
to be met. The supported distributions are listed in the following section.
Now update your local sources database:
```bash
2021-03-19 14:44:42 +01:00
sudo apt-get update
2020-06-10 02:00:22 +02:00
```
## 3.3. Install build dependencies
|Distribution|Install command for packages|
|------------|----------------------------|
2024-02-08 09:30:24 +01:00
| bullseye | ``apt-get install bison build-essential ca-certificates ccache cmake cmake-curses-gui dh-python doxygen expect flex flip gdal-bin git graphviz grass-dev libdraco-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpdal-dev libpq-dev libproj-dev libprotobuf-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 libzstd-dev lighttpd locales ninja-build ocl-icd-opencl-dev opencl-headers pandoc pdal pkg-config poppler-utils protobuf-compiler pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dev python3-gdal python3-jinja2 python3-lxml python3-mock python3-nose2 python3-owslib python3-plotly python3-psycopg2 python3-pygments python3-pyproj python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtpositioning python3-pyqt5.qtserialport python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-sip python3-sip-dev python3-termcolor python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qt5keychain-dev qtbase5-dev qtbase5-private-dev qtmultimedia5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb` ` |
| bookworm | ``apt-get install bison build-essential ca-certificates ccache cmake cmake-curses-gui dh-python doxygen expect flex flip gdal-bin git graphviz grass-dev libdraco-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpq-dev libproj-dev libprotobuf-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 libzstd-dev lighttpd locales ninja-build ocl-icd-opencl-dev opencl-headers pandoc pkg-config poppler-utils protobuf-compiler pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dev python3-gdal python3-jinja2 python3-lxml python3-mock python3-nose2 python3-owslib python3-plotly python3-psycopg2 python3-pygments python3-pyproj python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtpositioning python3-pyqt5.qtserialport python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-pyqtbuild python3-sip python3-termcolor python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qtbase5-dev qtbase5-private-dev qtkeychain-qt5-dev qtmultimedia5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools sip-tools spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb` ` |
| jammy | ``apt-get install bison build-essential ca-certificates ccache cmake cmake-curses-gui dh-python doxygen expect flex flip gdal-bin git graphviz grass-dev libdraco-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpdal-dev libpq-dev libproj-dev libprotobuf-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 libzstd-dev lighttpd locales ninja-build ocl-icd-opencl-dev opencl-headers pandoc pdal pkg-config poppler-utils protobuf-compiler pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dev python3-gdal python3-jinja2 python3-lxml python3-mock python3-nose2 python3-owslib python3-plotly python3-psycopg2 python3-pygments python3-pyproj python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtpositioning python3-pyqt5.qtserialport python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-pyqtbuild python3-sip python3-termcolor python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qtbase5-dev qtbase5-private-dev qtkeychain-qt5-dev qtmultimedia5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools sip-tools spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb` ` |
| kinetic | ``apt-get install bison build-essential ca-certificates ccache cmake cmake-curses-gui dh-python doxygen expect flex flip gdal-bin git graphviz grass-dev libdraco-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpq-dev libproj-dev libprotobuf-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 libzstd-dev lighttpd locales ninja-build ocl-icd-opencl-dev opencl-headers pandoc pkg-config poppler-utils protobuf-compiler pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dev python3-gdal python3-jinja2 python3-lxml python3-mock python3-nose2 python3-owslib python3-plotly python3-psycopg2 python3-pygments python3-pyproj python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtpositioning python3-pyqt5.qtserialport python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-pyqtbuild python3-sip python3-termcolor python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qtbase5-dev qtbase5-private-dev qtkeychain-qt5-dev qtmultimedia5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools sip-tools spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb` ` |
| lunar | ``apt-get install bison build-essential ca-certificates ccache cmake cmake-curses-gui dh-python doxygen expect flex flip gdal-bin git graphviz grass-dev libdraco-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpq-dev libproj-dev libprotobuf-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 libzstd-dev lighttpd locales ninja-build ocl-icd-opencl-dev opencl-headers pandoc pkg-config poppler-utils protobuf-compiler pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dev python3-gdal python3-jinja2 python3-lxml python3-mock python3-nose2 python3-owslib python3-plotly python3-psycopg2 python3-pygments python3-pyproj python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtpositioning python3-pyqt5.qtserialport python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-pyqtbuild python3-sip python3-termcolor python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qtbase5-dev qtbase5-private-dev qtkeychain-qt5-dev qtmultimedia5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools sip-tools spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb` ` |
| mantic | ``apt-get install bison build-essential ca-certificates ccache cmake cmake-curses-gui dh-python doxygen expect flex flip gdal-bin git graphviz grass-dev libdraco-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpq-dev libproj-dev libprotobuf-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 libzstd-dev lighttpd locales ninja-build ocl-icd-opencl-dev opencl-headers pandoc pkg-config poppler-utils protobuf-compiler pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dev python3-gdal python3-jinja2 python3-lxml python3-mock python3-nose2 python3-owslib python3-plotly python3-psycopg2 python3-pygments python3-pyproj python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtpositioning python3-pyqt5.qtserialport python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-pyqtbuild python3-sip python3-termcolor python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qtbase5-dev qtbase5-private-dev qtkeychain-qt5-dev qtmultimedia5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools sip-tools spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb` ` |
| noble | ``apt-get install bison build-essential ca-certificates ccache cmake cmake-curses-gui dh-python doxygen expect flex flip gdal-bin git graphviz grass-dev libdraco-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpq-dev libproj-dev libprotobuf-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 libzstd-dev lighttpd locales ninja-build ocl-icd-opencl-dev opencl-headers pandoc pkg-config poppler-utils protobuf-compiler pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dev python3-gdal python3-jinja2 python3-lxml python3-mock python3-nose2 python3-owslib python3-plotly python3-psycopg2 python3-pygments python3-pyproj python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtpositioning python3-pyqt5.qtserialport python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-pyqtbuild python3-sip python3-termcolor python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qtbase5-dev qtbase5-private-dev qtkeychain-qt5-dev qtmultimedia5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools sip-tools spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb` ` |
| sid | ``apt-get install bison build-essential ca-certificates ccache cmake cmake-curses-gui dh-python doxygen expect flex flip gdal-bin git graphviz grass-dev libdraco-dev libexiv2-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpq-dev libproj-dev libprotobuf-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 libzstd-dev lighttpd locales ninja-build ocl-icd-opencl-dev opencl-headers pandoc pkg-config poppler-utils protobuf-compiler pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python3-all-dev python3-autopep8 python3-dev python3-gdal python3-jinja2 python3-lxml python3-mock python3-nose2 python3-owslib python3-plotly python3-psycopg2 python3-pygments python3-pyproj python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtmultimedia python3-pyqt5.qtpositioning python3-pyqt5.qtserialport python3-pyqt5.qtsql python3-pyqt5.qtsvg python3-pyqt5.qtwebkit python3-pyqtbuild python3-sip python3-termcolor python3-yaml qt3d-assimpsceneimport-plugin qt3d-defaultgeometryloader-plugin qt3d-gltfsceneio-plugin qt3d-scene2d-plugin qt3d5-dev qtbase5-dev qtbase5-private-dev qtkeychain-qt5-dev qtmultimedia5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools sip-tools spawn-fcgi xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb` ` |
2020-06-10 02:00:22 +02:00
(extracted from the control.in file in `debian/` )
2024-11-15 00:33:21 +01:00
See [debian-ubuntu ](https://qgis.org/resources/installation-guide/#debianubuntu ) for
2020-08-03 09:09:16 +02:00
currently supported distributions (plain xenial's GDAL for instance is too old
2020-06-10 02:00:22 +02:00
and we build with GDAL2 from ubuntugis).
2023-01-29 09:51:01 +01:00
To build [QGIS server landing page/catalog webapp ](https://docs.qgis.org/latest/en/docs/server_manual/catalog.html ) additional dependencies are required:
2022-01-01 09:40:45 +01:00
2023-01-29 09:51:01 +01:00
* Node.js (current LTS recommended): https://nodejs.org/en/download/
* Yarn Package Manager: https://yarnpkg.com/getting-started/install
2022-01-01 09:40:45 +01:00
2022-01-11 16:45:50 +01:00
Additionally, the cmake flag `WITH_SERVER_LANDINGPAGE_WEBAPP` needs to be turned on.
2022-01-01 09:40:45 +01:00
2020-06-10 02:00:22 +02:00
## 3.4. Setup ccache (Optional, but recommended)
You should also setup ccache to speed up compile times:
```bash
2021-03-19 14:44:42 +01:00
cd /usr/local/bin
sudo ln -s /usr/bin/ccache gcc
sudo ln -s /usr/bin/ccache g++
2020-06-10 02:00:22 +02:00
```
or simply add `/usr/lib/ccache` to your `PATH` .
## 3.5. Prepare your development environment
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:
```bash
2021-03-19 14:44:42 +01:00
mkdir -p ${HOME}/dev/cpp
cd ${HOME}/dev/cpp
2020-06-10 02:00:22 +02:00
```
This directory path will be assumed for all instructions that follow.
## 3.6. Check out the QGIS Source Code
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
2021-03-19 14:44:42 +01:00
the developer checkout if you have permissions to commit source code
changes.
2020-06-10 02:00:22 +02:00
1. Anonymous Checkout
```bash
2021-03-19 14:44:42 +01:00
cd ${HOME}/dev/cpp
2023-02-17 13:07:37 +02:00
git clone https://github.com/qgis/QGIS.git
2020-06-10 02:00:22 +02:00
```
2. Developer Checkout
```bash
2021-03-19 14:44:42 +01:00
cd ${HOME}/dev/cpp
git clone git@github .com:qgis/QGIS.git
2020-06-10 02:00:22 +02:00
```
## 3.7. Starting the compile
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:
```bash
2021-03-19 14:44:42 +01:00
mkdir -p ${HOME}/apps
2020-06-10 02:00:22 +02:00
```
Now we create a build directory and run ccmake:
```bash
2021-03-19 14:44:42 +01:00
cd QGIS
mkdir build-master
cd build-master
ccmake ..
2020-06-10 02:00:22 +02:00
```
When you run ccmake (note the .. is required!), a menu will appear where
2020-08-03 09:09:16 +02:00
you can configure various aspects of the build:
2020-08-14 14:31:09 +02:00
* If you want QGIS to have debugging capabilities then set `CMAKE_BUILD_TYPE` to `Debug` .
2020-08-03 09:09:16 +02:00
* If you do not have root access or do not want to overwrite existing QGIS
2020-08-14 14:31:09 +02:00
installs (by your package manager for example), set the `CMAKE_INSTALL_PREFIX`
to somewhere you have write access to (For example `${HOME}/apps` ).
2020-08-03 09:09:16 +02:00
Now press 'c' to configure, 'e' to dismiss any error messages that may appear.
2020-06-10 02:00:22 +02:00
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.
**Warning:** Make sure that your build directory is completely empty when you
2020-08-03 09:09:16 +02:00
enter the command. Do never try to "re-use" an existing **Qt5** build directory.
2020-06-10 02:00:22 +02:00
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.
Now on with the build:
```bash
2021-03-19 14:44:42 +01:00
make -jX
2020-06-10 02:00:22 +02:00
```
where X is the number of available cores. Depending on your platform,
this can speed up the build time considerably.
Then you can directly run from the build directory:
```bash
2021-03-19 14:44:42 +01:00
./output/bin/qgis
2020-06-10 02:00:22 +02:00
```
Another option is to install to your system:
```bash
2021-03-19 14:44:42 +01:00
make install
2020-06-10 02:00:22 +02:00
```
After that you can try to run QGIS:
```bash
2021-03-19 14:44:42 +01:00
$HOME/apps/bin/qgis
2020-06-10 02:00:22 +02:00
```
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.
```bash
2021-03-19 14:44:42 +01:00
sudo ldconfig
2020-06-10 02:00:22 +02:00
```
If that doesn't help add the install path to LD_LIBRARY_PATH:
```bash
2021-03-19 14:44:42 +01:00
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${HOME}/apps/lib/
2020-06-10 02:00:22 +02:00
```
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.:
```bash
2021-03-19 14:44:42 +01:00
cmake -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=${HOME}/apps ..
2020-06-10 02:00:22 +02:00
```
Also, if you want to speed your build times, you can easily do it with ninja,
an alternative to make with similar build options.
For example, to configure your build you can do either one of:
```bash
2021-03-19 14:44:42 +01:00
ccmake -G Ninja ..
cmake -G Ninja -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=${HOME}/apps ..
2020-06-10 02:00:22 +02:00
```
Build and install with ninja:
```bash
2021-03-19 14:44:42 +01:00
ninja # (uses all cores by default; also supports the above described -jX option)
ninja install
2020-06-10 02:00:22 +02:00
```
To build even faster, you can build just the targets you need using, for example:
```bash
2021-03-19 14:44:42 +01:00
ninja qgis
ninja pycore
# if it's on desktop related code only:
ninja qgis_desktop
2020-06-10 02:00:22 +02:00
```
2022-11-29 10:19:03 +01:00
### 3.7.1 Available compilation flags
QGIS build is tunable according to your needs. Many flags are available to activate or deactivate some functionalities, here is a subset:
* `BUILD_WITH_QT6` : Enable (experimental) Qt6 support
* `WITH_3D` : Determines whether QGIS 3D library should be built
* `WITH_ANALYSIS` : Determines whether QGIS analysis library should be built
* `WITH_AUTH` : Determines whether QGIS authentication methods should be built
* `WITH_BINDINGS` : Determines whether Python bindings should be built
* `WITH_COPC` : Determines whether Cloud Optimized Point Cloud (COPC) support should be built
* `WITH_DESKTOP` : Determines whether QGIS desktop should be built
* `WITH_EPT` : Determines whether Entwine Point Cloud (EPT) support should be built
* `WITH_GRASS${GRASS_CACHE_VERSION}` : Determines whether GRASS ${GRASS_SEARCH_VERSION} plugin should be built
* `WITH_GUI` : Determines whether QGIS GUI library (and everything built on top of it) should be built
* `WITH_HANA` : Determines whether SAP HANA Spatial support should be built
* `WITH_ORACLE` : Determines whether Oracle support should be built
* `WITH_PDAL` : Determines whether PDAL support should be built
* `WITH_POSTGRESQL` : Determines whether POSTGRESQL support should be built
2025-02-12 20:11:10 +01:00
* `WITH_PYTHON` : Determines whether Python support should be built (disabling it will in particular disable processing)
2022-11-29 10:19:03 +01:00
* `WITH_QGIS_PROCESS` : Determines whether the standalone \"qgis_process\" tool should be built
* `WITH_QSPATIALITE` : Determines whether QSPATIALITE sql driver should be built
* `WITH_SERVER` : Determines whether QGIS server should be built
* `WITH_SPATIALITE` : Determines whether Spatialite support should be built (required for spatialite, virtual, wfs providers)
A complete list can been extracted from the source code with the following command line:
```bash
cmake .. -N -LH | grep -B1 WITH_
```
2020-06-10 02:00:22 +02:00
## 3.8. Compiling with 3D
In the cmake, you need to enable:
```bash
2021-03-19 14:44:42 +01:00
WITH_3D=True
2020-06-10 02:00:22 +02:00
```
2022-07-16 00:27:17 +02:00
### 3.8.1. Compiling with 3D on old Debian based distributions
2020-06-10 02:00:22 +02:00
QGIS 3D requires Qt53DExtras. These headers have been removed
2022-07-16 00:27:17 +02:00
from Qt upstream on Debian Buster and Ubuntu focal (20.04) based distributions.
A copy has been made in the QGIS repository in `external/qt3dextra-headers` .
To compile with 3D enabled on these distributions, you need to add some cmake options:
2020-06-10 02:00:22 +02:00
```bash
2021-03-19 14:44:42 +01:00
CMAKE_PREFIX_PATH={path to QGIS Git repo}/external/qt3dextra-headers/cmake
QT5_3DEXTRA_INCLUDE_DIR={path to QGIS Git repo}/external/qt3dextra-headers
QT5_3DEXTRA_LIBRARY=/usr/lib/x86_64-linux-gnu/libQt53DExtras.so
2021-11-11 20:07:40 +01:00
Qt53DExtras_DIR={path to QGIS Git repo}/external/qt3dextra-headers/cmake/Qt53DExtras
2020-06-10 02:00:22 +02:00
```
2022-07-16 00:27:17 +02:00
Above instructions do not apply to newer versions of Debian and Ubuntu.
2020-06-10 02:00:22 +02:00
## 3.9. Building different branches
By using `git worktree` , you can switch between different branches to use
several sources in parallel, based on the same Git configuration.
We recommend you to read the documentation about this Git command:
```bash
2021-03-19 14:44:42 +01:00
git commit
git worktree add ../my_new_functionality
cd ../my_new_functionality
git fetch qgis/master
git rebase -i qgis/master
# only keep the commits to be pushed
git push -u my_own_repo my_new_functionality
2020-06-10 02:00:22 +02:00
```
## 3.10. Building Debian packages
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.
2023-10-02 11:15:33 +02:00
First setup a changelog entry for your distribution. For example for Debian Bookworm:
2020-06-10 02:00:22 +02:00
```bash
2023-08-21 14:09:53 +02:00
dch -l ~bookworm --force-distribution --distribution bookworm "bookworm build"
2020-06-10 02:00:22 +02:00
```
2023-10-02 11:15:33 +02:00
You also need to install the [build dependencies ](#33-install-build-dependencies ).
Alternatively use:
```bash
debian/rules templates
sudo mk-build-deps -i
```
2020-06-10 02:00:22 +02:00
The QGIS packages will be created with:
```bash
2021-03-19 14:44:42 +01:00
dpkg-buildpackage -us -uc -b
2020-06-10 02:00:22 +02:00
```
2023-10-02 11:15:33 +02:00
**Note:** Install `devscripts` to get `dch` and `mk-build-deps` .
2020-06-10 02:00:22 +02:00
**Note:** If you have `libqgis1-dev` installed, you need to remove it first
using `dpkg -r libqgis1-dev` . Otherwise `dpkg-buildpackage` will complain about a
build conflict.
**Note:** By default tests are run in the process of building and their
2020-08-03 09:09:16 +02:00
results are uploaded to https://cdash.orfeo-toolbox.org/index.php?project=QGIS.
2021-03-19 14:44:42 +01:00
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` .
2020-06-10 02:00:22 +02:00
The packages are created in the parent directory (ie. one level up).
2021-03-19 14:44:42 +01:00
Install them using `dpkg` . E.g.:
2020-06-10 02:00:22 +02:00
```bash
2021-03-19 14:44:42 +01:00
sudo debi
2020-06-10 02:00:22 +02:00
```
2023-10-02 11:15:33 +02:00
### 3.10.1. Building packages with Oracle support
To build packages with Oracle support you need the Oracle libraries (currently
21.11) as additional build dependencies:
```bash
curl -JLO https://download.oracle.com/otn_software/linux/instantclient/2111000/oracle-instantclient-devel-21.11.0.0.0-1.el8.x86_64.rpm
curl -JLO https://download.oracle.com/otn_software/linux/instantclient/2111000/oracle-instantclient-basiclite-21.11.0.0.0-1.el8.x86_64.rpm
sudo apt install alien
fakeroot alien oracle-instantclient-devel-21.11.0.0.0-1.el8.x86_64.rpm oracle-instantclient-basiclite-21.11.0.0.0-1.el8.x86_64.rpm
sudo dpkg -i oracle-instantclient-devel_21.11.0.0.0-2_amd64.deb oracle-instantclient-basiclite_21.11.0.0.0-2_amd64.deb
```
2023-10-05 15:11:11 +02:00
(if the client version changes it's necessary to adapt `ORACLE_INCLUDEDIR` and `ORACLE_LIBDIR` in `debian/rules` accordingly)
2023-10-02 11:15:33 +02:00
2023-10-05 15:11:11 +02:00
The packaging files enable Oracle support if the distribution contains `-oracle` :
2023-10-02 11:15:33 +02:00
```bash
dch -l ~sid~oracle --force-distribution --distribution sid-oracle "sid build with oracle" │
dpkg-buildpackage -us -uc -b
```
2020-06-10 02:00:22 +02:00
## 3.11. On Fedora Linux
We assume that you have the source code of QGIS ready and created a
new subdirectory called `build` or `build-qt5` in it.
### 3.11.1. Install build dependencies
2022-11-29 10:19:03 +01:00
2021-12-19 12:07:03 +01:00
|Distribution|Install command for packages|
|------------|----------------------------|
2023-11-07 22:05:41 +11:00
| Fedora 38 Workstation | ``dnf install qt5-qtbase-private-devel qt5-qtwebkit-devel qt5-qtlocation-devel qt5-qtmultimedia-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-qt5 clang flex bison geos-devel gdal gdal-devel hdf5-devel sqlite-devel libspatialite-devel qt5-qtsvg-devel spatialindex-devel expat-devel netcdf-devel proj-devel qwt-qt5-devel gsl-devel PDAL PDAL-devel postgresql-devel cmake python3-gdal gdal-python-tools python3-psycopg2 python3-PyYAML python3-pygments python3-jinja2 python3-OWSLib qca-qt5-ossl qwt-qt5-devel qtkeychain-qt5-devel libzip-devel exiv2-devel PyQt-builder protobuf-lite protobuf-lite-devel libzstd-devel qt5-qtserialport-devel draco-devel python3-devel` ` |
2023-08-06 16:42:46 +10:00
| Fedora 37 Workstation | ``dnf install qt5-qtbase-private-devel qt5-qtwebkit-devel qt5-qtlocation-devel qt5-qtmultimedia-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-qt5 clang flex bison geos-devel gdal gdal-devel hdf5-devel sqlite-devel libspatialite-devel qt5-qtsvg-devel spatialindex-devel expat-devel netcdf-devel proj-devel qwt-qt5-devel gsl-devel PDAL PDAL-devel postgresql-devel cmake python3-gdal gdal-python-tools python3-psycopg2 python3-PyYAML python3-pygments python3-jinja2 python3-OWSLib qca-qt5-ossl qwt-qt5-devel qtkeychain-qt5-devel qwt-devel libzip-devel exiv2-devel python3-sip-devel protobuf-lite protobuf-lite-devel libzstd-devel qt5-qtserialport-devel draco-devel` ` |
| Fedora 35/36 Workstation | ``dnf install qt5-qtbase-private-devel qt5-qtwebkit-devel qt5-qtlocation-devel qt5-qtmultimedia-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-qt5 clang flex bison geos-devel gdal gdal-devel hdf5-devel sqlite-devel libspatialite-devel qt5-qtsvg-devel spatialindex-devel expat-devel netcdf-devel proj-devel qwt-qt5-devel gsl-devel PDAL PDAL-devel postgresql-devel cmake gdal-python3 gdal-python-tools python3-psycopg2 python3-PyYAML python3-pygments python3-jinja2 python3-OWSLib qca-qt5-ossl qwt-qt5-devel qtkeychain-qt5-devel qwt-devel libzip-devel exiv2-devel python3-sip-devel protobuf-lite protobuf-lite-devel libzstd-devel qt5-qtserialport-devel draco-devel` ` |
| older versions | ``dnf install qt5-qtbase-private-devel qt5-qtwebkit-devel qt5-qtlocation-devel qt5-qtmultimedia-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 gdal-devel sqlite-devel libspatialite-devel qt5-qtsvg-devel qt5-qtbase-tds qt5-qtbase-odbc spatialindex-devel expat-devel proj-devel qwt-qt5-devel gsl-devel postgresql-devel cmake 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 draco-devel` ` |
2020-06-10 02:00:22 +02:00
To build QGIS server additional dependencies are required:
```bash
2022-01-06 08:28:05 +01:00
dnf install fcgi-devel
```
2022-01-11 16:45:50 +01:00
And for building [QGIS server landing page/catalog webapp ](https://docs.qgis.org/latest/en/docs/server_manual/services.html#qgis-server-catalog ):
2022-01-06 08:28:05 +01:00
```bash
dnf install nodejs yarnpkg
2020-06-10 02:00:22 +02:00
```
2022-01-11 16:45:50 +01:00
Additionally, the cmake flag `WITH_SERVER_LANDINGPAGE_WEBAPP` needs to be turned on.
2020-06-10 02:00:22 +02:00
Make sure that your build directory is completely empty when you enter the
following command. Do never try to "re-use" an existing Qt5 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.
```bash
2021-03-19 14:44:42 +01:00
cmake ..
2020-06-10 02:00:22 +02:00
```
2021-03-19 14:44:42 +01:00
If everything went OK you can finally start to compile. (As usual append a `-jX`
2020-06-10 02:00:22 +02:00
where X is the number of available cores option to make to speed up your build
process)
```bash
2021-03-19 14:44:42 +01:00
make
2020-06-10 02:00:22 +02:00
```
Run from the build directory
```bash
2021-03-19 14:44:42 +01:00
./output/bin/qgis
2020-06-10 02:00:22 +02:00
```
Or install to your system
```bash
2021-03-19 14:44:42 +01:00
make install
2020-06-10 02:00:22 +02:00
```
### 3.11.2. Suggested system tweaks
By default Fedora disables debugging calls from Qt applications. This prevents
the useful debug output which is normally printed when running the unit tests.
To enable debug prints for the current user, execute:
```bash
2021-03-19 14:44:42 +01:00
cat > ~/.config/QtProject/qtlogging.ini < < EOL
[Rules]
default.debug=true
EOL
2020-06-10 02:00:22 +02:00
```
2022-06-08 13:33:44 +10:00
### 3.11.3. Additional tools for QGIS development
If you're going to be developing QGIS on a Fedora system, the following extra packages
are required for the various QGIS source formatting and preparation scripts.
```bash
2024-04-09 12:54:49 +10:00
dnf install ag ccache expect ninja-build astyle python3-autopep8 python3-mock python3-nose2 perl-YAML-Tiny
2022-06-08 13:33:44 +10:00
```
2024-01-25 23:33:42 +01:00
### 3.11.4. QT6 experimental builds with Fedora Rawhide
This requires latest QGIS master (>= January 25th 2024).
To save ~ 700 MB, if you want to install PROJ without its optional grids, first do:
```bash
dnf5 install -y --setopt=install_weak_deps=False proj-devel
```
Installation of all needed build dependencies:
2024-04-29 09:16:12 +10:00
|Distribution|Install command for packages|
|------------|----------------------------|
| Fedora 40 Workstation | ``dnf install qt6-qtbase-private-devel qt6-qtlocation-devel qt6-qtmultimedia-devel qt6-qttools-static qca-qt6-devel qca-qt6-ossl qt6-qt3d-devel qt6-qtwebengine-devel python3-pyqt6-devel python3-qscintilla-qt6-devel qscintilla-qt6-devel python3-qscintilla-qt6 clang flex bison geos-devel gdal gdal-devel hdf5-devel sqlite-devel libspatialite-devel qt6-qtsvg-devel spatialindex-devel expat-devel netcdf-devel proj-devel qwt-qt6-devel gsl-devel PDAL PDAL-devel postgresql-devel cmake python3-gdal gdal-python-tools python3-psycopg2 python3-PyYAML python3-pygments python3-jinja2 python3-OWSLib qca-qt6-ossl qwt-qt6-devel qtkeychain-qt6-devel libzip-devel exiv2-devel PyQt-builder protobuf-lite protobuf-lite-devel libzstd-devel qt6-qtserialport-devel draco-devel python3-devel qt6-qt5compat-devel python3-pyqt6-webengine` ` |
| Fedora 39 Workstation | ``dnf install qt6-qtbase-private-devel qt6-qtwebkit-devel qt6-qtlocation-devel qt6-qtmultimedia-devel qt6-qttools-static qca-qt6-devel qt6-qtwebengine-devel qca-qt6-ossl qt6-qt3d-devel python3-qt6-devel python3-qscintilla-qt6-devel qscintilla-qt6-devel python3-qscintilla-qt6 clang flex bison geos-devel gdal gdal-devel hdf5-devel sqlite-devel libspatialite-devel qt6-qtsvg-devel spatialindex-devel expat-devel netcdf-devel proj-devel qwt-qt6-devel gsl-devel PDAL PDAL-devel postgresql-devel cmake python3-gdal gdal-python-tools python3-psycopg2 python3-PyYAML python3-pygments python3-jinja2 python3-OWSLib qca-qt6-ossl qwt-qt6-devel qtkeychain-qt6-devel libzip-devel exiv2-devel PyQt-builder protobuf-lite protobuf-lite-devel libzstd-devel qt6-qtserialport-devel draco-devel python3-devel qt6-qt5compat-devel` ` |
2024-01-25 23:33:42 +01:00
To build,
```bash
2024-04-29 09:16:12 +10:00
cmake .. -DBUILD_WITH_QT6=ON -DWITH_QTWEBKIT=OFF -DWITH_QTWEBENGINE=ON
2024-01-25 23:33:42 +01:00
```
2025-02-04 15:21:01 +07:00
## 3.12. Building on Linux with vcpkg
With [vcpkg ](https://github.com/microsoft/vcpkg/ ) you can develop QGIS using
Qt6 on a Linux system.
First, [Install and initialize vcpkg ](https://github.com/microsoft/vcpkg-tool/blob/main/README.md#installuseremove ).
Get the QGIS source code:
```sh
git clone git@github .com:qgis/QGIS.git
```
Configure:
```sh
cmake -S . \
-B ./build-x64-linux \
-GNinja \
-DCMAKE_BUILD_TYPE=Debug \
-DWITH_VCPKG=ON \
-DBUILD_WITH_QT6=ON \
-DWITH_QTWEBKIT=OFF \
-DWITH_BINDINGS=ON \
-DVCPKG_TARGET_TRIPLET=x64-linux-dynamic-release \
-DVCPKG_HOST_TRIPLET=x64-linux-dynamic-release
```
Build:
```sh
cmake --build ./build-x64-linux
```
2020-06-10 02:00:22 +02:00
# 4. Building on Windows
## 4.1. Building with Microsoft Visual Studio
2025-01-23 19:35:46 +08:00
This section describes how to build QGIS using Visual Studio (MSVC) 2022 on Windows.
2024-10-14 14:19:15 +02:00
The official Windows packages are built using OSGeo4W.
2020-06-10 02:00:22 +02:00
This section describes the setup required to allow Visual Studio to be used to
build QGIS.
2024-10-14 14:19:15 +02:00
### 4.1.1. Visual Studio 2022 Community Edition
2020-06-10 02:00:22 +02:00
2025-01-23 19:35:46 +08:00
Download and install the [free (as in free beer) Community installer ](https://c2rsetup.officeapps.live.com/c2r/downloadVS.aspx?sku=community&channel=Release&version=VS2022&source=VSLandingPage&cid=2030:7851336a02d44ba38a548acc719002df )
2020-06-10 02:00:22 +02:00
2023-04-22 14:26:19 +02:00
Select "Desktop Development with C++"
2020-06-10 02:00:22 +02:00
### 4.1.2. Other tools and dependencies
Download and install following packages:
2025-01-23 19:35:46 +08:00
* [CMake ](https://github.com/Kitware/CMake/releases/download/v3.31.4/cmake-3.31.4-windows-x86_64.msi )
2023-04-20 21:10:49 +02:00
* GNU flex, GNU bison and GIT with [cygwin 64bit ](https://cygwin.com/setup-x86_64.exe )
2024-10-14 14:19:15 +02:00
* [OSGeo4W ](https://download.osgeo.org/osgeo4w/v2/osgeo4w-setup.exe )
2025-02-08 21:15:48 +02:00
* [ninja ](https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-win.zip ) (Version >= 1.10): Copy the `ninja.exe` to `C:\OSGeo4W\bin\`
2020-06-10 02:00:22 +02:00
For the QGIS build you need to install following packages from cygwin:
* bison
* flex
* git (even if you already have Git for Windows installed)
2020-08-03 09:09:16 +02:00
and from OSGeo4W (select *Advanced Install* ):
2020-06-10 02:00:22 +02:00
* qgis-dev-deps
2021-03-19 14:44:42 +01:00
* This will also select packages the above packages depend on.
2020-06-10 02:00:22 +02:00
2021-03-19 14:44:42 +01:00
* Note: If you install other packages, this might cause issues. Particularly, make sure
**not** to install the msinttypes package. It installs a stdint.h file in
2024-10-14 14:19:15 +02:00
`OSGeo4W\include` , that conflicts with Visual Studio own stdint.h, which for
2021-03-19 14:44:42 +01:00
example breaks the build of the virtual layer provider.
2020-06-10 02:00:22 +02:00
2023-04-22 14:26:19 +02:00
If you intend to also build all the dependencies, you can refer to [the OSGeo4W repository ](https://github.com/jef-n/OSGeo4W ).
2020-06-10 02:00:22 +02:00
### 4.1.3. Clone the QGIS Source Code
Choose a directory to store the QGIS source code.
2024-10-14 14:19:15 +02:00
For example, to put it in the OSGeo4W install, navigate there:
2020-06-10 02:00:22 +02:00
```cmd
2024-10-14 14:19:15 +02:00
cd C:\OSGeo4W
2020-06-10 02:00:22 +02:00
```
This directory will be assumed for all instructions
that follow.
On the command prompt clone the QGIS source from
git to the source directory `QGIS` :
```cmd
2021-03-19 14:44:42 +01:00
git clone git://github.com/qgis/QGIS.git
2020-06-10 02:00:22 +02:00
```
This requires Git. If you have Git for Windows on your PATH already,
you can do this from a normal command prompt. If you do not, you can
use the Git package that was installed as part of Cygwin by opening
a Cygwin[64] Terminal
And, to avoid Git in Windows reporting changes to files not actually modified:
```cmd
2021-03-19 14:44:42 +01:00
cd QGIS
git config core.filemode false
2020-06-10 02:00:22 +02:00
```
2024-10-14 14:19:15 +02:00
### 4.1.4. OSGeo4W
2020-06-10 02:00:22 +02:00
2024-10-14 14:19:15 +02:00
The official Windows packages are made in OSGeo4W. Also standalone MSI
installers are also produced using the packages from OSGeo4W.
The nightly build of master (package qgis-dev) is made with the [OSGeo4W build
recipe](https://github.com/jef-n/OSGeo4W/blob/master/src/qgis-dev/osgeo4w/package.sh).
There are others for the long-term release build (qgis-ltr), the nightly of the
next long-term point release (qgis-ltr-dev), the latest release (qgis), the
nightly build of the next point release (qgis-rel-dev). All of those are
currently based on Qt5. A build recipe for master with Qt6 is available as
qgis-qt6-dev.
To setup a build environment (including Visual C++ if not already installed) and to
build the nightly run in a command line (cmd):
```cmd
mkdir osgeo4w-build
cd osgeo4w-build
curl -JLO https://raw.githubusercontent.com/jef-n/OSGeo4W/refs/heads/master/bootstrap.cmd
curl -JLO https://raw.githubusercontent.com/jef-n/OSGeo4W/refs/heads/master/bootstrap.sh
bootstrap.cmd qgis-dev
```
To build other packages you can simply replace qgis-dev with other packages.
Calling `bootstrap.cmd` without any arguments will build all packages
(including all dependencies).
After the build is succeeded the OSGeo4W packages will be in `x86_64/` .
To install the package you can add the `osgeo4w-build` directory as `User URL`
in the OSGeo4W installer and select your `qgis-dev` package.
The MSIs are created with `scripts\msis.sh` (actually `scripts/creatmsi.pl` ).
2020-06-10 02:00:22 +02:00
2021-02-19 17:54:02 +01:00
## 4.2. Building on Linux with mingw64
2020-06-10 02:00:22 +02:00
2021-02-19 17:54:02 +01:00
With this approach you can cross build a Windows binary on Linux using mingw64
in a Docker container.
2020-06-10 02:00:22 +02:00
2021-02-19 17:54:02 +01:00
To build on Linux from your QGIS sources directory, launch:
```cmd
2021-03-19 14:44:42 +01:00
ms-windows/mingw/build.sh
2021-02-19 17:54:02 +01:00
```
After a successful build, you will find two packages in the QGIS sources
directory:
- qgis-portable-win64.zip (QGIS for Windows 64bit)
- qgis-portable-win64-debugsym.zip (debug symbols)
This method is also used in the continuous integrations process. After each pull
request the two packages mentioned above are stored as GitHub actions artifacts
and are available for download making it possible to quickly test changes on Windows.
2020-06-10 02:00:22 +02:00
2020-09-25 09:48:54 +02:00
### 4.2.1. Building with Docker
2020-06-10 02:00:22 +02:00
This is the simplest way, but you need to have Docker installed
on your system.
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.
=== Building without Docker ====
This requires to install mxe toolchain on your system and build
all dependencies by yourself.
2020-09-25 09:48:54 +02:00
#### 4.2.1.1. Initial setup
2020-06-10 02:00:22 +02:00
Please follow the instructions on mxe website to setup your building toolchain http://mxe.cc/,
take note of the path where you have installed mxe.
2020-09-25 09:48:54 +02:00
#### 4.2.1.2. Building the dependencies
2020-06-10 02:00:22 +02:00
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.
2020-09-25 09:48:54 +02:00
#### 4.2.1.3. Cross-Building QGIS
2020-06-10 02:00:22 +02:00
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.
2020-09-25 09:48:54 +02:00
### 4.2.2. Testing QGIS
2020-06-10 02:00:22 +02:00
Copy and unzip on the Windows machine package produced by the build and launch the qgis binary: no installation
is required.
2024-10-08 10:38:24 +02:00
## 4.3 Building on Windows with vcpkg
Vcpkg is a free and open source cross platform ecosystem for libraries.
It provides precise control over the versions of dependencies that are used.
### 4.3.1 Install Build Tools
1. Download and install the free (as in free beer) [Microsoft Visual Studio 2022 Community Edition ](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&channel=Release&version=VS2022 ).
2. Obtain [winflexbison ](https://github.com/lexxmark/winflexbison/releases ).
### 4.3.2 Build QGIS
There are two ways, to build with vcpkg. Either you download an sdk, which allows you
to reuse dependencies that are already built. This is generally easier and recommended.
It is also possible to build all dependencies yourself, which gives you more control
over the dependencies.
#### 4.3.2.1 Build with an SDK
1. Download and unzip SDK. Get the latest [QGIS master SDK ](https://nightly.link/qgis/QGIS/workflows/windows-qt6/master/qgis-sdk-x64-windows.zip ).
2. Build
We will now configure QGIS.
Open a _Developer PowerShell for VS 2022_
```ps
# We assume you have a copy of the QGIS source code available
# and have changed the working directory into it
# Configure
2024-11-08 10:56:22 +01:00
cmake -S . `
-B build `
-DSDK_PATH="path/to/vcpkg-export-[date]" `
-DBUILD_WITH_QT6=ON `
-DWITH_QTWEBKIT=OFF `
-DVCPKG_TARGET_TRIPLET=x64-windows-release `
-DFLEX_EXECUTABLE="path/to/flex-executable" `
2024-10-21 15:15:23 +00:00
-DBISON_EXECUTABLE="path/to/bison-executable"
2024-10-08 10:38:24 +02:00
```
This will provide you with a configured project. You can either build it directly
from the command line.
```ps
# Build
# Note: you can also use RelWithDebInfo to have debug symbols in your build
cmake --build build --config Release
```
Or you can open the generated `.sln` file in the `build` folder with Visual Studio.
This will allow you to use all the tools that this IDE has to offer.
#### 4.3.2.1 Build all the dependencies locally
It is also possible to build all the dependencies locally.
This will require some time, cpu and disk space.
```ps
# We assume you have a copy of the QGIS source code available
# and have changed the working directory into it
# Configure
2024-11-08 10:56:22 +01:00
cmake -S . `
-B build `
-D WITH_VCPKG=ON `
-D BUILD_WITH_QT6=ON `
-D WITH_QTWEBKIT=OFF `
-D VCPKG_TARGET_TRIPLET=x64-windows-release `
2024-10-08 10:38:24 +02:00
-D VCPKG_HOST_TRIPLET=x64-windows-release
```
**Manage dependency versions**
The dependencies are defined in the file `vcpkg/vcpkg.json` .
This file defines which versions of registries are used.
To update to the most recent version, you can use the command `vcpkg x-update-baseline --x-manifest-root=vcpkg` .
If you want to patch or update a specific dependency, you can copy the port for this
dependency into the folder `vcpkg/ports` . Whenever the build is reconfigured, it will check for dependencies that need to be rebuilt.
2020-06-10 02:00:22 +02:00
# 5. Building on MacOS X
If you want to test QGIS, easiest option is to download and install all-in-one self-containing bundle directly from
2024-11-15 00:33:21 +01:00
https://download.qgis.org/downloads/macos/
2020-06-10 02:00:22 +02:00
2024-12-17 10:02:14 +01:00
If you want to build or develop QGIS on your own, you need a set of dependencies and tools.
You can use
- the same set of dependencies that are used for all-in-one QGIS bundle
- vcpkg based dependencies for building with Qt6
- with Homebrew, MacPorts or Conda dependencies (not covered in this guide)
## 5.1. Building with Mac Packager
2020-06-10 02:00:22 +02:00
https://github.com/qgis/QGIS-Mac-Packager
Included are notes for building on latest Mac OS X with latest updates installed.
The build uses clang compiler.
Parallel Compilation: On multiprocessor/multicore Macs, it's possible to
speed up compilation, but it's not automatic. Whenever you type "make" (but
NOT "make install"), instead type:
```bash
2021-03-19 14:44:42 +01:00
make -j [#cpus ]
2020-06-10 02:00:22 +02:00
```
Replace [#cpus ] with the number of cores and/or processors your Mac has.
To find out how many CPUs you have available, run the following in Terminal:
```bash
2021-03-19 14:44:42 +01:00
/usr/sbin/sysctl -n hw.ncpu
2020-06-10 02:00:22 +02:00
```
2024-12-17 10:02:14 +01:00
### 5.1.1. Install Developer Tools
2020-06-10 02:00:22 +02:00
Developer tools are not a part of a standard OS X installation.
As minimum you require command line tools
```bash
2021-03-19 14:44:42 +01:00
sudo xcode-select --install
2020-06-10 02:00:22 +02:00
```
but installation of Xcode from the App Store is recommended too.
2024-12-17 10:02:14 +01:00
### 5.1.2. Install CMake and other build tools
2020-06-10 02:00:22 +02:00
For example install Homebrew
```bash
2021-03-19 14:44:42 +01:00
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
2020-06-10 02:00:22 +02:00
```
and these development/build tools
```bash
2020-10-20 16:29:04 +02:00
brew install git cmake ninja pkg-config wget bash-completion curl gnu-sed coreutils ccache libtool astyle help2man autoconf automake pandoc
2020-06-10 02:00:22 +02:00
```
if you have these tools installed from MacPorts or Conda, it is the same, but we will need to be able to
run `cmake` and others from Terminal in the following steps
2024-12-17 10:02:14 +01:00
### 5.1.3. Install Qt5 and QGIS-Deps
2020-06-10 02:00:22 +02:00
To build QGIS, we need Qt5 and FOSS dependencies on hand. The Qt5 version ideally should match the version that was
used to build dependency package.
Download the latest QGIS-Deps install script, qt package and QGIS-Deps packages from
2024-11-15 00:33:21 +01:00
https://download.qgis.org/downloads/macos/deps
2020-06-10 02:00:22 +02:00
You should have one bash script and two tar archive in your download folder.
Run the install script to install Qt and QGIS-Deps to `/opt/` area. You need
root privileges or have write access to `/opt/Qt` and `/opt/QGIS` .
Alternatively you can download and install Qt Open Source for MacOS from the
https://www.qt.io/
in the same version as referenced in the install script. It must be installed in `/opt/Qt`
Note that the QGIS-Deps package is not yet signed, so you may need to add Terminal
to System Preferences -> Security & Privacy -> Privacy -> Developer Tools or manually accept usage
of the libraries when asked by system.
2024-12-17 10:02:14 +01:00
### 5.1.4. QGIS source
2020-06-10 02:00:22 +02:00
Unzip the QGIS source to a working folder of your choice.
If you are reading this from the source, you've already done this.
If you want to experiment with the latest development sources, go to the github
QGIS project page:
http://github.com/qgis/QGIS
It should default to the master branch. Click the Downloads button and
select Download .tar.gz. Double-click the tarball to unzip it.
*Alternatively*, use git and clone the repository by
```bash
2021-03-19 14:44:42 +01:00
git clone git://github.com/qgis/QGIS.git
2020-06-10 02:00:22 +02:00
```
2024-12-17 10:02:14 +01:00
### 5.1.5. Configure the build
2020-06-10 02:00:22 +02:00
CMake supports out of source build so we will create a 'build' dir for the
2023-09-25 11:01:00 +02:00
build process. OS X uses `${HOME}/Applications` as a standard user app folder (it
2020-06-10 02:00:22 +02:00
gives it the system app folder icon). If you have the correct permissions you
2023-09-25 11:01:00 +02:00
may want to build straight into your `/Applications` folder. The instructions
below assume you are building into a `${HOME}/Applications` directory.
2020-06-10 02:00:22 +02:00
In a Terminal cd to the qgis source folder previously downloaded, then:
```bash
2021-03-19 14:44:42 +01:00
cd ..
mkdir build
cd build
2020-06-10 02:00:22 +02:00
2021-09-20 10:23:17 +02:00
QGIS_DEPS_VERSION=0.9;\
2021-09-17 07:35:54 +02:00
QT_VERSION=5.15.2;\
2021-03-19 14:44:42 +01:00
PATH=/opt/QGIS/qgis-deps-${QGIS_DEPS_VERSION}/stage/bin:$PATH;\
cmake \
2023-06-20 07:53:09 -04:00
-D CMAKE_INSTALL_PREFIX=~/Applications \
-D CMAKE_BUILD_TYPE=Release \
-D QGIS_MAC_DEPS_DIR=/opt/QGIS/qgis-deps-${QGIS_DEPS_VERSION}/stage \
-D CMAKE_PREFIX_PATH=/opt/Qt/${QT_VERSION}/clang_64 \
2021-03-19 14:44:42 +01:00
../QGIS
2020-06-10 02:00:22 +02:00
```
Note: Don't forget the `../QGIS` on the last line, which tells CMake to look for the source files.
Note: Double check on the screen output that all libraries are picked from QGIS-Deps `/opt/QGIS`
and not from system `/usr/lib` or Homebrew's `/usr/local/` or system Frameworks `/Library/Frameworks/` .
Especially check Proj, GDAL, sqlite3 and Python paths.
After the initial Terminal configure, you can use ccmake to make further changes:
```bash
2021-03-19 14:44:42 +01:00
cd build
ccmake ../QGIS
2020-06-10 02:00:22 +02:00
```
2024-12-17 10:02:14 +01:00
### 5.1.6. Building
2020-06-10 02:00:22 +02:00
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):
```bash
2021-03-19 14:44:42 +01:00
make -j [#cpus ]
2020-06-10 02:00:22 +02:00
```
Now you can run the QGIS from build directory by `./output/bin/QGIS.app/Contents/MacOS/QGIS`
If all built without errors you can then install it:
```bash
2021-03-19 14:44:42 +01:00
make install
2020-06-10 02:00:22 +02:00
```
or, for an /Applications build:
```bash
2021-03-19 14:44:42 +01:00
sudo make install
2020-06-10 02:00:22 +02:00
```
For running the installed QGIS, you need to keep the dependencies in `/opt/` folder in place.
If you want to create bundle that runs without these dependencies, please read the documentation in project
https://github.com/qgis/QGIS-Mac-Packager
2024-12-17 10:15:27 +01:00
## 5.2. Building with vcpkg
2024-12-17 10:02:14 +01:00
With [vcpkg ](https://github.com/microsoft/vcpkg/ ) you can develop QGIS using
Qt6.
Install and initialize vcpkg
```sh
. < (curl https://aka.ms/vcpkg-init.sh -L)
```
Install build tools using [homebrew ](https://brew.sh/ )
```sh
brew install git cmake flex bison automake autoconf libtool nasm ninja
```
Get the QGIS source code
```sh
git clone git@github .com:qgis/QGIS.git
```
Prepare the env for homebrew tools
```sh
export PATH=$(brew --prefix bison)/bin:$(brew --prefix flex)/bin:$(brew --prefix libtool)/bin:$PATH
```
Select the target architecture (arm64 is for M series processors).
We will assume that you build for the same architecture that you build on.
If that is not the case (e.g. you build for x64 on a arm64 machine), adjust
the `HOST_TRIPLET` in the next step.
```sh
TRIPLET=arm64-osx-dynamic-release
# TRIPLET=x64-osx-dynamic-release
```
Configure
```sh
cmake -S . \
-G Ninja \
-B build \
-D WITH_VCPKG=ON \
-D BUILD_WITH_QT6=ON \
-D WITH_QTWEBKIT=OFF \
-D WITH_BINDINGS=ON \
-D QGIS_MACAPP_FRAMEWORK=OFF \
-D VCPKG_TARGET_TRIPLET="$TRIPLET" \
-D VCPKG_HOST_TRIPLET="$TRIPLET" \
-D CREATE_MACOSX_BUNDLE=OFF
```
Build (switch the target to `Release` if you do not want to debug)
```sh
cmake --build build --target RelWithDebInfo
```
2020-06-10 02:00:22 +02:00
# 6. Setting up the WCS test server on GNU/Linux
**Requires:** Ubuntu / Debian derived distro
These notes are for Ubuntu - other versions and Debian derived distros may
require slight variations in package names.
## 6.1. Preparation
Note the git repo below will change to the default QGIS repo once this work
is integrated into master.
```bash
2021-03-19 14:44:42 +01:00
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/
2020-06-10 02:00:22 +02:00
```
## 6.2. Setup mapserver
```bash
2021-03-19 14:44:42 +01:00
sudo apt-get install cgi-mapserver
2020-06-10 02:00:22 +02:00
```
2021-03-19 14:44:42 +01:00
Set the contents of `/var/www/wcs/cgi-bin/wcstest-1.9.0` to:
2020-06-10 02:00:22 +02:00
```bash
2021-03-19 14:44:42 +01:00
#! /bin/sh
MS_MAPFILE=/var/www/wcs/testdata/qgis-1.9.0/raster/wcs.map
export MS_MAPFILE
/usr/lib/cgi-bin/mapserv
2020-06-10 02:00:22 +02:00
```
Then do:
```bash
2021-03-19 14:44:42 +01:00
chmod +x var/www/wcs/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/* .
2020-06-10 02:00:22 +02:00
```
2021-03-19 14:44:42 +01:00
Edit `/var/www/wcs/testdata/qgis-1.9.0/raster/wcs.map` and set the shapepath to this:
2020-06-10 02:00:22 +02:00
```bash
2021-03-19 14:44:42 +01:00
SHAPEPATH "/var/www/wcs/testdata/qgis-1.9.0/raster"
2020-06-10 02:00:22 +02:00
```
2021-03-19 14:44:42 +01:00
Then create `/var/www/wcs/7-wcs.example.com.conf` setting the contents to this:
2020-06-10 02:00:22 +02:00
```bash
2021-03-19 14:44:42 +01:00
< VirtualHost * :80 >
ServerName wcs.example.com
ServerAdmin wcs-admin@example .com
2020-06-10 02:00:22 +02:00
2021-03-19 14:44:42 +01:00
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{forensic-id}n\"" combined
CustomLog /var/log/apache2/wcs_example.com/access.log combined
ErrorLog /var/log/apache2/wcs_example.com/error.log
2020-06-10 02:00:22 +02:00
2021-03-19 14:44:42 +01:00
DocumentRoot /var/www/wcs/html
2020-06-10 02:00:22 +02:00
2021-03-19 14:44:42 +01:00
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 >
2020-06-10 02:00:22 +02:00
2021-03-19 14:44:42 +01:00
RewriteEngine on
RewriteRule /1.9.0/wcs /cgi-bin/wcstest-1.9.0 [PT]
2020-06-10 02:00:22 +02:00
2021-03-19 14:44:42 +01:00
< / VirtualHost >
2020-06-10 02:00:22 +02:00
```
## 6.3. Create a home page
```bash
2021-03-19 14:44:42 +01:00
mkdir html
vim html/index.html
2020-06-10 02:00:22 +02:00
```
Set the contents to:
2021-03-19 14:44:42 +01:00
```
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.example.com/1.9.0/wcs
```
2020-06-10 02:00:22 +02:00
## 6.4. Now deploy it
```bash
2021-03-19 14:44:42 +01:00
sudo mkdir /var/log/apache2/wcs_example.com
sudo chown www-data /var/log/apache2/wcs_example.com
cd /etc/apache2/sites-available/
sudo ln -s /var/www/wcs/7-wcs.example.com.conf .
cd /var/www/wcs/
sudo a2ensite 7-wcs.example.com.conf
sudo /etc/init.d/apache2 reload
2020-06-10 02:00:22 +02:00
```
## 6.5. Debugging
```bash
2021-03-19 14:44:42 +01:00
sudo tail -f /var/log/apache2/wcs_example.com/error.log
2020-06-10 02:00:22 +02:00
```
# 7. Setting up a Jenkins Build Server
**Assumption:** You know how to make a working build environment and want to
deploy it under Jenkins for continuous integration testing now.
These notes are terse, I will expand on them later as the need arises. The
procedure is:
* Install Jenkins and get it configured according to your own preferences
* 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):
* External Monitor Job Type Plugin
* LDAP Plugin
* pam-auth
* javadoc
* ant
* Jenkins Subversion Plug-in
* Git Plugin
* Maven 2 Project Plugin
* Jenkins SLOCCount Plug-in
* Jenkins Sounds plugin
* Jenkins Translation Assistance plugin
* ruby-runtime
* Jenkins CVS Plug-in
* Coverage/Complexity Scatter Plot PlugIn
* Status Monitor Plugin
* Git Parameter Plug-In
* github-api
* GitHub plugin
* Jenkins Violations plugin
* git-notes Plugin
* Twitter plugin
* Jenkins Cobertura Plugin
* Jenkins Gravatar plugin
* Jenkins SSH Slaves plugin
* Create a Job called 'QGIS'
* Use the following options for your job:
* Job Name: QGIS
* Job Type: Build a free-style software project
* Tick enable project based security (you need to elsewhere configure your
Jenkins security to per project settings)
* Allow Anonymous user Read and Discover access
* Set the github project to https://github.com/qgis/QGIS/
* Set source code management to Git
* Set repository url to git://github.com/qgis/QGIS.git
2021-03-19 14:44:42 +01:00
* In advanced repository url settings set refspec to `+refs/heads/master:refs/remotes/origin/master`
2020-06-10 02:00:22 +02:00
* Set branch to build to master
* Repository Browser: Auto
* Build triggers: set to Poll SCM and set schedule to `*****` (polls every minute)
* Build - Execute shell and set shell script to:
```bash
2021-03-19 14:44:42 +01:00
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
2020-06-10 02:00:22 +02:00
```
* Add Junit post build action and set 'Publish Junit test result report' to:
`build/CTestResults.xml`
* Email notification: Send separate e-mails to individuals who broke the build
* Jenkins sounds - set up sounds for Failure, Success and Unstable.
* Save
Now open the Job dash board and push something to QGIS and wait a minute to
validate automated builds work.
**Note:** You will need to log in to the Jenkins user account and go to
/var/lib/jenkins/jobs/QGIS/workspace, then make a `build` directory and run
the initial cmake setup and then do test build. This process is the same as
described elsewhere in this doc.
I based some of the set up from this nice blog article here:
http://alexott.blogspot.com/2012/03/jenkins-cmakectest.html
# 8. Debug output and running tests
If you are interested in seeing embedded debug output, change the following
CMake option:
```bash
2021-03-19 14:44:42 +01:00
-D CMAKE_BUILD_TYPE=DEBUG # (or RELWITHDEBINFO)
2020-06-10 02:00:22 +02:00
```
This will flood your terminal or system log with lots of useful output from
QgsDebugMsg() calls in source code.
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:
```bash
2021-03-19 14:44:42 +01:00
-D ENABLE_TESTS=TRUE
2020-06-10 02:00:22 +02:00
```
Then run all tests from build directory:
```bash
2021-03-19 14:44:42 +01:00
cd build
make test
2020-06-10 02:00:22 +02:00
```
To run all tests and report to http://cdash.orfeo-toolbox.org/index.php?project=QGIS
```bash
2021-03-19 14:44:42 +01:00
cd build
make Experimental
2020-06-10 02:00:22 +02:00
```
You can define the host name reported via 'make Experimental' by setting a CMake
option:
```bash
2021-03-19 14:44:42 +01:00
-D SITE="my.domain.org"
2020-06-10 02:00:22 +02:00
```
To run specific test(s) (see 'man ctest'):
```bash
2021-03-19 14:44:42 +01:00
cd build
# show listing of tests, without running them
ctest --show-only
2020-06-10 02:00:22 +02:00
2021-03-19 14:44:42 +01:00
# run specific C++ or Python test(s) matching a regular expression
ctest --verbose --tests-regex SomeTestName
2020-06-10 02:00:22 +02:00
```
# 9. Authors and Acknowledgments
The following people have contributed to this document:
* Windows MINGW Section
* Tim Sutton, Godofredo Contreras 2006
* CMake additions Magnus Homann 2007
* Python additions Martin Dobias 2007
* With thanks to Tisham Dhar for preparing the initial msys environment
* Windows MSVC Section (Detailed install)
* David Willis 2007
* MSVC install additions Tim Sutton 2007
* PostgreSQL, Qt compile, SIP, Python, AutoExp additions Juergen Fischer 2007
* Windows MSVC Section (Simplified install)
* Tim Sutton 2007
* Juergen Fischer 2007
* Florian Hillen 2010
* OSX Section
* Tim Sutton 2007
* With special thanks to Tom Elwertowski and William Kyngesburye
* Larry Shaffer 2012
* Peter Petrik 2020
* GNU/Linux Section
* Tim Sutton 2006
* Debian package section: Juergen Fischer 2008
* WCS Test Server Section
* Tim Sutton, Radim Blazek 2012
* Jenkins CI Configuration
* Tim Sutton 2012
* Latex Generator
* Tim Sutton 2011
* Debug Output/Tests Section
* Larry Shaffer 2012, by way of 'Test Friday' Tim Sutton
2021-02-19 17:54:02 +01:00
* MXE/Mingw64 section
2021-02-19 22:51:03 +01:00
* Alessandro Pasotti (2018-2021)