On my RedHat 7 Linux machine (gcc 4.8.3), I have png-dev (1.6.25) installed.
Trying to build the plotutils-2.6 (I checked it was last updated 2009).
./configure successuful. Problem at make step with error:
gcc -DHAVE_CONFIG_H -I. -I.. -I./../include -DLIBPLOT -O2 -MT z_write.lo -MD -MP -MF .deps/z_write.Tpo -c z_write.c -fPIC -DPIC -o .libs/z_write.o
In file included from /usr/local/include/pngconf.h:50:0,
from /usr/local/include/png.h:371,
from z_write.c:43:
z_write.c: In function '_pl_z_maybe_output_image':
z_write.c:167:22: error: dereferencing pointer to incomplete type
if (setjmp (png_ptr->jmpbuf))
^
z_write.c: In function '_our_error_fn_stdio':
z_write.c:447:19: error: dereferencing pointer to incomplete type
longjmp (png_ptr->jmpbuf, 1);
^
Question number 1: Is the plotutils library still actively maintained? If not, is there an alternative for C++ programmers?
Do any of you encountered this problem before and fixed it?
I figured out the source of the problem. The answer is provided in: http://www.libpng.org/pub/png/src/libpng-1.2.x-to-1.4.x-summary.txt.
d. Direct access to png_ptr->jmpbuf has been deprecated since libpng
version 1.0.6, and libpng now generates a warning about it.
To avoid such warnings, change
setjmp(png_ptr->jmpbuf)
to
setjmp(png_jmpbuf(png_ptr))
The libplot/z_write.c file in the plotutils library needs to be updated:
at line 167:
/*if (setjmp (png_ptr->jmpbuf)) */
if (setjmp (png_jmpbuf(png_ptr)))
line 448:
/*longjmp (png_ptr->jmpbuf, 1); Kemin changed this*/
longjmp(png_jmpbuf(png_ptr), 1);
These two fixes made the compiler happy. If you want the plotutils to work with png 1.2 or earlier without code-editing, you can use conditional compilation based on the version of the png library. The question remains, is the plotutils actively maintained?