I submitted a ticket there http://trac.osgeo.org/gdal/ticket/5204 for the macros.
About my issue, it turns out i had not added --with-png=...., so the compile step used the system's libpng 1.2.10. But my LD_LIBRARY_PATH must have pointed to the directory of my libpng1.6.16, so the code compiled with 1.2 headers was linked to use 1.6.2 library , which is what i saw with ldd 2013/8/19 Even Rouault <[email protected]> > Selon Olivier BARTHELEMY <[email protected]>: > > > 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 > > Yes, there's an issue in this code (could you file a ticket in GDAL Trac > about > that ?). But the consequence is only on the error message, not on the > error that > caused this code path to be reached. > > My assumption is that you've built a first time pngdataset.cpp against the > GDAL > internal libpng (1.2), and then configured later with your external libpng > 1.6 > but pngdataset.cpp didn't get recompiled. So at runtime there's a mismatch. > > Try cleaning (or just "touch frmts/png/pngdataset.cpp") before rebuilding > GDAL. > > > > > 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 > > > > > -- Olivier BARTHELEMY
_______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
