QT5.7 libraries built with GCC-4.9.1 but linked with older libstdc++?

  • Hi,

    I built QT-5.7 sources on CentOS 6.5 64-bit and then compared with the binaries that is bundled in the QT-5.7 offline installer. I found that the QT5 libraries (specially webengine libs) that I built had a dependency on libstdc++.so that was installed on my machine when I built GCC-4.9.1. But the libraries that is bundled in the installer is actually linked with older libstdc++. How is it possible to do that?

    Installer lib:
    $ strings -a Qt570_installer/5.7/gcc_64/lib/libQt5WebEngineCore.so | grep GCC:
    GCC: (GNU) 4.4.7 20120313 (Red Hat 4.4.7-9)
    GCC: (GNU) 4.9.1 20140922 (Red Hat 4.9.1-10)

    $ strings -a Qt570_installer/5.7/gcc_64/lib/libQt5WebEngineCore.so | grep ^CXXABI

    $ strings -a Qt570_installer/5.7/gcc_64/lib/libQt5WebEngineCore.so | grep ^GLIBCXX

    My Build:
    $ strings -a Qt-5.7.0/lib/libQt5WebEngineCore.so | grep GCC:
    GCC: (GNU) 4.4.7 20120313 (Red Hat 4.4.7-16)
    GCC: (GNU) 4.9.1

    $ strings -a Qt-5.7.0/lib/libQt5WebEngineCore.so | grep ^CXXABI

    $ strings -a Qt-5.7.0/lib/libQt5WebEngineCore.so | grep ^GLIBCXX

    So, because of this difference, I see that the resulting application needed libstdc++.so from the gcc-4.9.1 on the target machine. The same was not needed when I built the application using the QT offline installer.

  • Hi,

    I really would like to know this how QT guys compile the QT source with higher version of GCC but link with lower STDC++ library. I'm trying to build QT5.7.1 on CentOS 6 32bit and the app crashes and gdb is not showing enough information but it seems it has to do with system libs like libc.so, libm.so

  • To give an idea on how I configured QT on CentOS 6 32bit:

    • Since system comes with GCC-4.4.7, I configured GCC-4.9.1 sources and installed in /usr/local/. I then set the PATH and LD_LIBRARY_PATH to include the GCC-4.9.1 bin and lib paths resp and configured QT.

    My app crashes and here is the backtrace:

    (gdb) bt
    #0 0x00003402 in ?? ()
    #1 0x00f19ac7 in __fmaf_ifunc () at ../sysdeps/i386/i686/multiarch/s_fmaf.c:30
    #2 0x00abff6c in elf_machine_rel (scope=0xb77b2a40, reloc_mode=1, consider_profiling=0) at ../sysdeps/i386/dl-machine.h:351
    #3 elf_dynamic_do_rel (scope=0xb77b2a40, reloc_mode=1, consider_profiling=0) at do-rel.h:120
    #4 _dl_relocate_object (scope=0xb77b2a40, reloc_mode=1, consider_profiling=0) at dl-reloc.c:268
    #5 0x00ab69df in dl_main (phdr=0x8048034, phnum=8, user_entry=0xbf9b92ec, auxv=0xbf9b93f8) at rtld.c:2262
    #6 0x00ac8c11 in _dl_sysdep_start (start_argptr=0xbf9b9350, dl_main=0xab5630 <dl_main>) at ../elf/dl-sysdep.c:244
    #7 0x00ab4273 in _dl_start_final (arg=0xbf9b9350) at rtld.c:335
    #8 _dl_start (arg=0xbf9b9350) at rtld.c:561
    #9 0x00ab3857 in _start () from /lib/ld-2.12.so

  • Moderators

    @SandeepT Do you set LD_LIBRARY_PATH variable before starting your app, so it points to /usr/local/... ?
    If not then I guess the loader loads older libs from /usr which are built with the older compiler.

  • No, I set LD_LIBRARY_PATH and PATH variables before I configure QT so that it picks the correct GCC.


  • Moderators

    @SandeepT Then try to set LD_LIBRARY_PATH before starting your app, so the loader picks up correct libraries.

  • yes, I do set LD_LIBRARY_PATH before I run my app. I basically need to know two things:

    1. Why the QT libraries that I built depends on libstdc++ that comes with gcc-4.9.1 and the libraries bundled in the QT offline installer do not, even though the compiler version used in both the cases is 4.9.1 ?

    2. Which libraries from GCC should I bundle along with my app? libstdc++.so, libgcc_s.so?

  • Moderators


    1. As far as I know Qt for Linux is built on RedHat Linux, that could explain
    2. You should bundle libraries which are needed by your app, you can find out which those are calling
    ldd YOUR_APP

Log in to reply

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