【问题标题】:Errors while linking in Qt5 with poppler在 Qt5 中使用 poppler 链接时出错
【发布时间】:2015-03-28 15:30:54
【问题描述】:

/usr/lib/libpoppler.so.50:未定义对std::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20' Makefile:156: recipe for target 'DocViewer' failed /usr/lib/libsystemd.so.0: undefined reference tolzma_stream_decoder@XZ_5.0' 的引用 /usr/lib/libQt5Core.so:对__cxa_throw_bad_array_new_length@CXXABI_1.3.8' /usr/lib/libsystemd.so.0: undefined reference tolzma_end@XZ_5.0' 的未定义引用 /usr/lib/libsystemd.so.0:未定义的对“lzma_code@XZ_5.0”的引用 collect2:错误:ld 返回 1 个退出状态 make: *** [DocViewer] 错误 1 20:53:35:进程“/usr/bin/make”退出,代码为 2。

Qt5 中使用poppler 编译程序时出现上述错误。

下面是我的项目文件,应该改一下吗?

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = DocViewer
TEMPLATE = app

INCLUDEPATH  += /usr/include/poppler/qt5
LIBS         += -L/usr/lib -lpoppler-qt5

SOURCES += main.cpp\
        mainwindow.cpp

HEADERS  += mainwindow.h

FORMS    += mainwindow.ui

【问题讨论】:

  • 看起来-llzma 也不见了。
  • LIBS += -L/usr/lib -lpoppler-qt5 -llzma 是这样的吗?
  • 是的。但是还有关于std::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20 的其他链接器错误。
  • 会不会和我系统上安装的glibc版本有关。
  • 很可能是个问题,是的。尝试安装实际的 GCC 4.9.2。

标签: c++ linux qt5 poppler


【解决方案1】:

对于 libicu 中的“__cxa_throw_bad_array_new_length@CXXABI_1.3.8”错误,看起来问题是不兼容的 icu 构建(softfp 与 hardfp)。

我遇到了同样的错误,我通过下载重建的 ICU 解决了这个错误(以避免自己重建它)。

  • 从以下位置下载“POT”二进制文件 http://thebugfreeblog.blogspot.fr/2016/12/binaries-for-pot-550-beta1-on-qt-580.html
  • lrzuntar 文件
  • tar xf qtdeps.tar
  • 在设备上,移开 libicu*(在我的 raspbian 中,它位于 usr/lib/arm-linux-gnueabihf 中),然后将 libicu* 从 qtdeps 转移到那里
  • 在设备上,移开“unicode”包含目录(对于 raspbian,它位于 /usr/include/arm-linux-gnueabihf/unicode),然后从 qtdeps 复制 unicode 包含目录。
  • 使用 rsync 从设备重新同步到您的 sysroot
  • 重新配置并重建 qtbase(在删除 qtbase/src/corelib 下名称中包含“icu”的 .o 文件之后 - 或从头开始重建 Qt)

【讨论】:

    猜你喜欢
    • 2014-04-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多