Here's how to build QGIS with Oracle support on Debian based systems (this means also Ubuntu).
I'm using Debian Testing which at the time of writing this article has the codename Buster.
First, you need to install the QGIS build dependencies. One way of doing that is to get the dependencies that are written in the https://github.com/qgis/QGIS/blob/master/INSTALL.
Sometimes, there's an updating lag for the dependencies written in the INSTALL document so I tend to use the
apt-get build-dep command.
In order to do that, you need to configure the QGIS software repositories on your linux box if you haven't done it already. See https://qgis.org/en/site/forusers/alldownloads.html#debian-ubuntu
Depending on what version of QGIS you want to compile, add your corresponding repositories.
For QGIS 3 (master) on my box (Buster is not available yet in the QGIS repos, but Stretch works).
So I added to the
/etc/apt/sources.list the following lines:
deb http://qgis.org/debian-nightly stretch main
deb-src http://qgis.org/debian-nightly stretch main
Don't forget to add the qgis.org repository public key to your apt keyring as specified in the above qgis.org link.
After you add the repositories do an
sudo apt-get update to get the latest lists of packages.
Now you can install the dependencies by doing
sudo apt-get build-dep qgis. For the oracle build you also need to do a
sudo apt-get install qtbase5-private-dev qt5-default
Now let's install the Oracle dependencies:
mkdir -p ~/dev/oracle && cd ~/dev/oracle
In order to download the dependencies from Oracle (http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html) you need to register an account.
After you made your account you need to download the following files in the
From what I can recall, not all of these are needed but at the time when I took the notes I wanted to do some extra stuff, you have it all.
To install the rpm files on a debian system:
sudo apt-get install alien libaio1 -y
# Create the deb files from the rpm ones:
sudo alien oracle-instantclient12.2-*
# install the deb files
sudo dpkg -i oracle-instantclient12.2-*.deb
# setup the libraries
sudo sh -c 'echo "/usr/lib/oracle/12.2/client64/lib" > /etc/ld.so.conf.d/oracle.conf'
# check that the libraries are loaded with
sudo ldconfig -p | grep oracle
Setup the Oracle variables that many programs lool for by adding to the
Fix SDK (
.h files) finding if there is no
include directory under
ORACLE_HOME, and it is located over in
/usr/include/oracle/, by creating a symbolic link to assist packages looking for these header files:
sudo ln -s /usr/include/oracle/12.2/client64 /usr/lib/oracle/12.2/client64/include
sudo mount --bind /usr/include/oracle/12.2/client64 /usr/lib/oracle/12.2/client64/include
See also https://help.ubuntu.com/community/Oracle Instant Client for more info.
mkdir -p ~/dev/cpp && cd ~/dev/cpp
git clone https://github.com/qgis/QGIS.git qgis
mkdir qgis/build-master && cd qgis/build-master
If you want to look at the compile options graphically you should first do a
sudo apt-get install cmake-curses-gui.
Now that the
ccmake command is installed you can play around with it by doing a
ccmake -G Ninja .. that should first output something like this:
Press [enter] to edit option Press [d] to delete an entry
CMake Version 3.9.5
Press [c] to configure
Press [h] for help Press [q] to quit without generating
Press [t] to toggle advanced mode (Currently Off)
c at least one time you can get an automatic configuration. Most of the options are automatically configured but some need to be specified.
Keep in mind that some of the options appear after configuring others and pressing
c again. If it looks ok to you, and you have the press
g option, press it and then start the build.
I personally don't use ccmake anymore since I'm using the cmake arguments to configure my build:
-G Ninja \
-D CMAKE_BUILD_TYPE=Debug \
-D CMAKE_INSTALL_PREFIX=$HOME/qgis-master \
-D WITH_ASTYLE=ON \
-D WITH_APIDOC=ON \
-D WITH_CUSTOM_WIDGETS=ON \
-D WITH_QWTPOLAR=ON -D WITH_INTERNAL_QWTPOLAR=ON \
-D WITH_SERVER=ON -D SERVER_SKIP_ECW=ON \
-D WITH_ORACLE=ON \
-D OCI_INCLUDE_DIR=/usr/lib/oracle/12.2/client64/include \
-D OCI_LIBRARY=/usr/lib/oracle/12.2/client64/lib/libclntsh.so.12.1 \
If you want to install it instead of running QGIS from the
output directory you need to do:
sudo ninja install
sudo chown -R $USER:$USER $HOME/qgis-master
You need root privileges for the install if you have built
WITH_CUSTOM_WIDGETS, otherwise, the installer won't have installing rights in the QT folders. The above command restores the rights in the
$HOME folder to its user.
In order to run QGIS from the install dir, we create the
$HOME/qgis-master/bin/start-qgis-master.sh file with the following content:
sh $HOME/qgis-master/bin/start-qgis-master.sh should start QGIS with ORACLE support.W