Stellarium / stellarium

Stellarium is a free GPL software which renders realistic skies in real time with OpenGL. It is available for Linux/Unix, Windows and macOS. With Stellarium, you really see what you can see with your eyes, binoculars or a small telescope.
https://stellarium.org
GNU General Public License v2.0
7.8k stars 821 forks source link

Qt6.4 error: use of deleted function QVariant::QVariant(T) #2709

Closed carlosal1015 closed 2 years ago

carlosal1015 commented 2 years ago

Expected Behaviour

That the software compiles fine.

Actual Behaviour

Is throwing an error, either with qt5 or qt6.

System

==> Starting build()...
-- Found CMake 3.24.2
-- Platform: Linux-5.15.0-47-generic (x86_64)
-- Building Stellarium 1.0 (v1.22.3; Mode: None)
-- Found Qt6: /usr/lib/qt6/bin/qmake (found suitable version 6.4.0)
-- Building an OpenGL build
-- Found ShowMySky library: /usr/lib/libShowMySky.so
-- GPS: support by Qt's NMEA handling enabled.
-- GPS: using GPS library at /usr/lib/libgps.so (found suitable GPSD API version: 14.0)
-- Unit tests support: disabled
-- Using system-provided zlib at /usr/lib/libz.so
-- CPM: adding package QXlsx@1.4.4 (1.4.4)
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- CPM: adding package indiclient@1.8.5 (1.8.5)
-- Found lupdate: /usr/lib/qt6/bin/lupdate
-- Found lconvert: /usr/lib/qt6/bin/lconvert
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/makepkg/stellarium/src/build
[21/833] Building CXX object plugins/Satellites/src/CMakeFiles/Satellites-static.dir/Satellite.cpp.o
FAILED: plugins/Satellites/src/CMakeFiles/Satellites-static.dir/Satellite.cpp.o 
/usr/sbin/g++ -DCOPYRIGHT_YEARS=\"2000-2022\" -DENABLE_GPS -DENABLE_LIBGPS -DENABLE_MEDIA -DENABLE_NLS -DENABLE_SCRIPTING -DENABLE_SCRIPT_CONSOLE -DENABLE_SCRIPT_QML -DENABLE_SHOWMYSKY -DINSTALL_DATADIR=\"/usr/share/stellarium\" -DPACKAGE_VERSION=\"1.22.3\" -DQT_CORE_LIB -DQT_DLL -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_PLUGIN -DQT_WIDGETS_LIB -DSATELLITES_PLUGIN_IRIDIUM=0 -DSATELLITES_PLUGIN_LICENSE="\"GNU GPLv2 or later\"" -DSATELLITES_PLUGIN_VERSION=\"0.13.3\" -DSTELLARIUM_COPYRIGHT="\"Copyright (C) 2000-2022 Stellarium Developers\"" -DSTELLARIUM_DEV_URL=\"https://github.com/Stellarium/stellarium\" -DSTELLARIUM_MAJOR=1 -DSTELLARIUM_MINOR=22 -DSTELLARIUM_PATCH=3 -DSTELLARIUM_PUBLIC_VERSION=\"1.0\" -DSTELLARIUM_RELEASE_BUILD -DSTELLARIUM_SOURCE_DIR=\"/tmp/makepkg/stellarium/src/stellarium-1.0\" -DSTELLARIUM_URL=\"https://stellarium.org/\" -D_REENTRANT -D_USE_MATH_DEFINES -I/tmp/makepkg/stellarium/src/build/plugins/Satellites/src -I/tmp/makepkg/stellarium/src/stellarium-1.0/plugins/Satellites/src -I/tmp/makepkg/stellarium/src/build/plugins/Satellites/src/Satellites-static_autogen/include -I/tmp/makepkg/stellarium/src/build -I/tmp/makepkg/stellarium/src/stellarium-1.0/src -I/tmp/makepkg/stellarium/src/stellarium-1.0/src/core -I/tmp/makepkg/stellarium/src/stellarium-1.0/src/core/modules -I/tmp/makepkg/stellarium/src/stellarium-1.0/src/core/planetsephems -I/tmp/makepkg/stellarium/src/stellarium-1.0/src/gui -I/tmp/makepkg/stellarium/src/stellarium-1.0/src/scripting -I/tmp/makepkg/stellarium/src/build/src -I/tmp/makepkg/stellarium/src/stellarium-1.0/plugins/Satellites/src/. -I/tmp/makepkg/stellarium/src/stellarium-1.0/plugins/Satellites/src/gsatellite -I/tmp/makepkg/stellarium/src/stellarium-1.0/plugins/Satellites/src/gui -I/tmp/makepkg/stellarium/src/build/plugins/Satellites/src/gui -I/tmp/makepkg/stellarium/src/build/_deps/qxlsx-src/QXlsx/header -isystem /usr/include/qt6/QtCore -isystem /usr/include/qt6 -isystem /usr/lib/qt6/mkspecs/linux-g++ -isystem /usr/include/qt6/QtGui -isystem /usr/include/qt6/QtGui/6.4.0 -isystem /usr/include/qt6/QtGui/6.4.0/QtGui -isystem /usr/include/qt6/QtCore/6.4.0 -isystem /usr/include/qt6/QtCore/6.4.0/QtCore -isystem /usr/include/qt6/QtNetwork -isystem /usr/include/qt6/QtWidgets -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Wextra -Wno-unused-parameter -Wno-unknown-pragmas -Wno-unused-result -DQT_STATICPLUGIN -Wno-unused-parameter -fPIC -std=c++17 -MD -MT plugins/Satellites/src/CMakeFiles/Satellites-static.dir/Satellite.cpp.o -MF plugins/Satellites/src/CMakeFiles/Satellites-static.dir/Satellite.cpp.o.d -o plugins/Satellites/src/CMakeFiles/Satellites-static.dir/Satellite.cpp.o -c /tmp/makepkg/stellarium/src/stellarium-1.0/plugins/Satellites/src/Satellite.cpp
/tmp/makepkg/stellarium/src/stellarium-1.0/plugins/Satellites/src/Satellite.cpp: In member function ‘QVariantMap Satellite::getMap()’:
/tmp/makepkg/stellarium/src/stellarium-1.0/plugins/Satellites/src/Satellite.cpp:254:46: error: use of deleted function ‘QVariant::QVariant(T) [with T = char*; typename std::enable_if<disjunction_v<std::is_pointer<_Tp>, std::is_member_pointer<_Tp> >, bool>::type <anonymous> = false]’
  254 |         map["tle1"] = tleElements.first.data();
      |                                              ^
