Build QGIS master with Oracle provider yourself on CentOS7

So you are in a corporate environment using RED-HAT or CentOS, and need QGIS or QGIS-server.

Marcus wrote how you can ‘easily’ install QGIS now on Fedora21 and Centos7

But “I want to run latest development version” you say? Well you can always compile from source :-)

For Debian if you follow the instructions from INSTALL.txt it is ‘easy’.

BUT something is missing? You say, your company has only Oracle dba’s so you are only allowed to work with Oracle instead of your beloved Postgis spatial database...

You need QGIS WITH the native Oracle provider (using OCI). So you see THAT icon:

the providers toolbar with Oracle provider in red

The providers toolbar with Oracle provider in red

Below you can find the steps to build QGIS on CentOS7 from source.

The system I have here is CentOS Linux release 7.1.1503 (Core)

IF on a fresh system without X: after the Core install (no X server) install latest Gnome Desktop:

yum groupinstall "GNOME Desktop" "Graphical Administration Tools"

Else: update your system:

yum update

Now make sure you enable the Extra Packages Enterprise Linux (EPEL) repository

# enable epel as root
cd /tmp
ls *.rpm
yum install epel-release-7-5.noarch.rpm
yum repolist

Thanks to Matthias and Volker there is a spec-file in Github, these are helpfull to determine all packages needed for our build system:

# from
# build tools
yum --enablerepo="epel" install
yum --enablerepo="epel" install gcc gcc-c++ cmake desktop-file-utils expat-devel fcgi-devel git flex bison gdal-devel geos-devel grass-devel gsl-devel

# rest (most from epel)
yum install libspatialite-devel postgresql-devel proj-devel PyQt4-devel PyQwt-devel python2-devel qextserialport-devel, qscintilla-devel qscintilla-python-devel qt4-devel qt-mobility-devel qt4-webkit-devel qwt-devel qca2-devel qca-ossl
# mmm
#No package PyQwt-devel available.
#No package qextserialport-devel, available.

yum install qt-mobility-devel qt4-webkit-devel qwt-devel qextserialport-devel qwtpolar-devel sip-devel spatialindex-devel sqlite-devel xorg-x11-server-Xvfb gpsbabel

My way to compile and run different QGIS version on Debian, is to compile in a ~/dev dir and install in ~/app dir. So:

mkdir -p ~/apps/qgis/master
mkdir -p ~/dev/
cd ~/dev
# clone the sources from Github (will be in ~/dev/QGIS is this way)
git clone
# create a build dir
mkdir ~/dev/QGIS/build
cd ~/dev/QGIS/build

Normally I use the curses based ‘gui’ ccmake to do the configure. We instruct it with the following values to ‘prefill’ those fields.

Note the .. on the end: we are running this from within the build ~/dev/QGIS/build dir and point to one dir lower:


In the ccmake gui use the following keystrokes to configure and generate:

'c' to start configure: scripts will try to find dependencies, and ommisions will be shown
'e' if you are in the warning/error screen go back
'g' to generate the actual files

Most of the times you will need to do several ‘c and fix’ jumps before you can hit ‘g’.

But then:

# or even faster (if you have some cores available ...):
make -j8

This will take some time depending on your system, but if all went well you will have an output directory with a bin/qgis in it.

Now to install it in ~/apps/qgis/master do:

make install

Last part of this excercise is to create a little script which points to your freshly baked QGIS and some paths.

Put the following in a file named /usr/local/bin/qgis (as root):

# create a file /usr/local/bin/qgis to point to your install (YOU will be YOU :-) )

export LD_LIBRARY_PATH=/home/YOU/apps/qgis/master/lib/
# passing ALL parameters to qgis bin
# eg to be able to call a certain translation
# qgis --lang nl
/home/YOU/apps/qgis/master/bin/qgis "$@"

If you start QGIS now via qgis you will get some python errors, because some standard Python libs are missing. Install them via:

# now to run you'll need some python libs installed:
yum install qscintilla-python
# proably also:
yum install PyQt4-webkit
# gdal python bindings (will also get numpy and nose)
yum install gdal-python

That’s all to have a running QGIS master on Centos7!

But.. but... you promissed Oracle providers...

OK, first you need to register or go to this link and try to download:

You can only download as a registered user, it is free (but maybe your get a phonecall from Oracle....)

From above download the following zips (at this time):

mkdir -p ~/dev/oracle
mv ~/dev/oracle
mv ~/dev/oracle

Note that you cannot wget them as you need to be authenticated via your browser. So download via your browser and:

# unzip both in ~/dev/oracle so you will have
# so you will have all Oracle stuff in:

Now point to the with:

cd ~/dev/QGIS/build
export LD_LIBRARY_PATH=/home/YOU/dev/oracle/instantclient_12_1/

And do a new ccmake pointing to the include files and oracle library:

ccmake -DWITH_QWTPOLAR=OFF -DCMAKE_BUILD_TYPE=Debug  -DCMAKE_INSTALL_PREFIX=~/apps/qgis/master -DWITH_ORACLE=TRUE -DOCI_INCLUDE_DIR=/home/YOU/dev/oracle/instantclient_12_1/sdk/include -DOCI_LIBRARY=/home/YOU/dev/oracle/instantclient_12_1/ ..

After this, I had to restart the build several times because it stopped with an unclear error, not sure what the problem was:

make -j8

Because the oracle provider wants to copy some drivers to qt system libs, do:

sudo make install
# OR do this by hand, you need the oracle lib in the right dir so do:
sudo cp /home/YOU/dev/QGIS/build/output/lib/qgis/plugins/sqldrivers/ /usr/lib64/qt4/plugins/sqldrivers/

Then make sure that your ‘start script’ at /usr/local/bin/qgis contains the pointers to the Oracle libs too:

export LD_LIBRARY_PATH=/home/YOU/apps/qgis/master/lib/:/home/YOU/dev/oracle/instantclient_12_1
# passing ALL parameters to qgis bin
# eg to be able to call a certain translation
# qgis --lang nl
/home/YOU/apps/qgis/master/bin/qgis "$@"

And GO and connect to that Oracle database.

BUT please note: Postgis is nicer ;-)