未明确引用`dlsym'

时间:2017-05-05 23:21:12

标签: qt raspberry-pi cross-compiling

我试图在Debian Stretch下为raspberry PI 3交叉编译QT但是当我使用make -j4编译QT时,它会出现以下错误:

$ make -j4>log
/home/charlie/Rpi/qt5/qtbase/lib/libQt5EglSupport.a(qeglplatformcontext.o): In function `QEGLPlatformContext::getProcAddress(char const*)':
qeglplatformcontext.cpp:(.text+0xa4): undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
make[5]: *** [../../../../plugins/platforms/libqminimalegl.so] Error 1
make[4]: *** [sub-minimalegl-make_first] Error 2
make[4]: *** Waiting for unfinished jobs....
/home/charlie/Rpi/qt5/qtbase/lib/libQt5EglSupport.a(qeglplatformcontext.o): In function `QEGLPlatformContext::getProcAddress(char const*)':
qeglplatformcontext.cpp:(.text+0xa4): undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
make[6]: *** [../../../../lib/libQt5EglFSDeviceIntegration.so.5.8.1] Error 1
make[5]: *** [sub-eglfsdeviceintegration-pro-make_first-ordered] Error 2
make[4]: *** [sub-eglfs-make_first] Error 2
make[3]: *** [sub-platforms-make_first] Error 2
make[2]: *** [sub-plugins-make_first] Error 2
make[1]: *** [sub-src-make_first] Error 2
make: *** [module-qtbase-make_first] Error 2

我已经阅读了很多类似的帖子,其中包含相同的dlsym错误,我已经尝试了其中给出的解决方案,但到目前为止还没有运气。我继续进行,因为它显示在here中,直到现在我仍然怀疑lib目录中的符号链接。

当我运行sudo file * | grep broken时,即使在运行了应该修复符号链接的脚本(如sudo)之后,也会报告2个符号链接被破坏。

./fixQualifiedLibraryPaths /mnt/raspberry-rootfs/ ~/Rpi/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc

下面列出了似乎被破坏的符号链接:

libblas.so.3gf:                     broken symbolic link to /etc/alternatives/libblas.so.3gf
liblapack.so.3gf:                   broken symbolic link to /etc/alternatives/liblapack.so.3gf

./configure执行如下:

./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/Rpi/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/raspberry-rootfs -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi -hostprefix /usr/local/qt5pi

你们能指出我正在做什么吗?

PD:我还安装了libncurses5和lib32z1,我通过git cloning获得了qt。

4 个答案:

答案 0 :(得分:2)

我遇到了同样的问题,正如你所做的那样继续使用gcc-5.4.1-linaro-gnueabihf工具链。不幸的是我没有找到根本原因,但是解决方法是调用configure

LIBS=-ldl ./configure ...

答案 1 :(得分:2)

挂载到主机时符号链接被破坏,

$ cd /mnt/raspberry-rootfs/usr/lib/arm-linux-gnueabihf/
$ sudo rm libdl.so 
$ sudo ln -s ../../../lib/arm-linux-gnueabihf/libdl.so.2 libdl.so

答案 2 :(得分:1)

with raspbian stretch egl libs有不同的名字

/opt/vc/lib/libEGL.so - > /opt/vc/lib/libbrcmEGL.so

/opt/vc/lib/libGLESv2.so - > /opt/vc/lib/libbrcmGLESv2.so

所以,我在Qt源代码中编辑了这个文件:

./ qtbase / mkspecs /装置/ Linux的锉刀-PI3-G ++ / qmake.conf 并改变了

-lEGL -lGLESv2

-lbrcmEGL -lbrcmGLESv2

答案 3 :(得分:1)

我遇到了同样的问题,试图遵循 Miguel Angel Pons 的解决方案,但后来意识到错过了更新我的树莓派:

sudo rpi-update

解来自https://wiki.qt.io/RaspberryPi2EGLFS#Step_by_step。它引用了 https://bugreports.qt.io/browse/QTBUG-62216 并且应该准确地修复编译器抱怨的库。

之后我重复了8、9步,清理了源码树,重新配置,终于成功构建了raspberry的qt。

相关问题