Error when importing QJsonDocument
Unsolved
General and Desktop
-
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
. -
Probably a
CMakeLists.txt
is broken.
Which CMAKE_CXX_FLAGS do you set?
-stdlib=libc++ -std=c++20
? -
@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.