QGIS Building QGIS from source - step by step Friday August 24, 2018 Last Updated: Friday August 24, 2018 Last Change : Friday August 24, 2018 1. Introduction 2. Overview 3. Building on GNU/Linux 3.1. Building QGIS with Qt 5.x 3.2. Prepare apt 3.3. Install build dependencies 3.4. Setup ccache (Optional, but recommended) 3.5. Prepare your development environment 3.6. Check out the QGIS Source Code 3.7. Starting the compile 3.8. Building Debian packages 3.9. On Fedora Linux 4. Building on Windows 4.1. Building with Microsoft Visual Studio 4.2. Building using MinGW 4.3. Creation of MSYS environment for compilation of QGIS 4.4. Building on Linux with mxe 5. Building on MacOS X 5.1. Install Developer Tools 5.2. Install Qt4 from disk image 5.3. Install CMake for OSX 5.4. Install development frameworks for QGIS dependencies 5.5. API documentation 5.6. QGIS source 5.7. Configure the build 5.8. Building 5.9. Post-Install 6. Setting up the WCS test server on GNU/Linux 6.1. Preparation 6.2. Setup mapserver 6.3. Create a home page 6.4. Now deploy it 6.5. Debugging 7. Setting up a Jenkins Build Server 8. Debug output and running tests 9. Authors and Acknowledgments 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: http://qgis.org 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 master branch are available at http://htmlpreview.github.io/?https://raw.github.com/qgis/QGIS/master/doc/INSTALL.html. 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). Please visit http://qgis.org for information on joining our mailing lists 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. /!\ Note to document writers: 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. 2. Overview =========== QGIS, like a number of major projects (e.g., KDE 4.0), uses CMake (http://www.cmake.org) for building from source. Following a summary of the required dependencies for building: Required build tools: - CMake >= 3.0.0 - Flex >= 2.5.6 - Bison >= 2.4 Required build dependencies: - Qt >= 5.3.0 - Proj >= 4.4.x - GEOS >= 3.4 - Sqlite3 >= 3.0.0 - SpatiaLite >= 4.2.0 - libspatialindex - GDAL/OGR >= 2.1 - 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 - for mapserver export and PyQGIS - Python >= 3.3 - 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 to http://gdal.org/formats_list.html ff. for instructions how to include those formats in GDAL. 3. Building on GNU/Linux ======================== 3.1. Building QGIS with Qt 5.x ============================== Requires: Ubuntu / Debian derived distro /!\ Note: 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. 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 aims here is to show how this can be done using binary packages for *all* 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 ================ 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: 1. Edit your /etc/apt/sources.list file. 2. Uncomment all the lines starting with "deb" Also you will need to be running Ubuntu 'precise' or higher in order for all dependencies to be met. Now update your local sources database: sudo apt-get update 3.3. Install build dependencies =============================== || Distribution | install command for packages | | stretch | ``apt-get install bison ca-certificates ccache cmake cmake-curses-gui dh-python doxygen expect flex gdal-bin git graphviz grass-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpq-dev libproj-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqt5opengl5-dev libqt5scintilla2-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 pkg-config poppler-utils pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python-autopep8 python3-all-dev python3-dateutil python3-dev python3-future python3-gdal python3-httplib2 python3-jinja2 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 qt5-default qt5keychain-dev qtbase5-dev qtbase5-private-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools spawn-fcgi txt2tags xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` | | buster | ``apt-get install bison ca-certificates ccache cmake cmake-curses-gui dh-python doxygen expect flex gdal-bin git graphviz grass-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libosgearth-dev libpq-dev libproj-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqt5opengl5-dev libqt5scintilla2-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 pkg-config poppler-utils pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python-autopep8 python3-all-dev python3-dateutil python3-dev python3-future python3-gdal python3-httplib2 python3-jinja2 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 qt5-default qt5keychain-dev qtbase5-dev qtbase5-private-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools spawn-fcgi txt2tags xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` | | xenial | ``apt-get install bison ca-certificates ccache cmake cmake-curses-gui dh-python doxygen expect flex gdal-bin git graphviz grass-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libpq-dev libproj-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqt5opengl5-dev libqt5scintilla2-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 pkg-config poppler-utils pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python-autopep8 python3-all-dev python3-dateutil python3-dev python3-future python3-gdal python3-httplib2 python3-jinja2 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 qt5-default qt5keychain-dev qtbase5-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools spawn-fcgi txt2tags xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` | | bionic | ``apt-get install bison ca-certificates ccache cmake cmake-curses-gui dh-python doxygen expect flex gdal-bin git graphviz grass-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libosgearth-dev libpq-dev libproj-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqt5opengl5-dev libqt5scintilla2-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 pkg-config poppler-utils pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python-autopep8 python3-all-dev python3-dateutil python3-dev python3-future python3-gdal python3-httplib2 python3-jinja2 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 spawn-fcgi txt2tags xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` | | cosmic | ``apt-get install bison ca-certificates ccache cmake cmake-curses-gui dh-python doxygen expect flex gdal-bin git graphviz grass-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libosgearth-dev libpq-dev libproj-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqt5opengl5-dev libqt5scintilla2-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 pkg-config poppler-utils pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python-autopep8 python3-all-dev python3-dateutil python3-dev python3-future python3-gdal python3-httplib2 python3-jinja2 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 qt5-default qt5keychain-dev qtbase5-dev qtbase5-private-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools spawn-fcgi txt2tags xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` | | sid | ``apt-get install bison ca-certificates ccache cmake cmake-curses-gui dh-python doxygen expect flex gdal-bin git graphviz grass-dev libexpat1-dev libfcgi-dev libgdal-dev libgeos-dev libgsl-dev libosgearth-dev libpq-dev libproj-dev libqca-qt5-2-dev libqca-qt5-2-plugins libqt5opengl5-dev libqt5scintilla2-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 pkg-config poppler-utils pyqt5-dev pyqt5-dev-tools pyqt5.qsci-dev python-autopep8 python3-all-dev python3-dateutil python3-dev python3-future python3-gdal python3-httplib2 python3-jinja2 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 qt5-default qt5keychain-dev qtbase5-dev qtbase5-private-dev qtpositioning5-dev qttools5-dev qttools5-dev-tools spawn-fcgi txt2tags xauth xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xvfb`` | (extracted from the control.in file in debian/) See http://qgis.org/en/site/forusers/alldownloads.html#debian-ubuntu for currently supported distributions (plain xenial's GDAL for instance is to old and we build with GDAL2 from ubuntugis). 3.4. Setup ccache (Optional, but recommended) ============================================= You should also setup ccache to speed up compile times: cd /usr/local/bin sudo ln -s /usr/bin/ccache gcc sudo ln -s /usr/bin/ccache g++ 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/, so in this case we will create a work environment for C++ development work like this: mkdir -p ${HOME}/dev/cpp cd ${HOME}/dev/cpp 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 the developer checkout if you have permissions to commit source code changes. 1. Anonymous Checkout cd ${HOME}/dev/cpp git clone git://github.com/qgis/QGIS.git 2. Developer Checkout cd ${HOME}/dev/cpp git clone git@github.com:qgis/QGIS.git 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: mkdir -p ${HOME}/apps Now we create a build directory and run ccmake: cd QGIS mkdir build-master cd build-master ccmake .. 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. /!\ Warning: Make sure that your build directory is completely empty when you enter the command. Do never try to "re-use" an existing Qt4 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. Now on with the build: make -jX 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: ./output/bin/qgis Another option is to install to your system: make install After that you can try to run QGIS: $HOME/apps/bin/qgis 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. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${HOME}/apps/lib/ 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.: cmake -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=${HOME}/apps .. 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: ccmake -G Ninja .. cmake -G Ninja -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=${HOME}/apps .. Build and install with ninja: ninja (uses all cores by default; also supports the above described -jX option) ninja install You can build just the targets you need using, for example : ninja qgis ninja pycore You can build just the targets you need using, for example: - ninja qgis - ninja pycore 3.8. 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. First you need to install the debian packaging tools once: apt-get install build-essential First you need to create an changelog entry for your distribution. For example for Ubuntu Precise: dch -l ~precise --force-distribution --distribution precise "precise build" The QGIS packages will be created with: dpkg-buildpackage -us -uc -b /!\ Note: Install devscripts to get dch. /!\ Note: If dpkg-buildpackage complains about unmet build dependencies you can install them using apt-get and re-run the command. /!\ 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 results are uploaded to http://dash.orfeo-toolbox.org/index.php?project=QGIS. 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. The packages are created in the parent directory (ie. one level up). Install them using dpkg. E.g.: sudo debi 3.9. 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.9.1. Install build dependencies ================================= dnf install 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 qt5-qtxmlpatterns-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 To build QGIS server additional dependencies are required: dnf install fcgi-devel 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. cmake .. 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) make Run from the build directory ./output/bin/qgis Or install to your system make install 3.9.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: cat > ~/.config/QtProject/qtlogging.ini << EOL [Rules] default.debug=true EOL 4. Building on Windows ====================== 4.1. Building with Microsoft Visual Studio ========================================== 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). This section describes the setup required to allow Visual Studio to be used to build QGIS. 4.1.1. Visual C++ Community Edition =================================== The free (as in free beer) Community installer is available under: http://download.microsoft.com/download/D/2/3/D23F4D0F-BA2D-4600-8725-6CCECEA05196/vs_community_ENU.exe 4.1.2. Other tools and dependencies =================================== Download and install following packages: || Tool | Website | | CMake | https://cmake.org/files/v3.7/cmake-3.7.2-win64-x64.msi | | GNU flex, GNU bison and GIT | http://cygwin.com/setup-x86.exe (32bit) or http://cygwin.com/setup-x86_64.exe (64bit) | | OSGeo4W | http://download.osgeo.org/osgeo4w/osgeo4w-setup-x86.exe (32bit) or http://download.osgeo.org/osgeo4w/osgeo4w-setup-x86_64.exe (64bit) | | ninja | https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-win.zip | For the QGIS build you need to install following packages from cygwin: - bison - flex - git and from OSGeo4W (select Advanced Installation): - qgis-rel-deps This will also select packages the above packages depend on. 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 OSGeo4W[64]\include, that conflicts with Visual Studio own stdint.h, which for example breaks the build of the virtual layer provider. 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. ninja: copy ninja.exe to d:\OSGeo4W64\bin\ 4.1.3. Setting up the Visual Studio project with CMake ====================================================== /!\ Consider this section as example. It tends to outdate, when OSGeo4W and SDKs move on. ms-windows/osgeo4w/package-nightly.cmd is used for the nightly builds and constantly updated and hence might contain necessary updates that are not yet reflected here. 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): @echo off call X:\src\qgis\ms-windows\osgeo4w\msvc-env.bat x86_64 @cmd Save the batch file as d:\OSGeo4W64\OSGeo4W-dev.bat and run it. On the command prompt checkout the QGIS source from git to the source directory QGIS: git clone git://github.com/qgis/QGIS.git Using configonly.cmd to create the MSVC solution file: We will be using the file ms-windows/osgeo4w/configonly.cmd 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.cmd is meant to create a configured build directory with a MSVC solution file: ``` configonly.cmd ``` 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: devenv From MSVC, open the solution file d:\OSGeo4W64\QGIS\ms-windows\osgeo4w\build-qgis-test-x86_64\qgis2.99.0.sln Try to build the solution go grab a cup of tea, it may take a (while). If it fails, run it again and again until there are [hopefully] no errors. 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 appeares even if no files were was changed. 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. Now run cmake-gui (still from cmd) and in the Where is the source code: box, browse to the top level QGIS directory. In the Where to build the binaries: box, browse to the 'build' directory you created. If the path to bison and flex contains blanks, you need to use the short name for the directory (i.e. C:\Program Files should be rewritten to C:\Progra~n, where n is the number as shown in `dir /x C:\``). 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. Hit Configure to start the configuration and select Visual Studio 9 2008 and keep native compilers and click Finish. The configuration should complete without any further questions and allow you to click Generate. Now close cmake-gui and continue on the command prompt by starting vcexpress. Use File / Open / Project/Solutions and open the qgis-x.y.z.sln File in your project directory. Change Solution Configuration from Debug to RelWithDebInfo (Release with Debug Info) or Release before you build QGIS using the ALL_BUILD target (otherwise you need debug libraries that are not included). After the build completed you should install QGIS using the INSTALL target. Install QGIS by building the INSTALL project. By default this will install to c:\Program Files\qgis (this can be changed by changing the CMAKE_INSTALL_PREFIX variable in cmake-gui). You will also either need to add all the dependency DLLs to the QGIS install directory or add their respective directories to your PATH. 4.1.4. Packaging ================ 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. The script can be run on both Windows and Linux. On Debian/Ubuntu you can just install the 'nsis' package. NSIS for Windows can be downloaded at: http://nsis.sourceforge.net And Perl for Windows (including other requirements like 'wget', 'unzip', 'tar' and 'bzip2') is available at: http://cygwin.com 4.1.5. Packaging your own build of QGIS ======================================= 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. cd ms-windows/ rm -rf osgeo4w/unpacked/apps/qgis/* cp -r /tmp/qgis1.7.0/* osgeo4w/unpacked/apps/qgis/ Now create a package. ./quickpackage.sh 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. 4.1.6. Osgeo4w packaging ======================== The actual packaging process is currently not documented, for now please take a look at: ms-windows/osgeo4w/package.cmd 4.2. Building using MinGW ========================= Note: This section might be outdated as nowadays Visual C++ is use to build the "official" packages. Note: For a detailed account of building all the dependencies yourself you can visit Marco Pasetti's website here: http://www.webalice.it/marco.pasetti/qgis+grass/BuildFromSource.html Read on to use the simplified approach with pre-built libraries... 4.2.1. MSYS =========== MSYS provides a unix style build environment under windows. We have created a zip archive that contains just about all dependencies. Get this: http://download.osgeo.org/qgis/win32/msys.zip and unpack to c:\msys If you wish to prepare your msys environment yourself rather than using our pre-made one, detailed instructions are provided elsewhere in this document. 4.2.2. Qt ========= Download Qt opensource precompiled edition exe and install (including the download and install of mingw) from here: http://qt.nokia.com/downloads/ When the installer will ask for MinGW, you don't need to download and install it, just point the installer to c:\msys\mingw When Qt installation is complete: Edit C:\Qt\5.9.1\bin\qtvars.bat and add the following lines: set PATH=%PATH%;C:\msys\local\bin;c:\msys\local\lib set PATH=%PATH%;"C:\Program Files\Subversion\bin" I suggest you also add C:\Qt\5.9.1\bin\ to your Environment Variables Path in the windows system preferences. 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 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: c:\Qt\5.9.1 make 4.2.3. Flex and Bison ===================== Get Flex http://sourceforge.net/project/showfiles.php?group_id=23617&package_id=16424 (the zip bin) and extract it into c:\msys\mingw\bin 4.2.4. Python ============= 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. Note that even if you compile without the Python bindings, Python3 is still a necessary dependency for building QGIS. 4.2.4.1. Download and install Python - use Windows installer ============================================================ (It doesn't matter to what folder you'll install it) http://python.org/download/ 4.2.4.2. Download SIP and PyQt5 sources ======================================= http://www.riverbankcomputing.com/software/sip/download http://www.riverbankcomputing.com/software/pyqt/download Extract each of the above zip files in a temporary directory. Make sure to get versions that match your current Qt installed version. 4.2.4.3. Compile SIP ==================== c:\Qt\5.9.1\bin\qtvars.bat python configure.py -p win32-g++ make make install 4.2.4.4. Compile PyQt ===================== c:\Qt\5.9.1\bin\qtvars.bat python configure.py make make install 4.2.4.5. Final python notes =========================== /!\ You can delete the directories with unpacked SIP and PyQt5 sources after a successful install, they're not needed anymore. 4.2.5. git ========== In order to check out QGIS sources from the repository, you need a git client. This installer should work fine: https://git-scm.com/download/win 4.2.6. CMake ============ CMake is build system used by QGIS. Download it from here: https://cmake.org/files/v3.9/cmake-3.9.3-win64-x64.msi 4.2.7. QGIS =========== Start a cmd.exe window ( Start -> Run -> cmd.exe ) Create development directory and move into it md c:\dev\cpp cd c:\dev\cpp Check out sources from GIT: git clone git://github.com/qgis/QGIS.git 4.2.8. Compiling ================ As a background read the generic building with CMake notes at the end of this document. Start a cmd.exe window ( Start -> Run -> cmd.exe ) if you don't have one already. Add paths to compiler and our MSYS environment: c:\Qt\5.9.1\bin\qtvars.bat 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: cd c:\dev\cpp\qgis md build cd build 4.2.9. Configuration ==================== cmakesetup .. Note: You must include the '..' above. Click 'Configure' button. When asked, you should choose 'MinGW Makefiles' as generator. There's a problem with MinGW Makefiles on Win2K. If you're compiling on this platform, use 'MSYS Makefiles' generator instead. 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'. For compatibility with NSIS packaging scripts I recommend to leave the install prefix to its default c:\program files\ When configuration is done, click 'OK' to exit the setup utility. 4.2.10. Compilation and installation ==================================== make make install 4.2.11. Run qgis.exe from the directory where it's installed (CMAKE_INSTALL_PREFIX) =================================================================================== 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. 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. 4.2.12. Create the installation package: (optional) =================================================== Download and install NSIS from (http://nsis.sourceforge.net/Main_Page) 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'. 4.3. Creation of MSYS environment for compilation of QGIS ========================================================= 4.3.1. Initial setup ==================== 4.3.1.1. MSYS ============= This is the environment that supplies many utilities from UNIX world in Windows and is needed by many dependencies to be able to compile. Download from here: http://puzzle.dl.sourceforge.net/sourceforge/mingw/MSYS-1.0.11-2004.04.30-1.exe Install to c:\msys All stuff we're going to compile is going to get to this directory (resp. its subdirs). 4.3.1.2. MinGW ============== Download from here: http://puzzle.dl.sourceforge.net/sourceforge/mingw/MinGW-5.1.3.exe Install to c:\msys\mingw It suffices to download and install only g++ and mingw-make components. 4.3.1.3. Flex and Bison ======================= Flex and Bison are tools for generation of parsers, they're needed for GRASS and also QGIS compilation. Download the following packages: http://gnuwin32.sourceforge.net/downlinks/flex-bin-zip.php http://gnuwin32.sourceforge.net/downlinks/bison-bin-zip.php http://gnuwin32.sourceforge.net/downlinks/bison-dep-zip.php Unpack them all to c:\msys\local 4.3.2. Installing dependencies ============================== 4.3.2.1. Getting ready ====================== Paul Kelly did a great job and prepared a package of precompiled libraries for GRASS. The package currently includes: - zlib-1.2.3 - libpng-1.2.16-noconfig - xdr-4.0-mingw2 - freetype-2.3.4 - fftw-2.1.5 - PDCurses-3.1 - proj-4.5.0 - gdal-1.4.1 It's available for download here: http://www.stjohnspoint.co.uk/grass/wingrass-extralibs.tar.gz Moreover he also left the notes how to compile it (for those interested): http://www.stjohnspoint.co.uk/grass/README.extralibs Unpack the whole package to c:\msys\local 4.3.2.2. GRASS ============== Grab sources from CVS or use a weekly snapshot, see: http://grass.itc.it/devel/cvs.php In MSYS console go to the directory where you've unpacked or checked out sources (e.g. c:\msys\local\src\grass-6.3.cvs) Run these commands: 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 It should get installed to c:\msys\local\grass-6.3.cvs By the way, these pages might be useful: - http://grass.gdf-hannover.de/wiki/WinGRASS_Current_Status - http://geni.ath.cx/grass.html 4.3.2.3. GEOS ============= Download the sources: http://geos.refractions.net/geos-2.2.3.tar.bz2 Unpack to e.g. c:\msys\local\src To compile, I had to patch the sources: in file source/headers/timeval.h line 13. Change it from: #ifdef _WIN32 to: #if defined(_WIN32) && defined(_MSC_VER) Now, in MSYS console, go to the source directory and run: ./configure --prefix=/usr/local make make install 4.3.2.4. SQLITE =============== You can use precompiled DLL, no need to compile from source: Download this archive: http://www.sqlite.org/sqlitedll-3_3_17.zip and copy sqlite3.dll from it to c:\msys\local\lib Then download this archive: http://www.sqlite.org/sqlite-source-3_3_17.zip and copy sqlite3.h to c:\msys\local\include 4.3.2.5. GSL ============ Download sources: ftp://ftp.gnu.org/gnu/gsl/gsl-1.9.tar.gz Unpack to c:\msys\local\src Run from MSYS console in the source directory: ./configure make make install 4.3.2.6. EXPAT ============== Download sources: http://dfn.dl.sourceforge.net/sourceforge/expat/expat-2.0.0.tar.gz Unpack to c:\msys\local\src Run from MSYS console in the source directory: ./configure make make install 4.3.2.7. POSTGRES ================= We're going to use precompiled binaries. Use the link below for download: http://wwwmaster.postgresql.org/download/mirrors-ftp?file=%2Fbinary%2Fv8.2.4%2Fwin32%2Fpostgresql-8.2.4-1-binaries-no-installer.zip copy contents of pgsql directory from the archive to c:\msys\local 4.3.3. Cleanup ============== We're done with preparation of MSYS environment. Now you can delete all stuff in c:\msys\local\src - it takes quite a lot of space and it's not necessary at all. 4.4. Building on Linux with mxe =============================== With this approach you can build a windows binary on Linux using mxe MXE (M cross environment). You can find the build script and a README file in the ms-windows/mxe directory. For now, Python buildings cannot be built with mxe. 4.4.1. Initial setup ==================== 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. 4.4.2. Building the dependencies ================================ Please see the README under ms-windows/mxe for a list of the dependencies that need to be built in mxe before attempting to build QGIS. 4.4.3. Cross-Building QGIS ========================== Edit the build-mxe.sh script and change the path where your mxe installation is located, you can also change the build and release directory. 4.4.4. Testing QGIS =================== Copy and unzip the release package on a Windows machine and launch it! 5. Building on MacOS X ====================== In this approach I will try to avoid as much as possible building dependencies from source and rather use frameworks wherever possible. "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 (Leopard), 10.6 (Snow Leopard), 10.7 (Lion), 10.8 (Mt. Lion) and 10.9 (Mavericks) (These names will be used throughout the instructions.) Make sure to read each section completely before typing the first command you see. General note on Terminal usage: When I say "cd" to a folder in a Terminal, it means type "cd " (without the quotes, make sure to type a space after) and then type the path to said folder, then . 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 . Parallel Compilation: On multiprocessor/multicore Macs, it's possible to speed up compilation, but it's not automatic. Whenever you type "make" (but NOT "make install"), instead type: make -j [#cpus] 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. ie: Mac Pro "8 Core" model (2 quad core processors) = 8 ie: Macbook Pro i5 (hyperthreading) = 2 cores X 2 = 4 To find out how many CPUs you have available, run the following in Terminal: /usr/sbin/sysctl -n hw.ncpu which can be used in build shell scripts like: make -j $(/usr/sbin/sysctl -n hw.ncpu) Note: 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. 5.1. Install Developer Tools ============================ 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. 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 Xcode 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. 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: sudo /Developer/Library/uninstall-devtools On Lion and Mt. Lion, using Xcode 4.4+, the developer command line tools can be installed via the Xcode preferences. Xcode 4.3+ also introduces the clang frontend to the LLVM compiler as default. Note: 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. http://clang.llvm.org/ 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: export CC=/usr/bin/llvm-gcc export CXX=/usr/bin/llvm-g++ If you have trouble building some of the dependencies listed below with clang (e.g. OSG & osgEarth), try using only the LLVM compilers. 5.2. Install Qt4 from disk image ================================ 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. Snow Leopard+ note: If you are building on Snow Leopard+, you will need to decide between 32-bit support in the older Qt Carbon branch, or 64-bit support in the Qt Cocoa branch. Appropriate installers are available for both as of Qt-4.5.2, 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. General note: 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. PPC note: The readymade Qt Cocoa installers don't include PPC support, you'd have to compile Qt yourself. But, there appear to be issues with Qt Cocoa on PPC Macs anyways. Qt Carbon is recommended on PPC Macs. http://qt-project.org/downloads If you want debug frameworks, Qt also provides a separate download with these. These are in addition to the non-debug frameworks. 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). Once downloaded open the disk image and run the installer. Note you need admin privileges to install. Leopard+ note: 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: sudo ln -s /usr/lib/libQtUiTools.a /usr/local/lib/ sudo ln -s /usr/lib/libQtCLucene.dylib /usr/local/lib/ These should then be found automatically. 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. 5.3. Install CMake for OSX ========================== Get the latest source release from here: http://www.cmake.org/cmake/resources/software.html Binary installers are available for OS X, but they are not recommended (2.4 versions install in /usr instead of /usr/local, and 2.6+ versions are a strange application). Instead, download the source. 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: ./bootstrap --docdir=/share/doc/CMake --mandir=/share/man make -j [#cpus] sudo make install 5.3.1. Optional setup: ccache ============================= Xcode 4.4+ note: 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. 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.) Get the latest source release from here: http://ccache.samba.org/ Double-click the source tarball to unpack, then, in Terminal.app, cd to the source folder and: ./configure make sudo make install After install, symbolically link compilers to /usr/local/bin/ccache. (Note: this differs from instructions at http://ccache.samba.org/manual.html Changing the /usr/bin:/usr/local/bin order in PATH is not recommended on OS X. 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++ 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. export PATH=/usr/local/bin/compilers:$PATH If you have trouble building some of the dependencies listed below (e.g. OSG & osgEarth), try bypassing ccache. 5.4. Install development frameworks for QGIS dependencies ========================================================= Download William Kyngesburye's excellent GDAL Complete package that includes PROJ, GEOS, GDAL, SQLite3, SpatiaLite, and image libraries, as frameworks. There are also GSL and FreeType frameworks. http://www.kyngchaos.com/software/frameworks Once downloaded, open and install the frameworks. William provides an additional installer package for PostgreSQL (for PostGIS support). QGIS just needs the libpq client library, so unless you want to setup the full Postgres + PostGIS server, all you need is the client-only package. It's available here: http://www.kyngchaos.com/software/postgres Also available is a GRASS application: http://www.kyngchaos.com/software/grass Old versions of these packages for older systems are available in the software archive section. 5.4.1. Additional dependencies: General compatibility note ========================================================== There are some additional dependencies that, at the time of writing, are not provided as frameworks or installers so we will need to build these from source. If you are wanting to build QGIS as a 64-bit application, you will need to provide the appropriate build commands to produce 64-bit support in dependencies. Likewise, for 32-bit support on Snow Leopard, you will need to override the default system architecture, which is 64-bit, according to instructions for individual dependency packages. Stable release versions are preferred. Beta and other development versions may have problems and you are on your own with those. 5.4.2. Additional dependencies: Expat ===================================== Snow Leopard+ note: Snow Leopard includes a usable expat, so this step is not necessary on Snow Leopard or above. Get the expat sources: http://sourceforge.net/project/showfiles.php?group_id=10127 Double-click the source tarball to unpack, then, in Terminal.app, cd to the source folder and: ./configure make sudo make install 5.4.3. Additional dependencies: Spatialindex ============================================ Get the libspatialindex sources: http://download.osgeo.org/libspatialindex/ Double-click the source tarball to unpack, then, in Terminal.app, cd to the source folder and: ./configure --disable-dependency-tracking CFLAGS=-Os make sudo make install 5.4.4. Additional dependencies: Python ====================================== Leopard+ note: 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. If installing from python.org, make sure you install the latest Python 2.x from http://www.python.org/download/ Python 3 is a major change, and may have compatibility issues, so try it at your own risk. 5.4.5. Additional dependencies: SIP =================================== Mt Lion note: 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+ Retrieve the python bindings toolkit SIP from http://www.riverbankcomputing.com/software/sip/download Double-click the source tarball to unpack it, then, in Terminal.app, cd to the source folder. Then for your chosen Python: python.org Python python configure.py make sudo make install Leopard system Python SIP wants to install in the system path -- this is not a good idea. More configuration is needed to install outside the system path: python configure.py -n -d /Library/Python/2.5/site-packages -b /usr/local/bin \ -e /usr/local/include -v /usr/local/share/sip -s MacOSX10.5.sdk Snow Leopard system Python Similar to Leopard, you should install outside the system Python path. Also, you need to specify the architecture you want 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. If you are using 32-bit Qt (Qt Carbon): python2.6 configure.py -n -d /Library/Python/2.6/site-packages -b /usr/local/bin \ -e /usr/local/include -v /usr/local/share/sip --arch=i386 -s MacOSX10.6.sdk For 64-bit Qt (Qt Cocoa), use this configure line: python2.6 configure.py -n -d /Library/Python/2.6/site-packages -b /usr/local/bin \ -e /usr/local/include -v /usr/local/share/sip --arch=x86_64 -s MacOSX10.6.sdk Lion+ system Python Similar to Snow Leopard, you should install outside the system Python path. The SDK option should match the system you are compiling on: for Lion: 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 for Mt. Lion: 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 for Mavericks: 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 continue... Then continue with compilation and installation: make sudo make install 5.4.6. Additional dependencies: QScintilla2 =========================================== Retrieve the Qt version of the Scintilla-based text editor widget from http://www.riverbankcomputing.co.uk/software/qscintilla/download Double-click the tarball to unpack it. Then, cd to the QScintilla2.x.x source folder in a Terminal. 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/: cd Qt4Qt5 Edit QScintilla-gpl-2.x.x/Qt4Qt5/qscintilla.pro in the following manner: current line --> new line target.path = $$[QT_INSTALL_LIBS] --> target.path = /usr/local/lib header.path = $$[QT_INSTALL_HEADERS] --> header.path = /usr/local/include Save the qscintilla.pro file and build the QScintilla2 C++ library: qmake -spec macx-g++ qscintilla.pro make -j [#cpus] sudo make install adjust the install_name_tool command for the version installed of QScintilla installed: sudo install_name_tool -id /usr/local/lib/libqscintilla2.11.dylib \ /usr/local/lib/libqscintilla2.11.dylib 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. 5.4.6.1. Optional setup: QScintilla2 QtDesigner plugin ====================================================== The plugin allows QScintilla2 widgets to be used within QtDesigner. cd cd designer-Qt4Qt5 qmake -spec macx-g++ designer.pro make sudo make install Installs in /Developer/Applications/Qt/plugins/designer/ 5.4.7. Additional dependencies: PyQt ==================================== Retrieve the python bindings toolkit for Qt from http://www.riverbankcomputing.com/software/pyqt/download Double-click the source tarball to unpack it, then, in Terminal.app, cd to the source folder. Then for your chosen Python: python.org Python python configure.py -n /usr/local/Qt4.8/qsci yes Leopard system Python PyQt wants to install in the system path -- this is not a good idea. More configuration is needed to install outside the system path: python configure.py -d /Library/Python/2.5/site-packages -b /usr/local/bin -n /usr/local/Qt4.8/qsci -v /usr/local/share/sip/PyQt4 Snow Leopard system Python Similar to Leopard, you should install outside the system Python path. Also, you need to specify the architecture you want (requires at least PyQt 4.6), and make sure to run the versioned python binary (this one responds to the 'arch' command, which is important for pyuic4, 'python' does not). Substitute '2.7' for python version and 10.7 for SDK version below for Lion. If you are using 32-bit Qt (Qt Carbon): 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 For 64-bit Qt (Qt Cocoa), use this configure line: python2.6 configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin \ -n /usr/local/Qt4.8/qsci -v /usr/local/share/sip/PyQt4 --use-arch x86_64 Lion, Mt. Lion, and Mavericks system Python Similar to Snow Leopard, you should install outside the system Python path. But you don't need the use-arch option: 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 continue... make -j [#cpus] sudo make install If there is a problem with undefined symbols in QtOpenGL on Leopard, edit QtOpenGL/makefile and add -undefined dynamic_lookup to LFLAGS. Then make again. 5.4.8. Additional dependencies: QScintilla2 Python Module ========================================================= 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. Snow Leopard: substitute '2.6' for Python version cd 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 <> qwtconfig.pri <