我是从源qt-base编译的。我构建了一个测试(tst_qdom),执行时出错。这是ldd:
的结果ldd tests / auto / xml / dom / qdom / tst_qdom
**tests/auto/xml/dom/qdom/tst_qdom: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: no version information available (required by tests/auto/xml/dom/qdom/tst_qdom)
tests/auto/xml/dom/qdom/tst_qdom: /usr/lib/x86_64-linux-gnu/libQt5Test.so.5: no version information available (required by tests/auto/xml/dom/qdom/tst_qdom)
tests/auto/xml/dom/qdom/tst_qdom: /usr/lib/x86_64-linux-gnu/libQt5Xml.so.5: no version information available (required by tests/auto/xml/dom/qdom/tst_qdom)**
linux-vdso.so.1 => (0x00007ffe5775f000)
libQt5Xml.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Xml.so.5 (0x00007f855e131000)
libQt5Test.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Test.so.5 (0x00007f855df08000)
libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007f855d862000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f855d55e000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f855d348000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f855cf83000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f855cd65000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f855cb4c000)
libicui18n.so.52 => /usr/lib/x86_64-linux-gnu/libicui18n.so.52 (0x00007f855c745000)
libicuuc.so.52 => /usr/lib/x86_64-linux-gnu/libicuuc.so.52 (0x00007f855c3cc000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f855c1c8000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f855bec0000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f855bcb8000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f855b9b2000)
/lib64/ld-linux-x86-64.so.2 (0x00007f855e36d000)
libicudata.so.52 => /usr/lib/x86_64-linux-gnu/libicudata.so.52 (0x00007f855a145000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f8559f07000)
有人知道如何解决这个问题吗?谷歌搜索对我没用。
这是tst_qdom的编译命令:
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_TSLIB -DQT_NO_LIBINPUT -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_XML_LIB -DQT_TESTLIB_LIB -DQT_CORE_LIB -DQT_TESTCASE_BUILDDIR='"/home/pe/qtbase/tests/auto/xml/dom/qdom"' -I. -I../../../../../include -I../../../../../include/QtXml -I../../../../../include/QtTest -I../../../../../include/QtCore -I.moc -I../../../../../mkspecs/linux-g++ -o .obj/tst_qdom.o tst_qdom.cpp
g++ -Wl,-O1 -fuse-ld=gold -Wl,--enable-new-dtags -Wl,-rpath,/usr/local/Qt-5.7.0/lib -o tst_qdom .obj/tst_qdom.o -L/home/pe/qtbase/lib -lQt5Xml -lQt5Test -lQt5Core -lpthread
答案 0 :(得分:3)
感谢@Marco我找到了解决方案。他说将LD_LIBRARY_PATH设置为/usr/local/Qt-5.7.0/lib。但是,当我将LD_LIBRARY_PATH设置为/ home / pe / qtbase / lib /(我编译的版本的lib目录)并导出变量时,问题得以解决:
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/pe/qtbase/lib; export LD_LIBRARY_PATH
希望这能帮助将来的某个人并再次感谢Marco。
答案 1 :(得分:3)
你可以进行永久编辑〜/ .bashrc并包含以下行
export LD_LIBRARY_PATH='/home/pe/qtbase/lib':$LD_LIBRARY_PATH;
或在
中做同样的事情/etc/bash.bashrc这对所有用户来说都是永久性的!
答案 2 :(得分:2)
根据以下示例
在bashrc
中进行一些更改
export LD_LIBRARY_PATH=/path/to/QT/gcc_64/lib/:$LD_LIBRARY_PATH