Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
carlosal1015 opened this issue Oct 1, 2022 · 16 comments
Closed

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

carlosal1015 opened this issue Oct 1, 2022 · 16 comments
Assignees
Labels
bug Something likely wrong in the code qt Issues, related to Qt framework state: confirmed A developer can reproduce the issue
Milestone

Comments

@carlosal1015
Copy link

Expected Behaviour

That the software compiles fine.

Actual Behaviour

Is throwing an error, either with qt5 or qt6.

System

  • Stellarium version: 1.0
  • Operating system: Arch Linux Rolling Release
==> 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 alex-w added the qt Issues, related to Qt framework label Oct 1, 2022
@alex-w
Copy link
Member

alex-w commented Oct 1, 2022

Please try building with -DENABLE_QT6=0 flag

@10110111
Copy link
Contributor

10110111 commented Oct 1, 2022

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
Copy link
Member

gzotti commented Oct 1, 2022

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

@gzotti
Copy link
Member

gzotti commented Oct 1, 2022

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

@gzotti gzotti added this to the 1.1 milestone Oct 1, 2022
@carlosal1015
Copy link
Author

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
Copy link
Member

gzotti commented Oct 1, 2022

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

@gzotti gzotti reopened this Oct 1, 2022
@gzotti gzotti changed the title error: use of deleted function QVariant::QVariant(T) Qt6.4 error: use of deleted function QVariant::QVariant(T) Oct 1, 2022
@alex-w
Copy link
Member

alex-w commented Oct 1, 2022

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...)

@alex-w alex-w added bug Something likely wrong in the code state: confirmed A developer can reproduce the issue labels Oct 1, 2022
@github-actions
Copy link

github-actions bot commented Oct 1, 2022

Hello @carlosal1015!

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

@gzotti
Copy link
Member

gzotti commented Oct 1, 2022

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

@alex-w
Copy link
Member

alex-w commented Oct 1, 2022

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

No need QRegularExpression

@oldherl
Copy link

oldherl commented Oct 2, 2022

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

@NickCao
Copy link

NickCao commented Oct 2, 2022

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
Copy link
Member

gzotti commented Oct 2, 2022

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

@gzotti gzotti self-assigned this Oct 2, 2022
@gzotti gzotti closed this as completed in 02feef1 Oct 2, 2022
@alex-w alex-w added the state: published The fix has been published for testing in weekly binary package label Oct 12, 2022
@github-actions
Copy link

Hello @carlosal1015!

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

@carlosal1015
Copy link
Author

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

@alex-w alex-w removed the state: published The fix has been published for testing in weekly binary package label Oct 31, 2022
@github-actions
Copy link

Hello @carlosal1015!

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something likely wrong in the code qt Issues, related to Qt framework state: confirmed A developer can reproduce the issue
Development

No branches or pull requests

6 participants