6

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]
make
$ sudo checkinstall

Everything went fine, then:

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

$ which proj
/usr/local/bin/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
./autogen.sh
./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

Questions:

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

Documentation:

https://proj4.org/install.html#cmake
https://trac.osgeo.org/gdal/wiki/BuildingOnUnix
http://osgeo-org.1560.x6.nabble.com/gdal-dev-PROJ6-td5393781.html
https://trac.osgeo.org/gdal/wiki/rfc73_proj6_wkt2_srsbarn

Updates:

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

[2019-10-04]

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"
make

=> 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

3

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

  • 1
    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 – Sebastiano Jun 18 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. – thiagoveloso Jun 18 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 – Sebastiano Jun 18 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). – s.k Oct 4 at 11:05
2

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 – Sebastiano Jun 18 at 8:40
1

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. – Sebastiano Jun 18 at 8:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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