Description of the issue:

Building GDAL from sources after having build proj in its latest version is failing at the configure step because it's not finding proj 6.

Details to reproduce:

Work environment:

I'm working on Ubuntu 18.04 64 bit (4.18.0-16-generic x86_64 GNU/Linux).

Installing proj.4 version 6:

I recently and freshly clone the master branch of proj version 6 from github: https://github.com/OSGeo/proj.4 in order to build it:

git clone https://github.com/OSGeo/proj.4.git /opt/proj.4
cd /opt/proj.4/
mkdir build/ && cd build/
cmake-gui ..
[configure] & [generate]
$ sudo checkinstall

Everything went fine, then:

$ proj -V
Rel. 6.1.0, September 1st, 2019
projection initialization failure
cause: no arguments in initialization list
program abnormally terminated

$ which proj

Installing GDAL:

In a second stage, I downloaded gdal from GitHub as well: https://github.com/OSGeo/gdal to build it from its master branch:

git clone https://github.com/OSGeo/gdal.git /opt/gdal
cd /opt/gdal/gdal
./configure --with-python=python3

The error:

And here is the tail of the result of the ./configure step in the terminal:

checking for PROJ >= 6 library... checking for proj_create_from_wkt in -lproj... no
checking for internal_proj_create_from_wkt in -lproj... no
checking for internal_proj_create_from_wkt in -linternalproj... no
configure: error: PROJ 6 symbols not found


Is there a special way to tell gdal where to find the previously installed proj in its version 6.x.x?
If yes, how?




The same error appears if I try with release 6.0.0 from OSGeo:
[ MD5 (proj-6.0.0.zip) = e0c6290f18852b963dabe5961c6f97d5 ]


Some time passed, I used the following as simple as possible procedure - using releases - to install GDAL and still encounter some error:

  1. Download and unzip PROJ release 6.2.0 from https://github.com/OSGeo/PROJ/releases.
  2. cd proj-6.2.0
    mkdir build && cd build
    cmake-gui [configure] and [generat] with default except I changed PYTHON_EXECUTABLE from /usr/bin/python to /usr/bin/python3
    make -j4
    sudo checkinstall

Everything went fine.

Then, GDAL: 1. Download and unzip GDAL release 3.1.0 from https://github.com/OSGeo/gdal/releases.
2. cd gdal-3.1.0
./configure --enable-shared --with-python=python3 --with-proj=/usr/local CXXFLAGS="-Wall -std=c++17"

=> Error:

