QT5.7 How to deploy Qt Application on Linux

会有一股神秘感。 提交于 2019-12-25 12:44:44

问题


I'm trying to make a distributable linux Qt application. It will build run and install on the machine i've built it on AND on another machine (without Qt) that's the exact same version, but not others.

I'm currently building on Ubuntu 16, but on 15 and 14 it will segfault (somewhere in libc.so.6).

I use QtCreator to create a QtQuick Controls 2 application. It will automatically generate a sample with two clickable buttons. This is my test.

As i understand it, there is no linuxdeployqt (unfortunately).

So i copy all the Qt dependencies myself, including all the QML and .so files required. I make a qt.conf file to describe the paths where i've put everything.

The fact that this works on another Ubuntu 16 machine without a QT installation must mean i have everything I need correctly configured and in the right place.

This is a dynamically built application and not statically linked.

I suspect that the problem is to so (somehow) with incompatible versions of .so files. To that effect i trace the loading of the .so files on the machine that doesn't work (eg Ubuntu 15).

here's the trace, using

export LA_LIBRARY_PATH=$dirname/helloworldlib:$dirname/helloworldlib/lib
LD_TRACE_LOADED_OBJECTS=1 $dirname/helloworldlib/helloworld "$@"

(without LD_TRACE_LOADED_OBJECTS=1 is how it would normally be run, so that LD_LIBRARY_PATH is set to find the local .so files).

linux-vdso.so.1 =>  (0x00007ffdcebe5000)
libQt5Gui.so.5 => /usr/local/bin/./helloworldlib/lib/libQt5Gui.so.5 (0x00007f7dab418000)
libQt5Qml.so.5 => /usr/local/bin/./helloworldlib/lib/libQt5Qml.so.5 (0x00007f7daae1f000)
libQt5Core.so.5 => /usr/local/bin/./helloworldlib/lib/libQt5Core.so.5 (0x00007f7daa704000)
libstdc++.so.6 => /usr/local/bin/./helloworldlib/lib/libstdc++.so.6 (0x00007f7daa382000)
libgcc_s.so.1 => /usr/local/bin/./helloworldlib/lib/libgcc_s.so.1 (0x00007f7daa16c000)
libc.so.6 => /usr/local/bin/./helloworldlib/lib/libc.so.6 (0x00007f7da9da3000)
libpthread.so.0 => /usr/local/bin/./helloworldlib/lib/libpthread.so.0 (0x00007f7da9b86000)
libz.so.1 => /usr/local/bin/./helloworldlib/lib/libz.so.1 (0x00007f7da996c000)
libGL.so.1 => /usr/local/bin/./helloworldlib/lib/libGL.so.1 (0x00007f7da96fb000)
libm.so.6 => /usr/local/bin/./helloworldlib/lib/libm.so.6 (0x00007f7da93f2000)
libQt5Network.so.5 => /usr/local/bin/./helloworldlib/lib/libQt5Network.so.5 (0x00007f7da9094000)
librt.so.1 => /usr/local/bin/./helloworldlib/lib/librt.so.1 (0x00007f7da8e8c000)
/lib64/ld-linux-x86-64.so.2 (0x00007f7dabbc0000)
libicui18n.so.56 => /usr/local/bin/./helloworldlib/lib/libicui18n.so.56 (0x00007f7da89f2000)
libicuuc.so.56 => /usr/local/bin/./helloworldlib/lib/libicuuc.so.56 (0x00007f7da863a000)
libicudata.so.56 => /usr/local/bin/./helloworldlib/lib/libicudata.so.56 (0x00007f7da6c57000)
libdl.so.2 => /usr/local/bin/./helloworldlib/lib/libdl.so.2 (0x00007f7da6a53000)
libgthread-2.0.so.0 => /usr/local/bin/./helloworldlib/lib/libgthread-2.0.so.0 (0x00007f7da6851000)
libglib-2.0.so.0 => /usr/local/bin/./helloworldlib/lib/libglib-2.0.so.0 (0x00007f7da6540000)
libexpat.so.1 => /usr/local/bin/./helloworldlib/lib/libexpat.so.1 (0x00007f7da6317000)
libxcb-dri3.so.0 => /usr/local/bin/./helloworldlib/lib/libxcb-dri3.so.0 (0x00007f7da6114000)
libxcb-present.so.0 => /usr/local/bin/./helloworldlib/lib/libxcb-present.so.0 (0x00007f7da5f11000)
libxcb-sync.so.1 => /usr/local/bin/./helloworldlib/lib/libxcb-sync.so.1 (0x00007f7da5d0a000)
libxshmfence.so.1 => /usr/local/bin/./helloworldlib/lib/libxshmfence.so.1 (0x00007f7da5b07000)
libglapi.so.0 => /usr/local/bin/./helloworldlib/lib/libglapi.so.0 (0x00007f7da58d9000)
libXext.so.6 => /usr/local/bin/./helloworldlib/lib/libXext.so.6 (0x00007f7da56c7000)
libXdamage.so.1 => /usr/local/bin/./helloworldlib/lib/libXdamage.so.1 (0x00007f7da54c4000)
libXfixes.so.3 => /usr/local/bin/./helloworldlib/lib/libXfixes.so.3 (0x00007f7da52be000)
libX11-xcb.so.1 => /usr/local/bin/./helloworldlib/lib/libX11-xcb.so.1 (0x00007f7da50bc000)
libX11.so.6 => /usr/local/bin/./helloworldlib/lib/libX11.so.6 (0x00007f7da4d82000)
libxcb-glx.so.0 => /usr/local/bin/./helloworldlib/lib/libxcb-glx.so.0 (0x00007f7da4b69000)
libxcb-dri2.so.0 => /usr/local/bin/./helloworldlib/lib/libxcb-dri2.so.0 (0x00007f7da4964000)
libxcb.so.1 => /usr/local/bin/./helloworldlib/lib/libxcb.so.1 (0x00007f7da4742000)
libXxf86vm.so.1 => /usr/local/bin/./helloworldlib/lib/libXxf86vm.so.1 (0x00007f7da453c000)
libdrm.so.2 => /usr/local/bin/./helloworldlib/lib/libdrm.so.2 (0x00007f7da432d000)
libpcre.so.3 => /usr/local/bin/./helloworldlib/lib/libpcre.so.3 (0x00007f7da40bd000)
libXau.so.6 => /usr/local/bin/./helloworldlib/lib/libXau.so.6 (0x00007f7da3eb9000)
libXdmcp.so.6 => /usr/local/bin/./helloworldlib/lib/libXdmcp.so.6 (0x00007f7da3cb3000)

You can see that all the .so files are being loaded from within the "helloworldlib" directory.

except the loader: /lib64/ld-linux-x86-64.so.2 (0x00007f7dabbc0000)

I understand that this is the loader itself. should i be using my own version of the .so loader? I don't know enough about the internals of this.

This is the same trace as on the working machine.

There's not much information on the segfault. even with debugging, I can only ascertain that it's somewhere in libc.so.6

Any suggestions from anyone who has got a dynamic linux qt app working, greatly apreciated.

thanks.

来源:https://stackoverflow.com/questions/39041832/qt5-7-how-to-deploy-qt-application-on-linux

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!