There's definitely no problem with dynamic linking in Qt5.
main.cpp:
#include <QApplication>
#include <QWidget>
int main(int argc, char **argv)
{
w.resize(640, 480);
w.show();
return app.exec();
}
#include <QApplication>
#include <QWidget>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QWidget w;
w.resize(640, 480);
w.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
test.sh straight from the docs:
#!/bin/sh
appname=`basename $0 | sed s,\.sh$,,`
dirname=`dirname $0`
tmp="${dirname#?}"
if [ "${dirname%$tmp}" != "/" ]; then
dirname=$PWD/$dirname
fi
LD_LIBRARY_PATH=$dirname
export LD_LIBRARY_PATH
$dirname/$appname "$@"
#!/bin/sh
appname=`basename $0 | sed s,\.sh$,,`
dirname=`dirname $0`
tmp="${dirname#?}"
if [ "${dirname%$tmp}" != "/" ]; then
dirname=$PWD/$dirname
fi
LD_LIBRARY_PATH=$dirname
export LD_LIBRARY_PATH
$dirname/$appname "$@"
To copy to clipboard, switch view to plain text mode
Deployed files
./test
./test.sh
./libQt5Core.so.5 # required by test
./libQt5Gui.so.5 # required by test
./libQt5Widgets.so.5 # required by test
./libQt5DBus.so.5 # required by platform plugin
./libicuuc.so.49 # required by Qt5Core
./libicudata.so.49 # required by Qt5Core
./libicui18n.so.49 # required by Qt5Core
./platforms
./platforms/libqxcb.so # required for X11 on Linux
./test
./test.sh
./libQt5Core.so.5 # required by test
./libQt5Gui.so.5 # required by test
./libQt5Widgets.so.5 # required by test
./libQt5DBus.so.5 # required by platform plugin
./libicuuc.so.49 # required by Qt5Core
./libicudata.so.49 # required by Qt5Core
./libicui18n.so.49 # required by Qt5Core
./platforms
./platforms/libqxcb.so # required for X11 on Linux
To copy to clipboard, switch view to plain text mode
Check that it won't run without wrapper:
$ ./test
./test: error while loading shared libraries: libQt5Widgets.so.5: cannot open shared object file: No such file or directory
$ ldd test
linux-vdso.so.1 (0x00007fff7b3ff000)
libQt5Widgets.so.5 => not found
libQt5Gui.so.5 => not found
libQt5Core.so.5 => not found
libGL.so.1 => /usr/lib64/libGL.so.1 (0x00007fe8428c1000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fe8426a4000)
libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/libstdc++.so.6 (0x00007fe8423a0000)
libm.so.6 => /lib64/libm.so.6 (0x00007fe8420aa000)
libgcc_s.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/libgcc_s.so.1 (0x00007fe841e94000)
libc.so.6 => /lib64/libc.so.6 (0x00007fe841aea000)
libnvidia-tls.so.313.26 => /usr/lib64/libnvidia-tls.so.313.26 (0x00007fe8418e7000)
libnvidia-glcore.so.313.26 => /usr/lib64/libnvidia-glcore.so.313.26 (0x00007fe83f3e4000)
libX11.so.6 => /usr/lib64/libX11.so.6 (0x00007fe83f0a5000)
libXext.so.6 => /usr/lib64/libXext.so.6 (0x00007fe83ee93000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fe83ec8e000)
/lib64/ld-linux-x86-64.so.2 (0x00007fe842be4000)
libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x00007fe83ea6d000)
libXau.so.6 => /usr/lib64/libXau.so.6 (0x00007fe83e869000)
libXdmcp.so.6 => /usr/lib64/libXdmcp.so.6 (0x00007fe83e663000)
$ ./test
./test: error while loading shared libraries: libQt5Widgets.so.5: cannot open shared object file: No such file or directory
$ ldd test
linux-vdso.so.1 (0x00007fff7b3ff000)
libQt5Widgets.so.5 => not found
libQt5Gui.so.5 => not found
libQt5Core.so.5 => not found
libGL.so.1 => /usr/lib64/libGL.so.1 (0x00007fe8428c1000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fe8426a4000)
libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/libstdc++.so.6 (0x00007fe8423a0000)
libm.so.6 => /lib64/libm.so.6 (0x00007fe8420aa000)
libgcc_s.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/libgcc_s.so.1 (0x00007fe841e94000)
libc.so.6 => /lib64/libc.so.6 (0x00007fe841aea000)
libnvidia-tls.so.313.26 => /usr/lib64/libnvidia-tls.so.313.26 (0x00007fe8418e7000)
libnvidia-glcore.so.313.26 => /usr/lib64/libnvidia-glcore.so.313.26 (0x00007fe83f3e4000)
libX11.so.6 => /usr/lib64/libX11.so.6 (0x00007fe83f0a5000)
libXext.so.6 => /usr/lib64/libXext.so.6 (0x00007fe83ee93000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fe83ec8e000)
/lib64/ld-linux-x86-64.so.2 (0x00007fe842be4000)
libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x00007fe83ea6d000)
libXau.so.6 => /usr/lib64/libXau.so.6 (0x00007fe83e869000)
libXdmcp.so.6 => /usr/lib64/libXdmcp.so.6 (0x00007fe83e663000)
To copy to clipboard, switch view to plain text mode
Run it with the wrapper:
./test.sh
./test.sh
To copy to clipboard, switch view to plain text mode
Starts no problem.
Bookmarks