Difficulty with static builds



  • Re: [Build QT static libraries](with LinuxFB and minimum dependencies.)

    After finding many different suggestions for a static ./configure parameter list and creating a -static build, I've found that the linker complains about dozens of missing libraries.

    I used

    ./configure -static -prefix /home/user/qt-build/ -confirm-license -opensource -dbus-linked -openssl-linked -system-sqlite -nomake examples -no-rpath -nomake tests -skip qtwebengine -skip webengine -skip wayland
    
    

    After make && make install I change to my program's directory and

    PATH=/home/user/qt-build/bin:$PATH qmake
    make
    

    This results in a bunch of ld errors:

    /usr/bin/ld: cannot find -lxcb-glx
    /usr/bin/ld: cannot find -lXi
    /usr/bin/ld: cannot find -lSM
    /usr/bin/ld: cannot find -lICE
    /usr/bin/ld: cannot find -lXrender
    /usr/bin/ld: cannot find -lxcb-xkb
    /usr/bin/ld: cannot find -lxcb-render-util
    /usr/bin/ld: cannot find -lxcb-render
    /usr/bin/ld: cannot find -lxcb-sync
    /usr/bin/ld: cannot find -lxcb-xfixes
    /usr/bin/ld: cannot find -lxcb-xinerama
    /usr/bin/ld: cannot find -lxcb-randr
    /usr/bin/ld: cannot find -lxcb-image
    /usr/bin/ld: cannot find -lxcb-shm
    /usr/bin/ld: cannot find -lxcb-keysyms
    /usr/bin/ld: cannot find -lxcb-icccm
    /usr/bin/ld: cannot find -lxcb-shape
    /usr/bin/ld: cannot find -lxkbcommon-x11
    /usr/bin/ld: cannot find -ljpeg
    /usr/bin/ld: cannot find -lmng
    /usr/bin/ld: cannot find -ltiff
    /usr/bin/ld: cannot find -lwebp
    /usr/bin/ld: cannot find -lwebpdemux
    /usr/bin/ld: cannot find -lgbm
    /usr/bin/ld: cannot find -ldrm
    /usr/bin/ld: cannot find -ldbus-1
    /usr/bin/ld: cannot find -lfontconfig
    /usr/bin/ld: cannot find -lfreetype
    /usr/bin/ld: cannot find -lXext
    /usr/bin/ld: cannot find -lmtdev
    /usr/bin/ld: cannot find -linput
    /usr/bin/ld: cannot find -lxkbcommon
    /usr/bin/ld: cannot find -ludev
    /usr/bin/ld: cannot find -lX11-xcb
    /usr/bin/ld: cannot find -lX11
    /usr/bin/ld: cannot find -lxcb
    /usr/bin/ld: cannot find -lts
    /usr/bin/ld: cannot find -lEGL
    /usr/bin/ld: cannot find -lpng16
    /usr/bin/ld: cannot find -lharfbuzz
    /usr/bin/ld: cannot find -licui18n
    /usr/bin/ld: cannot find -licuuc
    /usr/bin/ld: cannot find -licudata
    /usr/bin/ld: cannot find -lpcre2-16
    /usr/bin/ld: cannot find -ldouble-conversion
    
    

    Previous response to this issue mentioned a "full" static build requiring a Qt build that includes its dependencies as static libraries, but I don't see any indication of how to configure that. I'm also wondering how this partial static build should be used. Is there some reason -static should configure a partial static build rather than a full static build?


  • Lifetime Qt Champion

    Hi,

    It means that you are missing the corresponding dev-packages from your distribution.

    If you want a full 100% static build, you also have to get all dependencies statically.



  • Is there a list of packages that are required for the various distributions?
    Is it really unusual to create 100% static builds? It seems like a poorly documented use case so perhaps it's just not common. But it also seems like it would be the most reliable and simplest for the end user so I didn't expect it to be rare or unusual.


  • Lifetime Qt Champion

    https://wiki.qt.io/Building_Qt_5_from_Git

    Yes it is for several reasons:

    • Each update of any of your dependency means that you have to rebuild everything that depends on it and do a new release of your application. Think security related bug fixes. This means that you have to trac every dependency for bug fixes and security fixes. Linking dynamically you can rely on the distribution your application users run to stay updated.
    • Licensing issues, LGPL for example states that you have to provide the means for your application users to replace the LGPL libraries you link to with whatever versions of that library they want. And that example is only for LGPL, you might be using libraries with other license that have other restrictions.
    • The application is way bigger and longer to load.

Log in to reply
 

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