Skip to content

Instantly share code, notes, and snippets.

@timlinux
Last active August 22, 2022 08:41
Show Gist options
  • Save timlinux/eabbeae89a0f13cc15b1a9333cbc9b62 to your computer and use it in GitHub Desktop.
Save timlinux/eabbeae89a0f13cc15b1a9333cbc9b62 to your computer and use it in GitHub Desktop.
Linux Development Environments for QGIS Developers

These notes are my setup guide for a development environment for QGIS. The notes are organised by Linux distro and also include other configuration notes I find useful on machines I set up. They are mainly a reference for myself, but feel free to use and share and send corrections if you find something amiss.

If you need commercial help with QGIS or FOSSGIS related workflows, please contact [email protected]

Regards

Tim Sutton April 2021

Package installation

QGIS Compilation Package dependencies (Current as of QGIS 3.20)

sudo dnf install -y \
qca.x86_64 qca-devel.x86_64 \
qca-gnupg.x86_64 qca-ossl.x86_64 \
gdal.x86_64 gdal-python-tools \
grass-devel.x86_64 PyQt4-qsci-api.x86_64 \
qt5-qtx11extras.x86_64 qt-creator-doc.noarch git \
gitg      gcc      gcc-c++      make      \
automake meld txt2tags ccache ninja-build \
qt5-qtwebkit-devel qt5-qtlocation-devel \
qt5-qttools-static qt5-qtscript-devel \
qca-qt5-devel python3-qt5-devel  qscintilla-qt5-devel \
python3-qscintilla-qt5 python3-qscintilla-qt5-devel 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 protobuf-lite \
protobuf-devel protobuf-c-devel fcgi-devel \
python3-OWSLib python3-jinja2 python3-pygments \
python3-gdal.x86_64 gdal-python-tools.x86_64 \
grass-devel.x86_64 saga-devel.x86_64 python3-qt5-webengine \
python3-qt5-webkit netcdf-cxx4-devel.x86_64 \
hdf5-devel.x86_64 hdf5-devel.x86_64 hdf5-mpich-devel.x86_64 \
hdf5-mpich-static.x86_64 python-psycopg2 libzip libzip-devel \
qt5-qtserialport-devel exiv2-devel qtkeychain-qt5-devel \
protobuf-lite-devel qt5-qt3d qt5-qt3d-devel PDAL-devel PDAL-libs PDAL \
python3-autopep8 qca-qt5-devel libzstd-devel sip python3-pyqt5-sip python3-sip-devel
sudo ln -s /usr/bin/autopep8-3 /usr/bin/autopep8

QGIS Compilation

The above should be enought to compile QGIS from console with the following workflow:

mkdir -p ~/dev/cpp
git clone [email protected]:qgis/QGIS.git
mkdir QGIS-Console-Build
cd QGIS-Console-Build
ccmake ../QGIS

Press c then gto configure then generate the makefiles. Then do this (substituting the number after -j for the number of cores you wish to use to compile with.

make -j16
output/bin/qgis

At any time you can relaunch QGIS without recompiling using the last command above.

Fetch updates and recompile

cd ~/dev/cpp/QGIS
git fetch origin
# Note any local changes will be lost with this next command!
git reset --hard origin/master
cd ..
cd QGIS-Debug-Build

Then do this (substituting the number after -j for the number of cores you wish to use to compile with.

make -j16
output/bin/qgis

Some optional extras

# Needed for pgcrypto extension
sudo dnf install postgresql-contrib 

# For performance measuring - see https://github.com/KDAB/hotspot#using
sudo dnf install hotspot perf

####------------------------------------------------

####Need to confirm the next steps are still correct

####------------------------------------------------

Qt Creator Configuration

CMake Configuration Options for Kit

CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}
CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}
CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}

Protobuf_LIBRARY_RELEASE:INTERNAL=/usr/lib64/libprotobuf.so
Protobuf_LITE_LIBRARY_RELEASE:INTERNAL=/usr/lib64/libprotobuf-lite.so.22
QT5_3DEXTRA_INCLUDE_DIR:INTERNAL=/home/timlinux/dev/cpp/QGIS/external/qt3dextra-headers
QT5_3DEXTRA_LIBRARY:INTERNAL=/usr/lib64/libQt53DExtras.so
QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}

Also for debugging, disable the crash handler:

image

CMake Project Configuration

Even though I set it in the CMAKE config above I also needed to manually add it here as a new key:

QT5_3DEXTRA_LIBRARY   /usr/lib64/libQt53DExtras.so
GRASS_INCLUDE_DIR7 /usr/lib64/grass78/include/
GRASS_PREFIX7=/usr/lib64/grass78
HDF5_C_INCLUDE_DIR=/usr/include

Build Steps - Build

Again, configure the number after -j to represent the number of cores you wish to build with.

cmake --build . --target all -- -j16

Configuration steps for Gnome 4 and Wayland

To get my Logitech Marble Mouse scrollball to scroll on right minor button mouse and ball scroll do this:

gsettings set org.gnome.desktop.peripherals.trackball scroll-wheel-emulation-button 9

Substitute 9 with 8 to use the left minor button rather. Note that after pressing enter your gnome session may reset so save your work first!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment