Important: Please read the Qt Code of Conduct -

I am trying to figure out how to compile Qt4.3.3 as a static library,

  • I have to make stattic libraries of qt4.3.3 (QtGui.a) and QtCore.a and want to link it to my tools

    I did following steps

    1. checkout out commercial source code of QT (4.3.3)
    2. cd qt-all-commercial-src-4.3.3
    3. /configure -release -static -largefile -qt3support -qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg -glib -platform linux-g++-64 -confirm-license -no-openssl -no-qdbus -prefix ./lib_new66 -prefix-install -opengl17:10

    Then I manually removed -fvisibility=hidden and -fvisibility-inlines-hidden from all makefiles generated

    also put -fpermissive
    it is there in all make files

    The static libraries were build but when I am linking in my tools I am getting following error undefined reference to symbol 'XRenderCreateGlyphSet'

    is there any expert who can guide me what is correct way to make and link static library of qt.4.3.3

  • Lifetime Qt Champion


    Looks like you also need to link to libXft.

  • My question when I see the configure option help then I get

    -no-xinerama ....... Do not compile Xinerama (multihead) support.

    • -xinerama .......... Compile Xinerama support.
      Requires X11/extensions/Xinerama.h and libXinerama.

    dditional options:

    -make <part> ....... Add part to the list of parts to be built at make time.
                         (libs tools examples demos)
    -nomake <part> ..... Exclude part from the list of parts to be built.
    -R <string> ........ Add an explicit runtime library path to the Qt
    -l <string> ........ Add an explicit library.

    what does the last line mean , do I have to manually include libXinerama in while doing a configure because flile

    /configure -release -static -largefile -qt3support -qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg -glib -platform linux-g++-64 -confirm-license -no-openssl -no-qdbus -prefix ./lib_new66 -prefix-instal -lXinerama
    otherwise the tools gives linking errors for these libraries

  • One observation i found out if I build dynamic libraries using source code of qt.4.3.3 the
    /configure -release -largefile -qt3support -qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg -glib -platform linux-g++-64 -confirm-license -no-openssl -no-qdbus -prefix ./lib_new66_52 -prefix-install -opengl -sm -lSM -lICE -xshape -lX11 -xinerama -lXinerama -xcursor -lXcursor -xfixes -lXfixes -xrandr -lXrandr -xrender -lXrender -fontconfig -lfontconfig -tablet -lXi -xkb -glib -lglib-2.0 -lXext -lz -lgthread-2.0

    the tools is working fine , I am able to link it but if

    I make static library of same source code by using following steps I am able to link it to my tool and i

    /configure -static -release -largefile -qt3support -qt-libpng -qt-libmng -qt-libtiff -qt-libjpeg -glib -platform linux-g++-64 -confirm-license -no-openssl -no-qdbus -prefix ./lib_new66_52 -prefix-install -opengl -sm -lSM -lICE -xshape -lX11 -xinerama -lXinerama -xcursor -lXcursor -xfixes -lXfixes -xrandr -lXrandr -xrender -lXrender -fontconfig -lfontconfig -tablet -lXi -xkb -glib -lglib-2.0 -lXext -lz -lgthread-2.0

    The changes I have done in my Makefile of the tool as added a line
    SLIBS += QtGui QtCore SM ICE Xinerama Xcursor Xrandr Xrender fontconfig Xi Xfixes glib-2.0 freetype Xext z gthread-2.0

    The tools crashes . Can someone guide me how to resolve the issue . What is there I am missing

  • Lifetime Qt Champion

    The last line means that you can link Qt against a specific version of a library

    What do you mean by crashes ?

  • @SGaist
    When I do a make in my application , there is no compilation and linking error

    but when I start he application , the applications at runtime crashes

    I also did an experiment , I tried to make a standalone hello worl application and linked it this static library and it is working fine

    What can be the cause of the crash at runtime

  • Lifetime Qt Champion

    Run your application through the debugger to get a hint at what exactly goes wrong.

Log in to reply