[gdal-dev] LibPNG compatibility issue

Olivier BARTHELEMY barthelemy at geovariances.com
Mon Aug 19 03:21:55 PDT 2013


I'm having a strange error when Gdal uses libpng

Environment :
x86-64 linux
gdal 1.10
libpng 1.6.2

I am getting the following message :

GDAL (CPLE_NotSupported): The PNG driver failed to in
png_create_read_struct().
This may be due to version compatibility problems.

which is in this snippet in pngdataset.cpp:

#if LIBPNG_VER_MINOR >= 2 || LIBPNG_VER_MAJOR > 1
        int version = png_access_version_number();
        CPLError( CE_Failure, CPLE_NotSupported,
                  "The PNG driver failed to access libpng with version
'%s',"
                  " library is actually version '%d'.\n",
                  PNG_LIBPNG_VER_STRING, version);
#else
        CPLError( CE_Failure, CPLE_NotSupported,
                  "The PNG driver failed to in png_create_read_struct().\n"
                  "This may be due to version compatibility problems." );
#endif

If i understand correctly, if i get the second messsage, that is supposed
to mean that pngdataset.cpp was compiled with a libpng older than 1.2, or
that the macros don't exist (#if takes a value of 0 if a macro name is not
found)

I compiled my GDAl with libpng 1.6.2, and ldd properly tells me that it's
this version GDAL tries to link to

I think i don't get the first message because, at least for png 1.5 and 1.6
( and even the v1.2 shipped with gdal ), LIBPNG_VER_MINOR  and
LIBPNG_VER_MAJOR are not in png.h. Instead, there are PNG_LIBPNG_VER_MINOR
 and PNG_LIBPNG_VER_MAJOR. So the code should also try to look for those
macros

As to why i am reaching this code, i couldn't find if GDAL is compatible
with libPNG 1.6, could you confirm it? I successfully build with it on
windows and linux; it works on widowns (and might have previously worked on
linux, before i recompiled gdal to add the python module)

-- 
Olivier BARTHELEMY
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130819/d6ebae90/attachment.html>


More information about the gdal-dev mailing list