Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Error when importing QJsonDocument
Qt 6.12 LTS is out! See what's new in the release blog

Error when importing QJsonDocument

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 778 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.
  • C Offline
    C Offline
    Creaperdown
    wrote on last edited by
    #1

    My CI suddenly failed building, giving me the following output:

     [5/138] Building CXX object src/domain/CMakeFiles/domain.dir/domain_autogen/mocs_compilation.cpp.o
    FAILED: src/domain/CMakeFiles/domain.dir/domain_autogen/mocs_compilation.cpp.o 
    /usr/bin/clang++ -DDOMAIN_LIBRARY -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_QMLINTEGRATION_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_QUICK_LIB -Ddomain_EXPORTS -I/home/runner/work/Librum/Librum/build-Release/src/domain/domain_autogen/include -I/home/runner/work/Librum/Librum/src/domain/entities -I/home/runner/work/Librum/Librum/src/domain/value_objects -I/home/runner/work/Librum/Librum/src/domain -isystem /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtCore -isystem /home/runner/work/Librum/Qt/6.5.3/gcc_64/include -isystem /home/runner/work/Librum/Qt/6.5.3/gcc_64/mkspecs/linux-g++ -isystem /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtQuick -isystem /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtGui -isystem /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtQml -isystem /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtQmlIntegration -isystem /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtNetwork -isystem /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtQmlModels -isystem /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtOpenGL -O3 -DNDEBUG -std=c++20 -fPIC -O3 -fPIC -MD -MT src/domain/CMakeFiles/domain.dir/domain_autogen/mocs_compilation.cpp.o -MF src/domain/CMakeFiles/domain.dir/domain_autogen/mocs_compilation.cpp.o.d -o src/domain/CMakeFiles/domain.dir/domain_autogen/mocs_compilation.cpp.o -c /home/runner/work/Librum/Librum/build-Release/src/domain/domain_autogen/mocs_compilation.cpp
    In file included from /home/runner/work/Librum/Librum/build-Release/src/domain/domain_autogen/mocs_compilation.cpp:2:
    In file included from /home/runner/work/Librum/Librum/build-Release/src/domain/domain_autogen/J5TXUQJNBW/moc_user.cpp:9:
    In file included from /home/runner/work/Librum/Librum/build-Release/src/domain/domain_autogen/J5TXUQJNBW/../../../../../src/domain/entities/user.hpp:5:
    In file included from /home/runner/work/Librum/Librum/src/domain/entities/tag.hpp:3:
    In file included from /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtCore/QJsonDocument:1:
    In file included from /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtCore/qjsondocument.h:7:
    In file included from /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtCore/qjsonvalue.h:10:
    In file included from /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtCore/qcborvalue.h:8:
    In file included from /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtCore/qdatetime.h:8:
    In file included from /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtCore/qcalendar.h:10:
    In file included from /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtCore/qlocale.h:7:
    In file included from /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtCore/qvariant.h:22:
    In file included from /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtCore/qobject.h:23:
    /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/chrono:2320:48: error: call to consteval function 'std::chrono::hh_mm_ss::_S_fractional_width' is not a constant expression
            static constexpr unsigned fractional_width = {_S_fractional_width()};
                                                          ^
    /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/chrono:2320:48: note: undefined function '_S_fractional_width' cannot be used in a constant expression
    /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/chrono:2275:2: note: declared here
            _S_fractional_width()
            ^
    1 error generated.
    

    Does someone have an idea what might cause this? The binary the error occurs in links to Qt6::Core.

    C 1 Reply Last reply
    0
    • Axel SpoerlA Offline
      Axel SpoerlA Offline
      Axel Spoerl
      Moderators
      wrote on last edited by
      #2

      Probably a CMakeLists.txt is broken.
      Which CMAKE_CXX_FLAGS do you set?
      -stdlib=libc++ -std=c++20?

      Software Engineer
      The Qt Company, Oslo

      1 Reply Last reply
      0
      • C Creaperdown

        My CI suddenly failed building, giving me the following output:

         [5/138] Building CXX object src/domain/CMakeFiles/domain.dir/domain_autogen/mocs_compilation.cpp.o
        FAILED: src/domain/CMakeFiles/domain.dir/domain_autogen/mocs_compilation.cpp.o 
        /usr/bin/clang++ -DDOMAIN_LIBRARY -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_QMLINTEGRATION_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_QUICK_LIB -Ddomain_EXPORTS -I/home/runner/work/Librum/Librum/build-Release/src/domain/domain_autogen/include -I/home/runner/work/Librum/Librum/src/domain/entities -I/home/runner/work/Librum/Librum/src/domain/value_objects -I/home/runner/work/Librum/Librum/src/domain -isystem /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtCore -isystem /home/runner/work/Librum/Qt/6.5.3/gcc_64/include -isystem /home/runner/work/Librum/Qt/6.5.3/gcc_64/mkspecs/linux-g++ -isystem /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtQuick -isystem /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtGui -isystem /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtQml -isystem /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtQmlIntegration -isystem /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtNetwork -isystem /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtQmlModels -isystem /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtOpenGL -O3 -DNDEBUG -std=c++20 -fPIC -O3 -fPIC -MD -MT src/domain/CMakeFiles/domain.dir/domain_autogen/mocs_compilation.cpp.o -MF src/domain/CMakeFiles/domain.dir/domain_autogen/mocs_compilation.cpp.o.d -o src/domain/CMakeFiles/domain.dir/domain_autogen/mocs_compilation.cpp.o -c /home/runner/work/Librum/Librum/build-Release/src/domain/domain_autogen/mocs_compilation.cpp
        In file included from /home/runner/work/Librum/Librum/build-Release/src/domain/domain_autogen/mocs_compilation.cpp:2:
        In file included from /home/runner/work/Librum/Librum/build-Release/src/domain/domain_autogen/J5TXUQJNBW/moc_user.cpp:9:
        In file included from /home/runner/work/Librum/Librum/build-Release/src/domain/domain_autogen/J5TXUQJNBW/../../../../../src/domain/entities/user.hpp:5:
        In file included from /home/runner/work/Librum/Librum/src/domain/entities/tag.hpp:3:
        In file included from /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtCore/QJsonDocument:1:
        In file included from /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtCore/qjsondocument.h:7:
        In file included from /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtCore/qjsonvalue.h:10:
        In file included from /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtCore/qcborvalue.h:8:
        In file included from /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtCore/qdatetime.h:8:
        In file included from /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtCore/qcalendar.h:10:
        In file included from /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtCore/qlocale.h:7:
        In file included from /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtCore/qvariant.h:22:
        In file included from /home/runner/work/Librum/Qt/6.5.3/gcc_64/include/QtCore/qobject.h:23:
        /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/chrono:2320:48: error: call to consteval function 'std::chrono::hh_mm_ss::_S_fractional_width' is not a constant expression
                static constexpr unsigned fractional_width = {_S_fractional_width()};
                                                              ^
        /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/chrono:2320:48: note: undefined function '_S_fractional_width' cannot be used in a constant expression
        /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/chrono:2275:2: note: declared here
                _S_fractional_width()
                ^
        1 error generated.
        

        Does someone have an idea what might cause this? The binary the error occurs in links to Qt6::Core.

        C Offline
        C Offline
        ChrisW67
        wrote on last edited by
        #3

        @Creaperdown said in Error when importing QJsonDocument:

        error: call to consteval function 'std::chrono::hh_mm_ss::_S_fractional_width'

        Googling the error message gives a range of similar messages. The general theme seems to be that older clang and libstdc++ (13) versions clash.
        See https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1918839.html for example.

        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
        • Unsolved