简体   繁体   English

png 1.6.25 的 plotutils 编译错误:取消引用指向不完整类型的指针

[英]plotutils compilation error with png 1.6.25: dereferencing pointer to incomplete type

On my RedHat 7 Linux machine (gcc 4.8.3), I have png-dev (1.6.25) installed.在我的 RedHat 7 Linux 机器 (gcc 4.8.3) 上,我安装了 png-dev (1.6.25)。
Trying to build the plotutils-2.6 (I checked it was last updated 2009).尝试构建 plotutils-2.6(我检查了它上次更新的是 2009 年)。 ./configure successuful. ./配置成功。 Problem at make step with error: make 步骤中出现错误的问题:

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?问题 1:plotutils 库是否仍在积极维护? If not, is there an alternative for C++ programmers?如果没有,是否有 C++ 程序员的替代方案?

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 .答案在: http : //www.libpng.org/pub/png/src/libpng-1.2.x-to-1.4.x-summary.txt

Quote from the link来自链接的报价

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: plotutils 库中的 libplot/z_write.c 文件需要更新:

at line 167:在第 167 行:

/*if (setjmp (png_ptr->jmpbuf)) */
if (setjmp (png_jmpbuf(png_ptr)))

line 448:第 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.如果您希望 plotutils 在没有代码编辑的情况下使用 png 1.2 或更早版本,您可以使用基于 png 库版本的条件编译。 The question remains, is the plotutils actively maintained?问题仍然存在,是否积极维护了 plotutils?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM