- MY_OS = KUbuntu 13.10 x86_64
- QT_VERSION = 5.2.0
I have a Qt project that I want to compile. The project is very small, almost HelloWorld.
When I compile it the result binary I get has so many dependencies that It does not work on a clean KUbuntu 13.10 x86_64 even with Qt libs redistributed!
So I decided to learn some from a different Qt project - otter-browser I downloaded the source code and compiled it - the same result as with my project. For comparison I downloaded a deb package of otter-browser and extracted the binary from it.
Here is the ldd output of binary packaged in deb:
$ ldd ./otter-browser
linux-vdso.so.1 => (0x00007fff775fe000)
libQt5Core.so.5 => not found
libQt5Network.so.5 => not found
libQt5PrintSupport.so.5 => not found
libQt5Sql.so.5 => not found
libQt5Widgets.so.5 => not found
libQt5WebKitWidgets.so.5 => not found
libQt5WebKit.so.5 => not found
libQt5Gui.so.5 => not found
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f68cc7dd000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f68cc4d9000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f68cc2c3000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f68cbefa000)
/lib64/ld-linux-x86-64.so.2 (0x00007f68ccb05000)
And here is the ldd output than I compiled myself (I have tried CMake and Qmake - no difference, release\debug version - the same)
ldd ./otter-browser
linux-vdso.so.1 => (0x00007fff7cffe000)
libQt5WebKitWidgets.so.5 => /home/ngor/Devel/sdk/Qt/5.2.0/gcc_64/lib/libQt5WebKitWidgets.so.5 (0x00007fae9c9f6000)
libQt5PrintSupport.so.5 => /home/ngor/Devel/sdk/Qt/5.2.0/gcc_64/lib/libQt5PrintSupport.so.5 (0x00007fae9c790000)
libQt5WebKit.so.5 => /home/ngor/Devel/sdk/Qt/5.2.0/gcc_64/lib/libQt5WebKit.so.5 (0x00007fae9a309000)
libQt5Widgets.so.5 => /home/ngor/Devel/sdk/Qt/5.2.0/gcc_64/lib/libQt5Widgets.so.5 (0x00007fae99ac4000)
libQt5Sql.so.5 => /home/ngor/Devel/sdk/Qt/5.2.0/gcc_64/lib/libQt5Sql.so.5 (0x00007fae99885000)
libQt5Network.so.5 => /home/ngor/Devel/sdk/Qt/5.2.0/gcc_64/lib/libQt5Network.so.5 (0x00007fae99530000)
libQt5Gui.so.5 => /home/ngor/Devel/sdk/Qt/5.2.0/gcc_64/lib/libQt5Gui.so.5 (0x00007fae98eab000)
libQt5Core.so.5 => /home/ngor/Devel/sdk/Qt/5.2.0/gcc_64/lib/libQt5Core.so.5 (0x00007fae987de000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fae984ba000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fae981b6000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fae97fa0000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fae97bd7000)
libQt5OpenGL.so.5 => /home/ngor/Devel/sdk/Qt/5.2.0/gcc_64/lib/libQt5OpenGL.so.5 (0x00007fae97973000)
libQt5Sensors.so.5 => /home/ngor/Devel/sdk/Qt/5.2.0/gcc_64/lib/libQt5Sensors.so.5 (0x00007fae97735000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fae97517000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fae9730f000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fae970f6000)
libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007fae96eeb000)
libXcomposite.so.1 => /usr/lib/x86_64-linux-gnu/libXcomposite.so.1 (0x00007fae96ce8000)
libicui18n.so.51 => /home/ngor/Devel/sdk/Qt/5.2.0/gcc_64/lib/libicui18n.so.51 (0x00007fae968cf000)
libicuuc.so.51 => /home/ngor/Devel/sdk/Qt/5.2.0/gcc_64/lib/libicuuc.so.51 (0x00007fae96548000)
libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007fae96213000)
libxslt.so.1 => /usr/lib/x86_64-linux-gnu/libxslt.so.1 (0x00007fae95fd6000)
libxml2.so.2 => /usr/lib/x86_64-linux-gnu/libxml2.so.2 (0x00007fae95c6f000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fae9596e000)
libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007fae9571d000)
libgstreamer-0.10.so.0 => /usr/lib/x86_64-linux-gnu/libgstreamer-0.10.so.0 (0x00007fae95433000)
libgstapp-0.10.so.0 => /usr/lib/x86_64-linux-gnu/libgstapp-0.10.so.0 (0x00007fae95227000)
libgstbase-0.10.so.0 => /usr/lib/x86_64-linux-gnu/libgstbase-0.10.so.0 (0x00007fae94fd3000)
libgstinterfaces-0.10.so.0 => /usr/lib/x86_64-linux-gnu/libgstinterfaces-0.10.so.0 (0x00007fae94dc0000)
libgstpbutils-0.10.so.0 => /usr/lib/x86_64-linux-gnu/libgstpbutils-0.10.so.0 (0x00007fae94b9c000)
libgstvideo-0.10.so.0 => /usr/lib/x86_64-linux-gnu/libgstvideo-0.10.so.0 (0x00007fae94980000)
libQt5Quick.so.5 => /home/ngor/Devel/sdk/Qt/5.2.0/gcc_64/lib/libQt5Quick.so.5 (0x00007fae943eb000)
libQt5Qml.so.5 => /home/ngor/Devel/sdk/Qt/5.2.0/gcc_64/lib/libQt5Qml.so.5 (0x00007fae93dde000)
libQt5Positioning.so.5 => /home/ngor/Devel/sdk/Qt/5.2.0/gcc_64/lib/libQt5Positioning.so.5 (0x00007fae93ba2000)
libGL.so.1 => /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 (0x00007fae93943000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fae9373f000)
libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007fae9353c000)
/lib64/ld-linux-x86-64.so.2 (0x00007fae9cc3a000)
libicudata.so.51 => /home/ngor/Devel/sdk/Qt/5.2.0/gcc_64/lib/libicudata.so.51 (0x00007fae91df3000)
libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007fae91bd4000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007fae919b2000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fae91773000)
libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007fae9156a000)
libgmodule-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0 (0x00007fae91366000)
liborc-0.4.so.0 => /usr/lib/x86_64-linux-gnu/liborc-0.4.so.0 (0x00007fae910e6000)
libglapi.so.0 => /usr/lib/x86_64-linux-gnu/libglapi.so.0 (0x00007fae90ec0000)
libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007fae90cad000)
libXdamage.so.1 => /usr/lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007fae90aaa000)
libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007fae908a4000)
libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007fae906a1000)
libxcb-glx.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-glx.so.0 (0x00007fae9048a000)
libxcb-dri2.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri2.so.0 (0x00007fae90285000)
libXxf86vm.so.1 => /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1 (0x00007fae9007e000)
libdrm.so.2 => /usr/lib/x86_64-linux-gnu/libdrm.so.2 (0x00007fae8fe72000)
libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007fae8fc6d000)
libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007fae8fa67000)
The size of binaries is rather small - 2.1 Mb (deb) against 1.6 (compiled by me). This means all those libs are not statically linked into a deb binary (IMHO, otherwise the size would be about 10-15Mb)
So I wonder how can I compile the project to have only Qt Libs and some trivial stuff like libbstdc++, libgcc, libc in dependencies?
If i miss some basic understandings of project deployment please feel free provide some links instead of a long-long answer.
Thanks!