您尚未登录。

楼主 # 2024-07-19 11:56:07

memory
会员
注册时间: 2021-08-11
已发帖子: 487
积分: 464

奇怪,这个buildroot Qt5依赖的库路径好神奇

$ /opt/A133/buildroot/buildroot-20200212-Qt/output/host/bin/aarch64-linux-gnu-objdump -x qopenglwindow/qopenglwindow |grep NEED
  NEEDED               libatomic.so.1
  NEEDED               libQt5Gui.so.5
  NEEDED               libQt5Core.so.5
  NEEDED               /opt/A133/buildroot/buildroot-20200212-Qt/output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/libGLESv2.so
  NEEDED               /opt/A133/buildroot/buildroot-20200212-Qt/output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/libGLESv1_CM.so
  NEEDED               libpthread.so.0
  NEEDED               librt.so.1
  NEEDED               libdl.so.2
  NEEDED               libstdc++.so.6
  NEEDED               libm.so.6
  NEEDED               libgcc_s.so.1
  NEEDED               libc.so.6
  VERNEED              0x0000000000403540
  VERNEEDNUM           0x0000000000000004

QQ截图20240719115454.png

离线

楼主 #1 2024-07-19 17:31:53

memory
会员
注册时间: 2021-08-11
已发帖子: 487
积分: 464

Re: 奇怪,这个buildroot Qt5依赖的库路径好神奇

不知道是不是buildroot的eglfs的bug,生成的elf都是依赖绝对路径

找到patchelf 命令可以直接修改elf文件:

patchelf --replace-needed /opt/A133/buildroot/buildroot-20200212-Qt/output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/libGLESv2.so libGLESv2.so qopenglwindow/qopenglwindow

patchelf --replace-needed /opt/A133/buildroot/buildroot-20200212-Qt/output/host/aarch64-buildroot-linux-gnu/sysroot/usr/lib/libGLESv1_CM.so libGLES_CM.so qopenglwindow/qopenglwindow

看结果:

$ /opt/A133/buildroot/buildroot-20200212-Qt/output/host/bin/aarch64-linux-gnu-objdump -x /opt/A133/buildroot/buildroot-20200212-Qt/output/build/qt5base-5.12.9/examples/opengl/qopenglwindow/qopenglwindow |grep NEED
  NEEDED               libatomic.so.1
  NEEDED               libQt5Gui.so.5
  NEEDED               libQt5Core.so.5
  NEEDED               libGLESv2.so
  NEEDED               libGLES_CM.so
  NEEDED               libpthread.so.0
  NEEDED               librt.so.1
  NEEDED               libdl.so.2
  NEEDED               libstdc++.so.6
  NEEDED               libm.so.6
  NEEDED               libgcc_s.so.1
  NEEDED               libc.so.6
  VERNEED              0x0000000000403540
  VERNEEDNUM           0x0000000000000004

参考: https://forum.qt.io/topic/101590/absolute-paths-to-egl-library-in-libqt5gui-so-since-qt-5-12-1/13

离线

楼主 #2 2024-07-19 17:34:16

memory
会员
注册时间: 2021-08-11
已发帖子: 487
积分: 464

Re: 奇怪,这个buildroot Qt5依赖的库路径好神奇

这里有人提出同样的问题:

The output of readelf shows this issue:
$ arm-linux-gnueabihf-readelf -a qtbase/lib/libQt5Gui.so | grep "Shared library"
readelf: Warning: [ 9]: Info field (0) should index a relocatable section.
0x00000001 (NEEDED) Shared library: [libQt5Core.so.5]
0x00000001 (NEEDED) Shared library: [libpthread.so.0]
0x00000001 (NEEDED) Shared library: [/home/developer/proyectos/Odroid/RootFS/usr/lib/arm-linux-gnueabihf/libGLESv2.so]
0x00000001 (NEEDED) Shared library: [/home/developer/proyectos/Odroid/RootFS/usr/lib/arm-linux-gnueabihf/libEGL.so]
0x00000001 (NEEDED) Shared library: [libpng16.so.16]
0x00000001 (NEEDED) Shared library: [libz.so.1]
0x00000001 (NEEDED) Shared library: [libstdc++.so.6]
0x00000001 (NEEDED) Shared library: [libm.so.6]
0x00000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x00000001 (NEEDED) Shared library: [libc.so.6]

I've seen something related to this issue in QTBUG-7290

https://forum.qt.io/topic/104015/cross-compilation-generates-full-paths-in-libqt5gui-so-for-libglesv2-so-and-libgl-so-then-cannot-be-found-in-execution-time

https://forum.qt.io/topic/101590/absolute-paths-to-egl-library-in-libqt5gui-so-since-qt-5-12-1

离线

楼主 #3 2024-07-19 17:54:18

memory
会员
注册时间: 2021-08-11
已发帖子: 487
积分: 464

Re: 奇怪,这个buildroot Qt5依赖的库路径好神奇

跟踪了一下,貌似 so 文件缺 SONAME 节点引起:

$ /opt/A133/buildroot/buildroot-20200212-Qt/output/host/bin/aarch64-linux-gnu-readelf -d ./output/build/sunxi-mali-mainline-d691cb93884ca8ac67860502117bbec283dc19aa/r6p2/arm64/fbdev/libGLESv2.so |grep SONAME
$
$
$ /opt/A133/buildroot/buildroot-20200212-Qt/output/host/bin/aarch64-linux-gnu-readelf -d /opt/A133/tina4/package/libs/libgpu/ge8300/fbdev/glibc/lib64/libGLESv2.so |grep SONAME
 0x000000000000000e (SONAME)             Library soname: [libGLESv2.so.2]
$
$

离线

楼主 #4 2024-07-23 09:50:11

memory
会员
注册时间: 2021-08-11
已发帖子: 487
积分: 464

Re: 奇怪,这个buildroot Qt5依赖的库路径好神奇

搞定了,换另外一套带SONAME节点的so文件库就好了。

另外一个解决办法,给这些so文件用patchelf手动打上SONAME也可以解决,但是我没有测试。

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn