Compiling QT libs with non-default gcc

  • Dear members,

    I downloaded and extracted qt-everywhere-opensource-src-4.8.3.tar.gz.
    Using configure (or another way) I want to compile the QTlibs with another gcc located in /opt
    This is not the default gcc that comes with Centos (5.5)

    Can you help ?


  • Moderators

    Adjust mkspecs (or better, create your own by copying, say, linux-g++), so that it uses a different compiler. Then you need to configure Qt with -platform <your new mkspecs>. I don't actually remember if it works, but at least is worth a try.

  • Moderators

    If your gcc in /opt is called "gcc", "g++" etc. then you can just make sure /opt/whatever/bin is in your PATH before /usr/bin and this should work. Run "gcc --version" (or was that "gcc -v", can't remember :) and check that you get the expected version number back to make sure the right compiler is picked up.

    I would also check the generated Makefiles before building for the first time. Some mkspec put the absolute path to the compiler into those and will thus ignore your PATH setup.

  • Dear Members,

    I created a new folder under mkspecs copied from linux-g++-32
    Then I changed g++,gcc to i686-nptl-linux-gnu-gcc,i686-nptl-linux-gnu-g++
    I also set:

    I ran:
    ./configure -opensource -platform i686-nptl-linux-gnu -embedded -host-little-endian -fast -no-accessibility -no-stl -no-qt3support -no-xmlpatterns -no-multimedia -no-audio-backend -no-phonon -no-phonon-backend -no-svg -no-webkit -no-javascript-jit -no-script -no-declarative -no-declarative-debug -no-gif -qt-zlib -no-libtiff -no-libpng -no-libmng -no-libjpeg -no-openssl -no-gui -no-nis -no-cups -no-iconv -no-dbus -no-gtkstyle -no-nas-sound -no-opengl -no-openvg -no-sm -no-xshape -no-xvideo -no-xsync -no-xinerama -no-xcursor -no-xfixes -no-xrandr -no-xrender -no-mitshm -no-fontconfig -no-xinput -no-xkb -no-glib

    After a while I got the following error:

    gmake[1]: Entering directory /home/zvivered/qt-everywhere-opensource-src-4.7.4/translations' /home/zvivered/qt-everywhere-opensource-src-4.7.4/bin/qmake -spec ../mkspecs/qws/linux-x86-g++ -o Makefile gmake[1]: Leaving directory/home/zvivered/qt-everywhere-opensource-src-4.7.4/translations'
    gmake[1]: Entering directory /home/zvivered/qt-everywhere-opensource-src-4.7.4/translations' /home/zvivered/qt-everywhere-opensource-src-4.7.4/bin/lrelease assistant_cs.ts -qm assistant_cs.qm /home/zvivered/qt-everywhere-opensource-src-4.7.4/bin/lrelease: /usr/lib/ versionGLIBCXX_3.4.9' not found (required by /home/zvivered/qt-everywhere-opensource-src-4.7.4/bin/lrelease)
    gmake[1]: *** [assistant_cs.qm] Error 1
    gmake[1]: Leaving directory `/home/zvivered/qt-everywhere-opensource-src-4.7.4/translations'
    gmake: *** [sub-translations-make_default-ordered] Error 2

    Why does the make files searches: /usr/lib/ ?
    In my directory under mkspec (called i686-nptl-linux-gnu) there is no: /usr/lib

    You help is highly appreciated !

  • Dear Members,

    I think I had to set:
    LD_LIBRARY_PATH to point to where my gcc's dynamic libraries are located.

    Now I'm getting:
    /home/zvivered/ct-ng-1.5.2/release/i686-nptl-linux-gnu/sys-root/lib/ undefined reference to `__fortify_fail@GLIBC_PRIVATE'
    collect2: ld returned 1 exit status
    gmake[3]: *** [download] Error 1

    "My" glibc is 2.9
    Can I link QT 4.7.4 with this glibc ?


  • Hello,

    I created a toolchain with glib 2.5
    With this glib I did not get the unresolved error: "undefined reference to `__fortify_fail@GLIBC_PRIVATE’"

    Upon configure start I got the following message:
    @You have not explicitly asked to use pkg-config and are cross-compiling.
    pkg-config will not be used to automatically query cflag/lib parameters for

    Where should I usg pkg-config ?


Log in to reply

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