In file included from /usr/include/qt6/QtCore/qlocale.h:7,
                 from /usr/include/qt6/QtCore/qcalendar.h:10,
alex-w commented 2 years ago

Please try building with -DENABLE_QT6=0 flag

10110111 commented 2 years ago

Actually, the problem here seems to be with QT_NO_CAST_FROM_ASCII being defined. In this case QVariant::QVariant(const char*) constructor is not available (see the docs) — both in Qt 5 and 6.

But why is it defined — that's the question.

gzotti commented 2 years ago

I just added Qt6.4 to my Windows system. Indeed it no longer builds, blocks at the same line.

gzotti commented 2 years ago

Satellite.cpp line 791: Why do we convert a QString to a QByteArray and later back to QString? @alex-w ?

carlosal1015 commented 2 years ago

Please try building with -DENABLE_QT6=0 flag

Thanks, Arch Linux users will keep using qt5, with this workaround it is compiling fine. Feel free to reopen 😄 .

gzotti commented 2 years ago

Looks like a small bugfix. You should be able to use Qt6.2 or Qt6.3 if available.

alex-w commented 2 years ago

Satellite.cpp line 791: Why do we convert a QString to a QByteArray and later back to QString? @alex-w ?

TLE has formatted data and QByteArray allow manage the data by bytes. I think it can be changed (hello from Qt4 days...)

github-actions[bot] commented 2 years ago

Hello @carlosal1015!

OK, developers can reproduce the issue. Thanks for the report!

gzotti commented 2 years ago

On Qt6, use QString::sliced(pos, len). Or just a QRegularExpression?

alex-w commented 2 years ago

On Qt6, use QString::sliced(pos, len). Or just a QRegularExpression?

No need QRegularExpression

oldherl commented 2 years ago

Would you like to have a quick fix (by adding 'QString::fromUtf8( ... )') first before rewriting it to QString::sliced() ?

NickCao commented 2 years ago

The definition can be from Qxlsx: https://github.com/QtExcel/QXlsx/blob/3f19752a3c4441a83454c8a3cee70a7c897c9292/QXlsx/CMakeLists.txt#L146. I'm no cmake expert, but these definitions are marked as PRIVATE, it's strange that they end up being here. Edit: I'm looking at the wrong commit, https://github.com/QtExcel/QXlsx/blob/38c1ec81041524caec74bc8f4d3261b5872fa48e/QXlsx/CMakeLists.txt#L143 defines these as PUBLIC on v1.4.4.

gzotti commented 2 years ago

I think just avoiding the QByteArray as intermediate type would solve it.

github-actions[bot] commented 2 years ago

Hello @carlosal1015!

Please check the fresh version (development snapshot) of Stellarium: https://github.com/Stellarium/stellarium-data/releases/tag/weekly-snapshot

carlosal1015 commented 2 years ago

Ok, I applied the patch in order to use qt6.

github-actions[bot] commented 2 years ago

Hello @carlosal1015!

Please check the latest stable version of Stellarium: https://github.com/Stellarium/stellarium/releases/latest