Ubuntu Deployment and Static Linking



  • Hi,

    I've read "the article on deployment to X11 platforms":http://qt-project.org/doc/qt-5.0/qtdoc/deployment-x11.html but there are a couple of things that remain unclear to me.

    Can I statically link to libraries even if my Qt build is not static? I thought so, and added

    @QMAKE_LFLAGS += -static-libstdc++ -static-libgcc
    unix|win32: LIBS += -lstdc++@

    to my project file, but running the "ldd" command still gives me the following:

    @linux-gate.so.1 => (0xb772f000)
    libQt5Widgets.so.5 => /home/william/Qt5.0.2/5.0.2/gcc/lib/libQt5Widgets.so.5 (0xb7104000)
    libQt5Xml.so.5 => /home/william/Qt5.0.2/5.0.2/gcc/lib/libQt5Xml.so.5 (0xb70c9000)
    libQt5Gui.so.5 => /home/william/Qt5.0.2/5.0.2/gcc/lib/libQt5Gui.so.5 (0xb6cb2000)
    libQt5Core.so.5 => /home/william/Qt5.0.2/5.0.2/gcc/lib/libQt5Core.so.5 (0xb6866000)
    HERE IT IS: libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb676e000)
    libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb6750000)
    libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb65a6000)
    libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb658a000)
    libgobject-2.0.so.0 => /usr/lib/i386-linux-gnu/libgobject-2.0.so.0 (0xb653b000)
    libglib-2.0.so.0 => /lib/i386-linux-gnu/libglib-2.0.so.0 (0xb6442000)
    libX11.so.6 => /usr/lib/i386-linux-gnu/libX11.so.6 (0xb630e000)
    libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb62e2000)
    libGL.so.1 => /usr/lib/i386-linux-gnu/mesa/libGL.so.1 (0xb6288000)
    libicui18n.so.49 => /home/william/Qt5.0.2/5.0.2/gcc/lib/libicui18n.so.49 (0xb6070000)
    libicuuc.so.49 => /home/william/Qt5.0.2/5.0.2/gcc/lib/libicuuc.so.49 (0xb5ef6000)
    libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb5ef1000)
    libgthread-2.0.so.0 => /usr/lib/i386-linux-gnu/libgthread-2.0.so.0 (0xb5eee000)
    librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb5ee4000)
    /lib/ld-linux.so.2 (0xb7730000)
    libffi.so.6 => /usr/lib/i386-linux-gnu/libffi.so.6 (0xb5edd000)
    libpcre.so.3 => /lib/i386-linux-gnu/libpcre.so.3 (0xb5ea1000)
    libxcb.so.1 => /usr/lib/i386-linux-gnu/libxcb.so.1 (0xb5e80000)
    libglapi.so.0 => /usr/lib/i386-linux-gnu/libglapi.so.0 (0xb5e6a000)
    libXext.so.6 => /usr/lib/i386-linux-gnu/libXext.so.6 (0xb5e57000)
    libXdamage.so.1 => /usr/lib/i386-linux-gnu/libXdamage.so.1 (0xb5e53000)
    libXfixes.so.3 => /usr/lib/i386-linux-gnu/libXfixes.so.3 (0xb5e4d000)
    libX11-xcb.so.1 => /usr/lib/i386-linux-gnu/libX11-xcb.so.1 (0xb5e4a000)
    libxcb-glx.so.0 => /usr/lib/i386-linux-gnu/libxcb-glx.so.0 (0xb5e32000)
    libXxf86vm.so.1 => /usr/lib/i386-linux-gnu/libXxf86vm.so.1 (0xb5e2b000)
    libdrm.so.2 => /usr/lib/i386-linux-gnu/libdrm.so.2 (0xb5e1e000)
    libicudata.so.49 => /home/william/Qt5.0.2/5.0.2/gcc/lib/libicudata.so.49 (0xb4cfd000)
    libXau.so.6 => /usr/lib/i386-linux-gnu/libXau.so.6 (0xb4cf9000)
    libXdmcp.so.6 => /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0xb4cf2000)@

    (tried to bold the relevant line above, but seems to not work with code tags, it's sixth from the top)

    Which also brings me to my next question. Logic dictates that all the Qt5.0.2 libraries will obviously have to be distributed along with the executable, but is there a way to determine which of the libraries in the "i386-linux-gnu" paths (be they /usr or /lib paths) can be excluded?

    It isn't very important to get this right, I have no qualms with distributing all of it, but was interested as a learning exercise.

    I'm running 32-bit Ubuntu 12.04

    Any pointers will be appreciated.

    Thanks!



  • "Can I statically link to libraries even if my Qt build is not static?"

    No. I don't understand it but from what I've read you have to make your Qt build static.



  • Thanks for your reply.

    Anybody else? I'd still like to know if there is a way to determine which of the libraries in the “i386-linux-gnu” paths (be they /usr or /lib paths) can be excluded :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.