Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-73126

Build fails with: error: static_assert failed due to requirement 'bool(QAtomicOpsSupport<sizeof(unsigned long long)>::IsSupported)' "template parameter is an integral of a size not supported on this platform"

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P3: Somewhat important
    • None
    • 5.12.0
    • Build System
    • None
    • Arch Linux x86_64
    • Linux/Wayland, Linux/X11

    Description

      After a recent system upgrade, Qt builds started failing with the following compile error:

      clang++ -c -pipe -g -std=c++1z -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIC -DQT_NO_USING_NAMESPACE -DQT_NO_FOREACH -DELF_INTERPRETER=\"/lib64/ld-linux-x86-64.so.2\" -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_CORE_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -Wall -Wextra -Werror -Woverloaded-virtual -Wshadow -Wundef -Wfloat-equal -Wnon-virtual-dtor -Wpointer-arith -Wformat-security -Wno-long-long -Wno-variadic-macros -pedantic-errors -Wchar-subscripts -Wold-style-cast -Wcast-align -I/home/johan/dev/qt/dev/qtbase/src/corelib -I. -Iglobal -I/home/johan/dev/qt/dev/qtbase/src/3rdparty/harfbuzz/src -I/home/johan/dev/qt/dev/qtbase/src/3rdparty/md5 -I/home/johan/dev/qt/dev/qtbase/src/3rdparty/md4 -I/home/johan/dev/qt/dev/qtbase/src/3rdparty/sha3 -I/home/johan/dev/qt/dev/qtbase/src/3rdparty/forkfd -I/home/johan/dev/qt/dev/qtbase/src/3rdparty/tinycbor/src -I../../include -I../../include/QtCore -I../../include/QtCore/5.13.0 -I../../include/QtCore/5.13.0/QtCore -I.moc -I.tracegen -isystem /usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/home/johan/dev/qt/dev/qtbase/mkspecs/linux-clang -DQT_NO_CAST_TO_ASCII=1 -DQT_NO_CAST_FROM_ASCII=1 -UQT_RESTRICTED_CAST_FROM_ASCII -DQT_STRICT_ITERATORS -DQT_NO_URL_CAST_FROM_STRING=1 -DQT_NO_CAST_FROM_BYTEARRAY=1 -DQT_NO_KEYWORDS=1 -DQT_USE_QSTRINGBUILDER -DQT_USE_FAST_OPERATOR_PLUS -Dsignals=int -Dslots=int -Demit=public: -Dforeach=public: -Dforever=public: -xc++ /home/johan/dev/qt/dev/qtbase/src/corelib/tools/qscopedvaluerollback.h -o .obj/header_qscopedvaluerollback.o
      In file included from /home/johan/dev/qt/dev/qtbase/src/corelib/thread/qsemaphore.h:43:
      In file included from ../../include/QtCore/qglobal.h:1:
      In file included from ../../include/QtCore/../../../../../dev/qtbase/src/corelib/global/qglobal.h:1218:
      In file included from ../../include/QtCore/qatomic.h:1:
      In file included from ../../include/QtCore/../../../../../dev/qtbase/src/corelib/thread/qatomic.h:46:
      In file included from ../../include/QtCore/qbasicatomic.h:1:
      ../../include/QtCore/../../../../../dev/qtbase/src/corelib/thread/qbasicatomic.h:97:5: error: static_assert failed due to requirement 'bool(QAtomicOpsSupport<sizeof(unsigned long long)>::IsSupported)' "template parameter is an integral of a size not supported on this platform"
          Q_STATIC_ASSERT_X(QAtomicOpsSupport<sizeof(T)>::IsSupported, "template parameter is an integral of a size not supported on this platform");
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ../../include/QtCore/../../../../../dev/qtbase/src/corelib/global/qglobal.h:121:49: note: expanded from macro 'Q_STATIC_ASSERT_X'
      #  define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message)
                                                      ^             ~~~~~~~~~~~~~~~
      /home/johan/dev/qt/dev/qtbase/src/corelib/thread/qsemaphore.h:70:39: note: in instantiation of template class 'QBasicAtomicInteger<unsigned long long>' requested here
              QBasicAtomicInteger<quintptr> u;        // ### Qt6: make 64-bit
                                            ^
      1 error generated.
      make[3]: *** [Makefile:13293: .obj/header_qsemaphore.o] Error 1
      make[3]: *** Waiting for unfinished jobs....
      make[3]: Leaving directory '/home/johan/dev/qt/build/dev-no-server/qtbase/src/corelib'
      make[2]: *** [Makefile:173: sub-corelib-make_first] Error 2
      make[2]: Leaving directory '/home/johan/dev/qt/build/dev-no-server/qtbase/src'
      make[1]: *** [Makefile:51: sub-src-make_first] Error 2
      make[1]: Leaving directory '/home/johan/dev/qt/build/dev-no-server/qtbase'
      make: *** [Makefile:88: module-qtbase] Error 2
      

      I did a toplevel shadow-build from qt5.git

      config.opt:

      -commercial
      -confirm-license
      -developer-build
      -nomake
      examples
      -nomake
      tests
      -no-pch
      -no-warnings-are-errors
      -no-use-gold-linker
      -platform
      linux-clang
      -no-feature-vnc
      -no-linuxfb
      

      I looked a bit into it, and the reason for the failure seems to be that detection of libatomic fails (I looked at previous builds, and normally it succeeds).

      I started looking into why it's failing, and it seems to be because it can't find the include for "atomic". On my machine, it's located in /usr/include/c++/8.2.1/atomic. In config.log, I see the following:

      looking for library libatomic
      Trying source 0 (type inline) of library libatomic ...                                                                 atomic not found in [] and global paths.                                                                               cstdint not found in [] and global paths.
        => source produced no result.
      Trying source 1 (type inline) of library libatomic ...
      atomic not found in [] and global paths.
      cstdint not found in [] and global paths.
        => source produced no result.
      test config.qtbase_corelib.libraries.libatomic FAILED
      

      Looking further up the file, I see:

      Global lib dirs: [] [/usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1 /usr/lib /lib /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1]
      Global inc dirs: [] [/usr/include/c++/6.1.1 /usr/include/c++/6.1.1/x86_64-pc-linux-gnu /usr/include/c++/6.1.1/backward /usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/include /usr/local/include /usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/include-fixed /usr/include /usr/include/c++/6.3.1 /usr/include/c++/6.3.1/x86_64-pc-linux-gnu /usr/include/c++/6.3.1/backward /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/include /usr/local/include /usr/lib/gcc/x86_64-pc-linux-gnu/6.3.1/include-fixed /usr/include]
      

      So for some reason, It's looking in 6.11 and 6.3.1 instead of 8.2.1.

      I was curious why, and I started logging out QMAKE_DEFAULT_INCDIRS in various points where it's modified in qtbase/mkspecs/features/toolchain.prf and what's weird, is that I can't find any place where it's set to version 6, in fact, QMAKE_DEFAULT_INCDIRS seems to be already set to 6.11 when it's started. In fact, I put this at the first line in qt.pro:

      error("QMAKE_DEFAULT_INCDIRS $$QMAKE_DEFAULT_INCDIRS")
      

      And it prints:

      Creating qmake...
      ...........................................................................................Done.
      Project ERROR: QMAKE_DEFAULT_INCDIRS /usr/include/c++/6.1.1 /usr/include/c++/6.1.1/x86_64-pc-linux-gnu /usr/include/c++/6.1.1/backward /usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/include /usr/local/include /usr/lib/gcc/x86_64-pc-linux-gnu/6.1.1/include-fixed /usr/include
      

      Now what's even more curious, is that if I hit ctrl+c while configure is running the configure tests, and run configure again, QMAKE_DEFAULT_INCDIRS will be set to the 8.2.1 version, resulting in a successful build.

      Since I now have a successful build, I will resume working on what I was originally doing, but I thought I'd write this down in case someone else is hit by it and know how to fix it.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qtbuildsystem Qt Build System Team
              johanhelsing Johan Helsing
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes