#1347: r.out.png uses now hidden libpng structs
-------------------------+--------------------------------------------------
Reporter: kyngchaos | Owner: grass-dev@…
Type: defect | Status: new
Priority: major | Milestone: 6.4.2
Component: Raster | Version: 6.4.0
Keywords: png | Platform: Unspecified
Cpu: Unspecified |
-------------------------+--------------------------------------------------
Just my luck - I upgrade to libpng 1.5 ''after'' the GRASS 6.4.1 release.
libpng 1.5 does not include the png_info struct (and others) in the png.h
header, it's now in a private pnginfo.h. r.out.png needs this. I didn't
see any option in libpng compilation to install these new headers.
Compilation fails with
{{{
r.out.png.c: In function ‘main’:
r.out.png.c:264: error: dereferencing pointer to incomplete type
r.out.png.c:265: error: dereferencing pointer to incomplete type
r.out.png.c:266: error: dereferencing pointer to incomplete type
r.out.png.c:306: error: dereferencing pointer to incomplete type
r.out.png.c:308: error: dereferencing pointer to incomplete type
}}}
Note also that png.h does not include zlib.h now (as the #include png.h in
pngfunc.h currently says). I didn't get an error about this in r.out.png
(yet), but I have had an error in other projects.
Replying to [ticket:1347 kyngchaos]:
> Just my luck - I upgrade to libpng 1.5
apparently 1.5.0 was buggy, make sure you have 1.5.1+.
> libpng 1.5 does not include the png_info struct (and others)
> in the png.h header, it's now in a private pnginfo.h. r.out.png
> needs this. I didn't see any option in libpng compilation to
> install these new headers.
{{{
2. Some obsolete/deprecated macros and functions have been removed.
...
f. We removed the functions png_read_init(info_ptr),
png_write_init(info_ptr), png_info_init(info_ptr),
png_read_destroy(), and png_write_destroy().
They have been deprecated since libpng-0.95.
}}}
> the trouble in this bug is libpng taking formerly public header files
and making them private in various stages between versions 1.3 and 1.5.
(afaiu)
The only header we use is <png.h>. The issue is that the structure
definitions have finally been removed from png.h, so applications need to
use the appropriate functions rather than manipulating structure fields
directly or allocating the structures as local variables.
There shouldn't be any need for conditional compilation (#ifdef). The new
(non-deprecated) API has been around long enough that we can take it for
granted.
Replying to [comment:7 volter]:
> I just ran into this issue, trying to build 6.4.1 for Fedora rawhide,
that also has libpng 1.5. Is there a quick fix I could use?
Try back-porting r43927.