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. Is _GLIBCXX_USE_CXX11_ABI=0 defined in pre-build versions of Qt?
Forum Updated to NodeBB v4.3 + New Features

Is _GLIBCXX_USE_CXX11_ABI=0 defined in pre-build versions of Qt?

Scheduled Pinned Locked Moved Solved Installation and Deployment
6 Posts 4 Posters 4.3k Views 2 Watching
  • 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.
  • B Offline
    B Offline
    blex
    wrote on last edited by
    #1

    Gcc ABI was significantly changed between 4.x and 5.x. If you try to link application with third-party library that was compiled with an older version of GCC then you get linker errors about undefined references to symbols that involve types in the std::__cxx11 namespace. The problem is related to https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html

    But the same Qt binary distribution for Linux links correctly for gcc 5.x and gcc 4.x.

    What was done to get this result? How the problem of different gcc ABI is resolved? Is _GLIBCXX_USE_CXX11_ABI=0 defined for Qt pre-build version that is available to download?


    Oleksiy Balabay

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Please ask on Interest mailing list, many developers who write Qt are present there.

      (Z(:^

      B 1 Reply Last reply
      1
      • sierdzioS sierdzio

        Please ask on Interest mailing list, many developers who write Qt are present there.

        B Offline
        B Offline
        blex
        wrote on last edited by
        #3

        @sierdzio said in Is _GLIBCXX_USE_CXX11_ABI=0 defined in pre-build versions of Qt?:

        Please ask on Interest mailing list, many developers who write Qt are present there.

        I have got answer from Interest mailing list.
        Summary:

        Q: Why the same Qt binaries may be used with different compilers (gcc 4.x, gcc 5.x) and other libraries cannot be used?
        A: GCC ABI was changed for standard library (https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html ). Qt does not depend on standard library. If other library depends on standard library then it will link with errors. Inline methods (like QString::toStdString, QVector::toStdVector, etc...) are fine because they are compiled with the same C++ ABI as used in the application

        Q: Is it possible for GCC 5.x to link with the library compiled by GCC 4.x?
        A: Yes. The old GCC ABI is still supported and can be used by defining the macro _GLIBCXX_USE_CXX11_ABI to 0 before including any C++ standard library headers (https://gcc.gnu.org/gcc-5/changes.html#libstdcxx ).


        Oleksiy Balabay

        kshegunovK 1 Reply Last reply
        2
        • B blex

          @sierdzio said in Is _GLIBCXX_USE_CXX11_ABI=0 defined in pre-build versions of Qt?:

          Please ask on Interest mailing list, many developers who write Qt are present there.

          I have got answer from Interest mailing list.
          Summary:

          Q: Why the same Qt binaries may be used with different compilers (gcc 4.x, gcc 5.x) and other libraries cannot be used?
          A: GCC ABI was changed for standard library (https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html ). Qt does not depend on standard library. If other library depends on standard library then it will link with errors. Inline methods (like QString::toStdString, QVector::toStdVector, etc...) are fine because they are compiled with the same C++ ABI as used in the application

          Q: Is it possible for GCC 5.x to link with the library compiled by GCC 4.x?
          A: Yes. The old GCC ABI is still supported and can be used by defining the macro _GLIBCXX_USE_CXX11_ABI to 0 before including any C++ standard library headers (https://gcc.gnu.org/gcc-5/changes.html#libstdcxx ).

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by
          #4

          @blex said in Is _GLIBCXX_USE_CXX11_ABI=0 defined in pre-build versions of Qt?:

          I have got answer from Interest mailing list.

          Thank you for sharing it here as well!

          Read and abide by the Qt Code of Conduct

          1 Reply Last reply
          0
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            @blex thanks!

            (Z(:^

            1 Reply Last reply
            0
            • J Offline
              J Offline
              jdoubleu
              wrote on last edited by jdoubleu
              #6

              Came across the same issue today with Qt 6.7.2 on macOS Ventura when building my app with GCC 14.2.0 (in C++23 mode). That is, because Qt was built with Apple Clang (14.0.0) which does not set _GLIBCXX_USE_CXX11_ABI=1.

              Inline methods (like QString::toStdString, QVector::toStdVector, etc...) are fine because they are compiled with the same C++ ABI as used in the application.

              That does no longer seems to be the case, because QByteArray::toStdString() is not defined in its header.

              Just for reference, I get the following linker errors:

              Undefined symbols for architecture x86_64:
                "QByteArray::toStdString[abi:cxx11]() const", referenced from:
                    QString::toStdString[abi:cxx11]() const in main.cpp.o
              ld: symbol(s) not found for architecture x86_64
              
              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