...bunch of:
/opt/gdal-3.0.1/.libs/libgdal.so: undefined reference to `proj_stuff`
/opt/gdal-3.0.1/.libs/libgdal.so: undefined reference to `proj_crs_get_sub_crs'
/opt/gdal-3.0.1/.libs/libgdal.so: undefined reference to `proj_crs_get_coordinate_system'
/opt/gdal-3.0.1/.libs/libgdal.so: undefined reference to `proj_create_conversion_wagner_vi'
/opt/gdal-3.0.1/.libs/libgdal.so: undefined reference to `proj_coordoperation_get_param_index'
/opt/gdal-3.0.1/.libs/libgdal.so: undefined reference to `proj_coordoperation_get_param_count'
collect2: error: ld returned 1 exit status
GNUmakefile:82: recipe for target 'gdalinfo' failed
make[1]: *** [gdalinfo] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/opt/gdal-3.0.1/apps'
GNUmakefile:112: recipe for target 'apps-target' failed
make: *** [apps-target] Error 2


5 Answers 5


You are in the right track, but you need to inform gdal that you are using your own version of proj, rather than the one supplied with Ubuntu.

Up until gdal v2.4.1, you would do that by providing the --with-static-proj4= configure argument. However, it has been deprecated in gdal v3.0.0. As a result, you should now use the simpler --with-proj=.

Therefore, your configure command should look something like this:

./configure --with-python=python3 --with-proj=/usr/local

  • 4
    for me doesn't work, still complaining about proj6, I've downloaded the repo from wget download.osgeo.org/gdal/3.0.0/gdal-3.0.0.tar.gz I'm compiling with ./configure -with-pg=/usr/pgsql-10/bin/pg_config but even without it complains
    – DevWizard
    Commented Jun 18, 2019 at 8:46
  • @Sebastiano where did you install proj6 in your system? You should specify that path in the '--with-proj=' argument. You don't seem to be using that argument. Commented Jun 18, 2019 at 12:11
  • in some way I managed to install it, some problems with the cmake installation in Proj6 that they didn't appear in the log
    – DevWizard
    Commented Jun 18, 2019 at 12:57
  • Thanks for the hints, it looked good! But it didn't work with --with-proj=/usr/local from both a fresh install of PROJ and GDAL (see update in main question). Commented Oct 4, 2019 at 11:05

I was able to get this working with the CPPFLAGS and LDFLAGS variables. It looked something like this for me

CPPFLAGS=-I/path/to/proj/include LDFLAGS=-L/path/to/proj/lib ./configure --prefix=/install/gdal/here

  • for me brake everything if I do this
    – DevWizard
    Commented Jun 18, 2019 at 8:40

I ended up writing a bootstrap script to configure GDAL 3.0.1 with PROJ 6.2.0, GRASS 7.8.0, GEOS 3.8.0, PostGIS 3.0.0. The order of compilation was:

  1. PROJ
  2. GEOS
  3. GDAL (without GRASS)
  4. GRASS
  5. GDAL (with the configuration below)
  6. PostGIS

I ended up compiling many of the dependencies which is why the configure command is such a mess. I was testing a bunch of different databases, hence oci, mysql, and postgres (pg). The java install is not the stock Ubuntu so be careful if you need that functionality.

#!/usr/bin/env bash
# GDAL configuration script for Ubuntu 18.0.4
# Based upon https://grasswiki.osgeo.org/wiki/Compile_and_Install_Ubuntu

./configure \
  --with-python=/usr/local/bin/python3.8 \
  --with-crypto=yes \
  --with-opencl=yes \
  --with-geos=yes \
  --with-curl=/usr/bin/curl-config \
  --with-xml2=/usr/bin/xml2-config \
  --with-libkml=yes \
  --with-mysql=/usr/local/bin/mysql_config \
  --with-netcdf=/usr/local \
  --with-pcraster=internal \
  --with-pg=yes \
  --with-proj=/usr/local \
  --with-cryptopp=no \
  --with-java=/usr/lib/jvm/java-11-openjdk-amd64 \
  --with-libjson-c=internal \
  --with-libz=/usr/local \
  --with-hdf5=/usr/local \
  --with-expat=yes \
  --with-oci=yes \
  --with-oci-lib=/usr/local/lib/oracle/instantclient \
  --with-oci-include=/usr/local/lib/oracle/instantclient/sdk/include \
  --with-geotiff=yes \
  --with-grass=/usr/local/grass78 \
  --with-spatialite=yes \

I went through this process myself for a few hours. On the default location of my system an old version of proj was installed, which frustrated the installation of gdal. I downloaded latest version of proj (proj-6.2.0) and gdal (gdal-3.0.0) installed it in my preferred location using the "classical" way. (in the example below this is ${HOME}/usr/local). Assuming that the tar ball of the proj-6.2.0 and gdal-3.0.0 are located in the ${HOME}/Download then below follows the sequence of commands which worked for me. (Using ubuntu 18.08, note that the make process of the gdal-3.0.0 could take several hours depending on your system.):

export PREFIX=${HOME}/usr/local;
cd ${HOME}/Download/proj-6.2.0;
./configure --prefix=${PREFIX};
make install;
export PATH=${PREFIX}/bin:${PATH};
cd ${HOME}/Download/gdal-3.0.0;
CPPFLAGS=-I${PREFIX}/include LDFLAGS=-L${PREFIX}/lib ./configure --prefix=${PREFIX};
make ;
make install;

I wrote a GDAL build script some while ago which should contain all necessary steps. A lot of info can also be found on this page here. This should work:

./configure --with-static-proj4=/usr/local

I also read somewhere that building GDAL directly with its Python bindings is not recommended. You can find an alternative approach in the script.

  • those instruction from the link are a bit outdated it use proj 4 that is irrelevant as gdal needs proj 4 v6.
    – DevWizard
    Commented Jun 18, 2019 at 8:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.