Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. ldd shows a lot of dependencies even in static Qt version
Forum Updated to NodeBB v4.3 + New Features

ldd shows a lot of dependencies even in static Qt version

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
6 Posts 3 Posters 655 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Elias_Cute
    wrote on last edited by
    #1

    I configured and built Qt 5.15 statically

    mkdir ~/data
    cd ~/data
    wget https://download.qt.io/archive/qt/5.15/5.15.5/single/qt-everywhere-opensource-src-5.15.5.tar.xz
    tar -xf qt-everywhere-opensource-src-5.15.5.tar.xz -C qt-5.15-v1
    cd qt-5.15-v1/qt-everywhere-src-5.15.5/
    
    ./configure -static -prefix /opt/qt-5.15-v1-static -confirm-license -opensource -nomake examples -nomake tests -nomake tools -skip qtwebengine
    

    Here is the full output ./configure https://pastebin.com/7EeqfH0N

    make
    sudo make install
    

    QT installed successfully into /opt/qt-5.15-v1-static

    After which I build a tiny test project without QML with one MainWindow:

    cd ~/data/tinytest/
    export PATH=/opt/qt-5.15-v1-static/bin:$PATH
    qmake tinytest.pro -config release
    make
    

    Here is the full output make https://pastebin.com/rxvqu7Uj

    Linking line (g++) does NOT have -static option!! =(

    And ldd command shows a lot of dependencies

    user@host:~/data/tinytest$ ldd tinytest
            linux-vdso.so.1 (0x00007ffc715dd000)
            libxcb-glx.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-glx.so.0 (0x00007f21798e7000)
            libxcb-icccm.so.4 => /usr/lib/x86_64-linux-gnu/libxcb-icccm.so.4 (0x00007f21796e2000)
            libxcb-image.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-image.so.0 (0x00007f21794dd000)
            libxcb-shm.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007f21792da000)
            libxcb-keysyms.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-keysyms.so.1 (0x00007f21790d7000)
            libxcb-randr.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-randr.so.0 (0x00007f2178ec7000)
            libxcb-render-util.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-render-util.so.0 (0x00007f2178cc3000)
            libxcb-render.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-render.so.0 (0x00007f2178ab6000)
            libxcb-shape.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-shape.so.0 (0x00007f21788b2000)
            libxcb-sync.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007f21786ab000)
            libxcb-xfixes.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-xfixes.so.0 (0x00007f21784a3000)
            libxcb-xinerama.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-xinerama.so.0 (0x00007f21782a0000)
            libxcb-xkb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-xkb.so.1 (0x00007f2178084000)
            libxcb-xinput.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-xinput.so.0 (0x000
    ...  and many more lines
    

    Here is the full output ldd https://pastebin.com/iMPJZkFk

    JonBJ 1 Reply Last reply
    0
    • E Offline
      E Offline
      Elias_Cute
      wrote on last edited by
      #2

      I used this official guide https://doc.qt.io/qt-5/linux-deployment.html

      1 Reply Last reply
      0
      • E Elias_Cute

        I configured and built Qt 5.15 statically

        mkdir ~/data
        cd ~/data
        wget https://download.qt.io/archive/qt/5.15/5.15.5/single/qt-everywhere-opensource-src-5.15.5.tar.xz
        tar -xf qt-everywhere-opensource-src-5.15.5.tar.xz -C qt-5.15-v1
        cd qt-5.15-v1/qt-everywhere-src-5.15.5/
        
        ./configure -static -prefix /opt/qt-5.15-v1-static -confirm-license -opensource -nomake examples -nomake tests -nomake tools -skip qtwebengine
        

        Here is the full output ./configure https://pastebin.com/7EeqfH0N

        make
        sudo make install
        

        QT installed successfully into /opt/qt-5.15-v1-static

        After which I build a tiny test project without QML with one MainWindow:

        cd ~/data/tinytest/
        export PATH=/opt/qt-5.15-v1-static/bin:$PATH
        qmake tinytest.pro -config release
        make
        

        Here is the full output make https://pastebin.com/rxvqu7Uj

        Linking line (g++) does NOT have -static option!! =(

        And ldd command shows a lot of dependencies

        user@host:~/data/tinytest$ ldd tinytest
                linux-vdso.so.1 (0x00007ffc715dd000)
                libxcb-glx.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-glx.so.0 (0x00007f21798e7000)
                libxcb-icccm.so.4 => /usr/lib/x86_64-linux-gnu/libxcb-icccm.so.4 (0x00007f21796e2000)
                libxcb-image.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-image.so.0 (0x00007f21794dd000)
                libxcb-shm.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007f21792da000)
                libxcb-keysyms.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-keysyms.so.1 (0x00007f21790d7000)
                libxcb-randr.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-randr.so.0 (0x00007f2178ec7000)
                libxcb-render-util.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-render-util.so.0 (0x00007f2178cc3000)
                libxcb-render.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-render.so.0 (0x00007f2178ab6000)
                libxcb-shape.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-shape.so.0 (0x00007f21788b2000)
                libxcb-sync.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007f21786ab000)
                libxcb-xfixes.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-xfixes.so.0 (0x00007f21784a3000)
                libxcb-xinerama.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-xinerama.so.0 (0x00007f21782a0000)
                libxcb-xkb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-xkb.so.1 (0x00007f2178084000)
                libxcb-xinput.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-xinput.so.0 (0x000
        ...  and many more lines
        

        Here is the full output ldd https://pastebin.com/iMPJZkFk

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #3

        @Elias_Cute
        Although I have never done Qt statically, so I am not an expert: all you have done is build and link the Qt libraries statically. For example, if/assuming your code calls for anything Qt you do not see any libQt... dynamic libraries as dependencies. Those you do see are the system/windowing system dynamic libraries.

        I don't whether/why you would want them statically linked too, but if so you will have take some action on the linker line to specify this.

        1 Reply Last reply
        0
        • E Offline
          E Offline
          Elias_Cute
          wrote on last edited by
          #4

          I don't whether/why you would want them statically linked too, but if so you will have take some action on the linker line to specify this.

          There are too many of them and it is obvious that these dependencies were not brought by me - they were brought by Qt.

          I have no idea how to link them statically.

          jsulmJ 1 Reply Last reply
          0
          • E Elias_Cute

            I don't whether/why you would want them statically linked too, but if so you will have take some action on the linker line to specify this.

            There are too many of them and it is obvious that these dependencies were not brought by me - they were brought by Qt.

            I have no idea how to link them statically.

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @Elias_Cute said in ldd shows a lot of dependencies even in static Qt version:

            I have no idea how to link them statically

            You would also have to build all these libraries as static libraries and then build Qt statically telling it to use these static libraries. These libraries are not part of Qt itself, they are provided by your Linux distribution and Qt depends on them.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            E 1 Reply Last reply
            2
            • jsulmJ jsulm

              @Elias_Cute said in ldd shows a lot of dependencies even in static Qt version:

              I have no idea how to link them statically

              You would also have to build all these libraries as static libraries and then build Qt statically telling it to use these static libraries. These libraries are not part of Qt itself, they are provided by your Linux distribution and Qt depends on them.

              E Offline
              E Offline
              Elias_Cute
              wrote on last edited by
              #6

              @jsulm

              So, after statically building Qt, I have to build these 65 libraries:

              libxcb-glx.so
              libxcb-icccm.so
              libxcb-image.so
              libxcb-shm.so
              libxcb-keysyms.so
              libxcb-randr.so
              libxcb-render-util.so
              libxcb-render.so
              libxcb-shape.so
              libxcb-sync.so
              libxcb-xfixes.so
              libxcb-xinerama.so
              libxcb-xkb.so
              libxcb-xinput.so
              libSM.so
              libICE.so
              libxkbcommon-x11.so
              libjpeg.so
              libtiff.so
              libgbm.so
              libdrm.so
              libudev.so
              libX11-xcb.so
              libxcb.so
              libwayland-egl.so
              libEGL.so
              libXcomposite.so
              libX11.so
              libfontconfig.so
              libfreetype.so
              libdbus-1.so
              libwayland-cursor.so
              libwayland-client.so
              libxkbcommon.so
              libpng16.so
              libharfbuzz.so
              libz.so
              libdouble-conversion.so
              libicui18n.so
              libicuuc.so
              libdl.so
              libglib-2.0.so.0
              libGL.so
              libm.so
              libgcc_s.so
              libxcb-util.so
              libuuid.so
              libbsd.so
              liblzma.so
              libjbig.so
              libwayland-server.so
              libexpat.so
              librt.so
              libXau.so
              libXdmcp.so
              libGLdispatch.so
              libsystemd.so
              libffi.so
              libgraphite2.so
              libicudata.so
              libpcre.so
              libGLX.so
              liblz4.so
              libgcrypt.so
              libgpg-error.so
              

              and only then will I get a statically-builded hello-world? Why isn't this mentioned in any manual?

              p.s. I know about exclusion libraries: linux-vdso.so libc.so libpthread.so ld-linux-x86-64.so
              They cannot be assembled statically. But what about the rest?

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved