wiki:BuildingOnUnixGDAL25dev

Starting with February 1st 2019, GDAL master (released as GDAL 3.0) requires to be built and run against PROJ master (which will be released as PROJ 6.0). This change is related to a deep refactoring of Coordinate Reference System support in GDAL and PROJ, as detailed in https://trac.osgeo.org/gdal/wiki/rfc73_proj6_wkt2_srsbarn

While there is in no difficulty in itself for building GDAL master against PROJ master, the reality is more complex. Users rarely build GDAL with PROJ as the only dependency, but they might also build it against other software packages (such as libspatialite), which in turn may link against PROJ themselves. If this other dependency is built against another PROJ version (typically the one coming from the distribution package manager), at runtime GDAL may effectively link against different version of PROJ, which will result in crashes. The clean solution is to rebuild all packages that depend on PROJ aganist PROJ master, but that might be impractical (PROJ.6 removes the old 'project.h' API that a few dependency might still use). A workaround, aimed at being temporary for the transition period before PROJ 6.0 becomes the baseline PROJ version, is to build PROJ in a special way, so that its symbols are renamed. PROJ master has such capability, and GDAL can use it;

The procedure is the following:

First build the special PROJ version

# install sqlite3 binary and libsqlite3 development packages if not done

git clone https://github.com/OSGeo/proj.4 proj
cd proj
./autogen.sh
export CFLAGS="-DPROJ_RENAME_SYMBOLS -O2"
export CXXFLAGS="$CFLAGS -DPROJ_INTERNAL_CPP_NAMESPACE"
./configure --prefix=/my/install/prefix --disable-static
make -j4
make install
cd /my/install/prefix/lib
# Rename the library to libinternalproj
mv libproj.so.19.1.0 libinternalproj.so.19.1.0
ln -s libinternalproj.so.19.1.0 libinternalproj.so.19
ln -s libinternalproj.so.19.1.0 libinternalproj.so
rm -f libproj.*
# Install the patchelf package
apt install patchelf
patchelf --set-soname libinternalproj.so libinternalproj.so

If it is an option regarding the constraints of your other development tasks, uninstalling the proj development package coming from your distribution is also suggested.

Then build GDAL

git clone https://github.com/OSGeo/gdal
cd gdal/gdal
export LD_LIBRARY_PATH=/my/install/prefix/lib:$LD_LIBRARY_PATH
./configure --without-libtool --with-proj=/my/install/prefix
make -j4
Last modified 3 years ago Last modified on Aug 26, 2021, 8:41:02 AM
Note: See TracWiki for help on using the wiki.