码迷,mamicode.com
首页 > 其他好文 > 详细

尝试安装PyQt5失败

时间:2014-12-17 22:48:19      阅读:358      评论:0      收藏:0      [点我收藏+]

标签:des   ar   io   os   sp   on   文件   bs   cti   

卡在:编译 qtbase/src/gui/image/qpnghandler.cpp时报错:

.obj/qpnghandler.o: In function `QPngHandlerPrivate::readPngHeader()‘:
qpnghandler.cpp:(.text+0xbe2): undefined reference to `png_set_longjmp_fn‘
.obj/qpnghandler.o: In function `QPNGImageWriter::writeImage(QImage const&, int, QString const&, int, int)‘:
qpnghandler.cpp:(.text+0x273b): undefined reference to `png_set_longjmp_fn‘
.obj/qpnghandler.o: In function `QPngHandlerPrivate::readPngImage(QImage*)‘:
qpnghandler.cpp:(.text+0x30cc): undefined reference to `png_set_longjmp_fn‘
collect2: ld returned 1 exit status

我以为是没有加-lpng库,在Makefile中添加了 -lpng,结果还是没能解决。

打开qtbase/src/gui/image/qpnghandler.cpp文件:

#if PNG_LIBPNG_VER >= 10400 && PNG_LIBPNG_VER <= 10502         && defined(PNG_PEDANTIC_WARNINGS_SUPPORTED)
/*
    Versions 1.4.0 to 1.5.2 of libpng declare png_longjmp_ptr to
    have a noreturn attribute if PNG_PEDANTIC_WARNINGS_SUPPORTED
    is enabled, but most declarations of longjmp in the wild do
    not add this attribute. This causes problems when the png_jmpbuf
    macro expands to calling png_set_longjmp_fn with a mismatched
    longjmp, as compilers such as Clang will treat this as an error.

    To work around this we override the png_jmpbuf macro to cast
    longjmp to a png_longjmp_ptr.
*/
#   undef png_jmpbuf
#   ifdef PNG_SETJMP_SUPPORTED
#       define png_jmpbuf(png_ptr)             (*png_set_longjmp_fn((png_ptr), (png_longjmp_ptr)longjmp, sizeof(jmp_buf)))
#   else
#       define png_jmpbuf(png_ptr)             (LIBPNG_WAS_COMPILED_WITH__PNG_NO_SETJMP)
#   endif
#endif

这该怎么处理呀?

如下为调用到 png_jmpbuf 的地方:

    if (setjmp(png_jmpbuf(png_ptr))) {
        png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
        png_ptr = 0;
        amp.deallocate();
        state = Error;
        return false;
    }












尝试安装PyQt5失败

标签:des   ar   io   os   sp   on   文件   bs   cti   

原文地址:http://my.oschina.net/hevakelcj/blog/357396

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!