Opened 13 years ago

Closed 12 years ago

#1347 closed defect (fixed)

r.out.png uses now hidden libpng structs

Reported by: kyngchaos Owned by: grass-dev@…
Priority: major Milestone: 6.4.2
Component: Raster Version: 6.4.1
Keywords: png Cc:
CPU: Unspecified Platform: Unspecified

Description

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.

The png driver didn't have any errors.

Change History (10)

in reply to:  description comment:1 by hamish, 13 years ago

Replying to 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.

http://www.libpng.org/pub/png/src/libpng-1.2.x-to-1.4.x-summary.txt

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.

Hamish

comment:2 by hamish, 13 years ago

oops, the fns in the last msg were already taken care of in grass source.

as for moving png_info from png.h to pnginfo.h, see changelog starting

http://libpng.git.sourceforge.net/git/gitweb.cgi?p=libpng/libpng;a=blob;f=CHANGES;h=fb069121a45024e4904e7f4ea0636f183b7ec350;hb=refs/tags/v1.5.2#l2663

I guess we need to set up some #ifdefs based on PNG_LIBPNG_VER_MAJOR == 1 and PNG_LIBPNG_VER_MINOR >= 5

but I'm not sure how the libpng15 version should look yet.

Hamish

comment:3 by kyngchaos, 13 years ago

I was generalizing the version to imply it was a major version upgrade, 1.5.x. But yes, I do have 1.5.2.

Maybe for a quick fix I could #include that pnginfo.h from my libpng source just to get r.out.png compiled?

in reply to:  2 ; comment:4 by glynn, 13 years ago

Replying to hamish:

I guess we need to set up some #ifdefs based on PNG_LIBPNG_VER_MAJOR == 1 and PNG_LIBPNG_VER_MINOR >= 5

I think that we should just switch to using the new API. I doubt that anyone is still using libpng 0.9x.

in reply to:  4 ; comment:5 by hamish, 13 years ago

Replying to glynn:

I think that we should just switch to using the new API. I doubt that anyone is still using libpng 0.9x.

actually all the 0.9x stuff is already "#ifdef OLDPNG"'d out.

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)

Hamish

in reply to:  5 comment:6 by glynn, 13 years ago

Replying to hamish:

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.

comment:7 by volter, 12 years ago

Version: 6.4.06.4.1

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?

in reply to:  7 comment:8 by glynn, 12 years ago

Replying to 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.

comment:9 by volter, 12 years ago

Brilliant, seems to work. Thank you!

comment:10 by neteler, 12 years ago

Resolution: fixed
Status: newclosed

Backported in r49345 and r49346. Closing.

Note: See TracTickets for help on using tickets.