<div dir="ltr">I submitted a ticket there <a href="http://trac.osgeo.org/gdal/ticket/5204">http://trac.osgeo.org/gdal/ticket/5204</a> for the macros.<div><br></div><div>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</div>

</div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/8/19 Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@mines-paris.org" target="_blank">even.rouault@mines-paris.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Selon Olivier BARTHELEMY <<a href="mailto:barthelemy@geovariances.com">barthelemy@geovariances.com</a>>:<br>
<div><div class="h5"><br>
> I'm having a strange error when Gdal uses libpng<br>
><br>
> Environment :<br>
> x86-64 linux<br>
> gdal 1.10<br>
> libpng 1.6.2<br>
><br>
> I am getting the following message :<br>
><br>
> GDAL (CPLE_NotSupported): The PNG driver failed to in<br>
> png_create_read_struct().<br>
> This may be due to version compatibility problems.<br>
><br>
> which is in this snippet in pngdataset.cpp:<br>
><br>
> #if LIBPNG_VER_MINOR >= 2 || LIBPNG_VER_MAJOR > 1<br>
>         int version = png_access_version_number();<br>
>         CPLError( CE_Failure, CPLE_NotSupported,<br>
>                   "The PNG driver failed to access libpng with version<br>
> '%s',"<br>
>                   " library is actually version '%d'.\n",<br>
>                   PNG_LIBPNG_VER_STRING, version);<br>
> #else<br>
>         CPLError( CE_Failure, CPLE_NotSupported,<br>
>                   "The PNG driver failed to in png_create_read_struct().\n"<br>
>                   "This may be due to version compatibility problems." );<br>
> #endif<br>
><br>
> If i understand correctly, if i get the second messsage, that is supposed<br>
> to mean that pngdataset.cpp was compiled with a libpng older than 1.2, or<br>
> that the macros don't exist (#if takes a value of 0 if a macro name is not<br>
> found)<br>
><br>
> I compiled my GDAl with libpng 1.6.2, and ldd properly tells me that it's<br>
> this version GDAL tries to link to<br>
><br>
> I think i don't get the first message because, at least for png 1.5 and 1.6<br>
> ( and even the v1.2 shipped with gdal ), LIBPNG_VER_MINOR  and<br>
> LIBPNG_VER_MAJOR are not in png.h. Instead, there are PNG_LIBPNG_VER_MINOR<br>
>  and PNG_LIBPNG_VER_MAJOR. So the code should also try to look for those<br>
> macros<br>
<br>
</div></div>Yes, there's an issue in this code (could you file a ticket in GDAL Trac about<br>
that ?). But the consequence is only on the error message, not on the error that<br>
caused this code path to be reached.<br>
<br>
My assumption is that you've built a first time pngdataset.cpp against the GDAL<br>
internal libpng (1.2), and then configured later with your external libpng 1.6<br>
but pngdataset.cpp didn't get recompiled. So at runtime there's a mismatch.<br>
<br>
Try cleaning (or just "touch frmts/png/pngdataset.cpp") before rebuilding GDAL.<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
> As to why i am reaching this code, i couldn't find if GDAL is compatible<br>
> with libPNG 1.6, could you confirm it? I successfully build with it on<br>
> windows and linux; it works on widowns (and might have previously worked on<br>
> linux, before i recompiled gdal to add the python module)<br>
><br>
> --<br>
> Olivier BARTHELEMY<br>
><br>
<br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Olivier BARTHELEMY</div>
</div>