[gdal-dev] report proj4 version to which gdal is linked?

Even Rouault even.rouault at spatialys.com
Fri Nov 24 02:12:01 PST 2017


On vendredi 24 novembre 2017 02:37:11 CET Roger Bivand wrote:
> I've looked in ogr/ogrct.cpp, but cannot see that the proj4 version that is
> detected internally is exposed for reporting through a function in the API.
> It would be convenient if GDAL could report versions of some of its
> dependencies. Checks for GDAL built with or without GEOS are now in R sf and
> rgdal packages, because some drivers behave differently if GDAL was built
> with or without GEOS (but not the GEOS version, which may matter for static
> builds), We'd like to report the proj4 version used to build GDAL too, and
> would value advice. This will become critical shortly, with the forthcoming
> release of proj4 5.0.0, which uses a different API. There is going to be a
> lot of muddle, so being able to check will be helpful for many. 

There are 2 different notions :
- the proj version used at compile time
- the proj version used at link time

proj 4.X only offers the PJ_VERSION macro, so you can only detect the compile time version. 

GDAL has currently 2 modes to support proj:
- classic mode where you build against proj headers and link the GDAL shared object against 
the proj shared object at build time. In that mode, currently,we could potentially report 
PJ_VERSION
- full dynamic mode where there's no build requirement and at runtime you dlopen proj. In 
that mode, currently, it is really hard to know which proj version we end up linking against 
(you can make some guess depending on which symbols are available...)

proj 5 will have compile time PROJ_VERSION_ macros, and a proj_info() function giving the 
version at runtime.

A few months before, I proposed to drop the support for the "full dynamic mode" as it makes 
code messy. This didn't make concensus at that time, so I dropped the ball for now. But for 
proj 5 support, I think we really need to get rid of the full dynamic mode.

If proj 5 still supports the old proj_api.h (which seems to be the direction), as soon as it will 
be released, we could probably make proj 5 the minimum version for a proj-enabled GDAL 
build (since other components of the ecosystem depending on proj 4 API will still work), so as 
to avoid supporting 2 different APIs. Well, maybe this is a bold move, and perhaps still 
supporting proj 4 classic mode will not be that hard, but I definitly don't want to have to 
support "proj 4 classic mode" + "proj 4 full dynamic mode" + "proj 5 classic mode".

> Should I
> file a trac request?

You may

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20171124/f3e590a7/attachment.html>


More information about the gdal-dev mailing list