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:
- Download and unzip PROJ release 6.2.0 from https://github.com/OSGeo/PROJ/releases.
cd proj-6.2.0
mkdir build && cd build
cmake-gui
[configure] and [generat] with default except I changedPYTHON_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
Best Answer
You are in the right track, but you need to inform
gdal
that you are using your own version ofproj
, 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 ingdal
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