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

Build failure in the absence of QtWidget #977

Open
Etn40ff opened this issue Apr 9, 2024 · 20 comments · Fixed by #981
Open

Build failure in the absence of QtWidget #977

Etn40ff opened this issue Apr 9, 2024 · 20 comments · Fixed by #981

Comments

@Etn40ff
Copy link

Etn40ff commented Apr 9, 2024

Compilation fails if QtWidget is not available.

To reproduce, for example, try to compile with https://github.com/toltec-dev/toolchain:

# docker run  -it --rm -v /tmp/GammaRay:/tmp/GammaRay  ghcr.io/toltec-dev/qt
# cd /tmp/GammaRay
# cmake -DCMAKE_TOOLCHAIN_FILE=/usr/share/cmake/arm-linux-gnueabihf.cmake  -DCMAKE_PREFIX_PATH=/opt/x-tools/arm-remarkable-linux-gnueabihf/arm-remarkable-linux-gnueabihf/sysroot/usr/lib/ -DCMAKE_INSTALL_PREFIX=/tmp/prefix/ -DGAMMARAY_BUILD_UI=OFF
... Omissis ...
# make 
... Omissis ...
/tmp/GammaRay/launcher/cli/main.cpp: In function 'int main(int, char**)':
/tmp/GammaRay/launcher/cli/main.cpp:354:65: error: 'QApplication' has not been declared
  354 |         QObject::connect(&launcher, &Launcher::finished, &app, &QApplication::quit);
      |                                                                 ^~~~~~~~~~~~
/tmp/GammaRay/launcher/cli/main.cpp:355:65: error: 'QApplication' has not been declared
  355 |         QObject::connect(&launcher, &Launcher::attached, &app, &QApplication::quit);
      |                                                                 ^~~~~~~~~~~~
make[2]: *** [launcher/cli/CMakeFiles/gammaray.dir/build.make:90: launcher/cli/CMakeFiles/gammaray.dir/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1974: launcher/cli/CMakeFiles/gammaray.dir/all] Error 2

This happens because there is no #ifdef HAVE_QT_WIDGETS around lines 354 and 355 in launcher/cli/main.cpp.

I suppose when QtWidget is not available these should instead read?

QObject::connect(&launcher, &Launcher::finished, &app, &QCoreApplication::quit);
QObject::connect(&launcher, &Launcher::attached, &app, &QCoreApplication::quit);
@mattkdab
Copy link
Member

Widgets is required to build the GammaRay UI. Have you tested your proposed fix or tried to build without UI?

@Etn40ff
Copy link
Author

Etn40ff commented Apr 10, 2024

I was trying to package GammaRay for https://github.com/toltec-dev/toolchain to
remotely poke at Qt application on a Remarkable tablet. I was therefore building
without the UI; isn't this what -DGAMMARAY_BUILD_UI=OFF is supposed to do?

I am not sure that the change I propose are working as expected. On the one hand
the build succeeds without any further issue. On the other, when I try to use it
I get the following error. It looks like it is still trying to load a gui? (and
fails to setup the network plugin too.)

reMarkable: ~/ LD_LIBRARY_PATH="/lib:/usr/lib:/opt/usr/lib:/opt/lib/:/tmp/out/lib" /tmp/out/bin/gammaray --inject-only -i preload  /usr/bin/xochitl
Detected ABI qt5_15-arm, using ABI qt5_15-arm.
18:09:45.662 default                  QSocketNotifier: Can only be used with threads started with QThread
18:09:45.664 default                  2022-10-26T10:40:59Z heads/releases/magorg 7d05fd5dc1 (int main(int, char**) /usr/src/debug/xochitl/override+gitAUTOINC+7d05fd5dc1-r0/git/src/main.cpp:166)
Registering exit handlers
18:09:45.665 default                  we're running on an epaper device (int main(int, char**) /usr/src/debug/xochitl/override+gitAUTOINC+7d05fd5dc1-r0/git/src/main.cpp:173)
Reading waveforms from /usr/share/remarkable/320_R292_AFBC21_ED103TC2M1_TC.wbf
18:09:47.443 default                  EPD platform plugin loaded!
18:09:47.446 default                  QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
18:09:47.469 qt.qpa.input             evdevtouch: Using device discovery
18:09:47.478 qt.qpa.input             evdevtouch: Adding device at /dev/input/event2
18:09:47.479 qt.qpa.input             evdevtouch: Using device /dev/input/event2
18:09:47.480 default                  Lock in temp location (static void DocumentFiles::storeLockFilesInTemp(bool) /usr/src/debug/xochitl/override+gitAUTOINC+7d05fd5dc1-r0/git/src/worker/include/worker/documentfiles.h:193)
18:09:47.481 qt.qpa.input             evdevtouch: /dev/input/event2: Protocol type B  (multi), filtered=no
18:09:47.482 qt.qpa.input             evdevtouch: /dev/input/event2: min X: 0 max X: 1403
18:09:47.482 qt.qpa.input             evdevtouch: /dev/input/event2: min Y: 0 max Y: 1871
18:09:47.483 qt.qpa.input             evdevtouch: /dev/input/event2: min pressure: 0 max pressure: 0
18:09:47.483 qt.qpa.input             evdevtouch: /dev/input/event2: device name: pt_mt
usermod: existing lock file /etc/passwd.lock without a PID
usermod: cannot lock /etc/passwd; try again later.
18:09:47.553 rm.network.settings      Failed to run usermod 1
18:09:49.960 rm.user.featuretoggles   Failed parsing scoped value
18:09:54.674 default                  Could not create scene graph context for backend 'epaper' - check that plugins are installed correctly in /usr/lib/plugins
18:09:54.748 default                  qrc:/qml/device/system/SleepScreen.qml:16:5: QML Image: Cannot open: file:///usr/share/remarkable/sleeping.png (qrc:/qml/device/system/SleepScreen.qml:16)
18:09:55.254 default                  Creating window
18:09:55.442 default                  skipping static plugin  "" "org.qt-project.Qt.QPlatformInputContextFactoryInterface.5.1" (void GammaRay::PluginManagerBase::scan(const QString&) /tmp/bunion/GammaRay/common/pluginmanager.cpp:67)
error loading plugin /tmp/out/lib/gammaray/3.0/qt5_15-arm/gammaray_network.so: Cannot load library /tmp/out/lib/gammaray/3.0/qt5_15-arm/gammaray_network.so: (/tmp/out/lib/gammaray/3.0/qt5_15-arm/gammaray_network.so: undefined symbol: _ZN28QNetworkConfigurationManager16staticMetaObjectE, version Qt_5)
error loading plugin /tmp/out/lib/gammaray/3.0/qt5_15-arm/gammaray_network.so: Cannot load library /tmp/out/lib/gammaray/3.0/qt5_15-arm/gammaray_network.so: (/tmp/out/lib/gammaray/3.0/qt5_15-arm/gammaray_network.so: undefined symbol: _ZN28QNetworkConfigurationManager16staticMetaObjectE, version Qt_5)
Failed to cast object from /tmp/out/lib/gammaray/3.0/qt5_15-arm/gammaray_network.so to com.kdab.GammaRay.ToolFactory/1.0
error loading plugin /tmp/out/lib/gammaray/3.0/qt5_15-arm/gammaray_guisupport.so: Cannot load library /tmp/out/lib/gammaray/3.0/qt5_15-arm/gammaray_guisupport.so: (/tmp/out/lib/gammaray/3.0/qt5_15-arm/gammaray_guisupport.so: undefined symbol: _ZNK15QGuiApplication9sessionIdEv, version Qt_5)
error loading plugin /tmp/out/lib/gammaray/3.0/qt5_15-arm/gammaray_guisupport.so: Cannot load library /tmp/out/lib/gammaray/3.0/qt5_15-arm/gammaray_guisupport.so: (/tmp/out/lib/gammaray/3.0/qt5_15-arm/gammaray_guisupport.so: undefined symbol: _ZNK15QGuiApplication9sessionIdEv, version Qt_5)
Failed to cast object from /tmp/out/lib/gammaray/3.0/qt5_15-arm/gammaray_guisupport.so to com.kdab.GammaRay.ToolFactory/1.0
QFatal in xochitl (/usr/bin/xochitl)
START BACKTRACE:
1	/usr/lib/libQt5Core.so.5 ()
2	/usr/lib/libQt5Core.so.5 ()
3	QMessageLogger::fatal(char const*, ...) const ()
END BACKTRACE
18:09:55.840 default                  ASSERT: "GammaRay::MetaObjectRepository::instance()->hasMetaObject(QStringLiteral("QWindow"))" in file /tmp/bunion/GammaRay/plugins/quickinspector/quickinspector.cpp, line 972 (/tmp/bunion/GammaRay/plugins/quickinspector/quickinspector.cpp:972)
Injector error: Process crashed

@mattkdab
Copy link
Member

oops yes my mistake.
reproduced the build error in that docker environment. will be looking into this more heavily tomorrow

@mattkdab
Copy link
Member

mattkdab commented Apr 11, 2024

the loading of gammaray_guisupport.so is for introspection of Qt GUI objects in your application, not for GammaRay's own UI. the meta object for QWindow is registered here, which is why the assertion fails, because the shared lib isnt loaded.
does xochitl link against Qt::Gui ?

@Etn40ff
Copy link
Author

Etn40ff commented Apr 12, 2024

I think so:

# /opt/x-tools/arm-remarkable-linux-gnueabihf/bin/arm-linux-gnueabihf-ldd --root /mnt/sysroot/ /mnt/sysroot/usr/bin/xochitl
        libdatachannel.so.0.17.1 => /usr/lib/libdatachannel.so.0.17.1 (0xdeadbeef)
        libssl.so.1.1 => /usr/lib/libssl.so.1.1 (0xdeadbeef)
        libcrypto.so.1.1 => /usr/lib/libcrypto.so.1.1 (0xdeadbeef)
        libdl.so.2 => /lib/libdl.so.2 (0xdeadbeef)
        libc.so.6 => /lib/libc.so.6 (0xdeadbeef)
        ld-linux-armhf.so.3 => /lib/ld-linux-armhf.so.3 (0xdeadbeef)
        libpthread.so.0 => /lib/libpthread.so.0 (0xdeadbeef)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xdeadbeef)
        libm.so.6 => /lib/libm.so.6 (0xdeadbeef)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xdeadbeef)
        libpaho-mqttpp3.so.1 => /usr/lib/libpaho-mqttpp3.so.1 (0xdeadbeef)
        libpaho-mqtt3as.so.1 => /usr/lib/libpaho-mqtt3as.so.1 (0xdeadbeef)
        libz.so.1 => /lib/libz.so.1 (0xdeadbeef)
        libprotobuf.so.22 => /usr/lib/libprotobuf.so.22 (0xdeadbeef)
        libatomic.so.1 => /usr/lib/libatomic.so.1 (0xdeadbeef)
        libqt-rappor.so.1 => /usr/lib/libqt-rappor.so.1 (0xdeadbeef)
        libQt5Core.so.5 => /usr/lib/libQt5Core.so.5 (0xdeadbeef)
        libpcre2-16.so.0 => /usr/lib/libpcre2-16.so.0 (0xdeadbeef)
        libQtWebAppHttpServer.so.1 => /usr/lib/libQtWebAppHttpServer.so.1 (0xdeadbeef)
        libQtWebAppGlobal.so.1 => /usr/lib/libQtWebAppGlobal.so.1 (0xdeadbeef)
        libQt5Network.so.5 => /usr/lib/libQt5Network.so.5 (0xdeadbeef)
        libQt5WebSockets.so.5 => /usr/lib/libQt5WebSockets.so.5 (0xdeadbeef)
        libudev.so.1 => /lib/libudev.so.1 (0xdeadbeef)
        librt.so.1 => /lib/librt.so.1 (0xdeadbeef)
        libsystemd.so.0 => /lib/libsystemd.so.0 (0xdeadbeef)
        liblzma.so.5 => /usr/lib/liblzma.so.5 (0xdeadbeef)
        libcap.so.2 => /lib/libcap.so.2 (0xdeadbeef)
        libQt5DBus.so.5 => /usr/lib/libQt5DBus.so.5 (0xdeadbeef)
        libdbus-1.so.3 => /usr/lib/libdbus-1.so.3 (0xdeadbeef)
        libKF5Archive.so.5 => /usr/lib/libKF5Archive.so.5 (0xdeadbeef)
        libbz2.so.1 => /usr/lib/libbz2.so.1 (0xdeadbeef)
        libQt5Svg.so.5 => /usr/lib/libQt5Svg.so.5 (0xdeadbeef)
        libQt5Gui.so.5 => /usr/lib/libQt5Gui.so.5 (0xdeadbeef)
        libpng16.so.16 => /usr/lib/libpng16.so.16 (0xdeadbeef)
        libharfbuzz.so.0 => /usr/lib/libharfbuzz.so.0 (0xdeadbeef)
        libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0xdeadbeef)
        libpcre.so.1 => /usr/lib/libpcre.so.1 (0xdeadbeef)
        libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0xdeadbeef)
        libQt5Xml.so.5 => /usr/lib/libQt5Xml.so.5 (0xdeadbeef)
        libpdfium.so => /usr/lib/libpdfium.so (0xdeadbeef)
        libicuuc.so.66 => /usr/lib/libicuuc.so.66 (0xdeadbeef)
        libicudata.so.66 => /usr/lib/libicudata.so.66 (0xdeadbeef)
        liblcms2.so.2 => /usr/lib/liblcms2.so.2 (0xdeadbeef)
        libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0xdeadbeef)
        libQt5Quick.so.5 => /usr/lib/libQt5Quick.so.5 (0xdeadbeef)
        libQt5QmlModels.so.5 => /usr/lib/libQt5QmlModels.so.5 (0xdeadbeef)
        libQt5Qml.so.5 => /usr/lib/libQt5Qml.so.5 (0xdeadbeef)
        libcrypt.so.2 => /usr/lib/libcrypt.so.2 (0xdeadbeef)

@mattkdab
Copy link
Member

weird, nm reveals that those symbols _ZNK15QGuiApplication9sessionIdEv and _ZN28QNetworkConfigurationManager16staticMetaObjectE are also undefined on my system, but loading the shared objects is successful for me.
@Waqar144 do you have any ideas what may be causing this issue?

@Cuperino
Copy link
Member

Cuperino commented Apr 16, 2024

@mattkdab The change being proposed by Etn40ff is correct and should be committed into GammaRay. As for the rest of the issue, it all boils down to the missing or unaligned symbols...

I thought for a moment that xochitl might be statically compiled, which would prevent plugins from loading on GammaRay making it unusable in this situation; but that is not the case, as we can see by looking at the file extension of the libraries returned by nm (.so meaning dynamic loaded libraries).

The actual cause for this bug would lie somewhere in-between the CMakeLists.txt files of those plugins, the meta-programming being referenced by qFatal, the following plugin's loading error:

error loading plugin /tmp/out/lib/gammaray/3.0/qt5_15-arm/gammaray_guisupport.so: Cannot load library /tmp/out/lib/gammaray/3.0/qt5_15-arm/gammaray_guisupport.so: (/tmp/out/lib/gammaray/3.0/qt5_15-arm/gammaray_guisupport.so: undefined symbol: _ZNK15QGuiApplication9sessionIdEv, version Qt_5)
error loading plugin /tmp/out/lib/gammaray/3.0/qt5_15-arm/gammaray_guisupport.so: Cannot load library /tmp/out/lib/gammaray/3.0/qt5_15-arm/gammaray_guisupport.so: (/tmp/out/lib/gammaray/3.0/qt5_15-arm/gammaray_guisupport.so: undefined symbol: _ZNK15QGuiApplication9sessionIdEv, version Qt_5)
Failed to cast object from /tmp/out/lib/gammaray/3.0/qt5_15-arm/gammaray_guisupport.so to com.kdab.GammaRay.ToolFactory/1.0

The qFatal's line being quoted is different from the line making the assertion:

START BACKTRACE:
1	/usr/lib/libQt5Core.so.5 ()
2	/usr/lib/libQt5Core.so.5 ()
3	QMessageLogger::fatal(char const*, ...) const ()
END BACKTRACE
18:09:55.840 default                  ASSERT: "GammaRay::MetaObjectRepository::instance()->hasMetaObject(QStringLiteral("QWindow"))" in file /tmp/bunion/GammaRay/plugins/quickinspector/quickinspector.cpp, line 972 (/tmp/bunion/GammaRay/plugins/quickinspector/quickinspector.cpp:972)

The quoted line resolves to MO_ADD_METAOBJECT2(QWindow, QObject, QSurface); which gets executed from GuiSupport's constructor.

That means QWindow is unavailable from within GuiSupport, which makes no sense considering it's imported in the very file (guisupport.cpp), which is a part of gammaray_guisupport_srcs in the plugin's CMakeLists.txt, which suggests the problem isn't in GammaRay's code, but somewhere on the toolchain.

My working hypothesis is that the version of Qt used to build xochitl doesn't exactly match the one found in the one on the Toltec Qt Docker toolchain. Since xochitl is a part of Remarkable tablet, and very likely not built using that toolchain, this has some probability to it.

I don't know of a quick way to confirm this theory. @Etn40ff What I'd do is go through previous versions of the toolkit, all the way back to the last toolkit that was officially published by Remarkable (which can be found here), and see on which version does it work, if any does match and this turns out to be the cause.

@Cuperino
Copy link
Member

@Etn40ff Another KDABian, David Faure, says that one case where the QGuiApplication::sessionId() const symbol is missing is when Qt is built with QT_NO_SESSIONMANAGER.

Try compiling GammaRay with plugins/guisupport/guisupport.cpp:192: MO_ADD_PROPERTY_RO(QGuiApplication, sessionId); commented out and see if the GUI support plugin loads then.

@Etn40ff
Copy link
Author

Etn40ff commented Apr 16, 2024

I just gave your suggestions a spin without much success. I tried with several instances of toltec's toolchain and various sysroots and also commented out line 192 in guisupport.cpp. Neither test had any effect. I will try to setup the toolchain you mentioned to see if anything happens.

@Etn40ff
Copy link
Author

Etn40ff commented Apr 16, 2024

Things are more promising with the official toolchain that you can get from here: https://remarkable.guide/devel/toolchains.html#installer

GammaRay does not compile with it because one of the two proplematic symbols is not there. Once I fix this probably it will fail for the other.

In file included from /opt/codex/rm11x/3.1.15/sysroots/cortexa7hf-neon-remarkable-linux-gnueabi/usr/include/QtCore/qvariant.h:46,
                 from /opt/codex/rm11x/3.1.15/sysroots/cortexa7hf-neon-remarkable-linux-gnueabi/usr/include/QtCore/qabstractitemmodel.h:43,
                 from /opt/codex/rm11x/3.1.15/sysroots/cortexa7hf-neon-remarkable-linux-gnueabi/usr/include/QtCore/QAbstractTableModel:1,
                 from /tmp/bunion/GammaRay/plugins/network/cookies/cookiejarmodel.h:17,
                 from /tmp/bunion/GammaRay/plugins/network/gammaray_network_autogen/OLEVYTESI7/moc_cookiejarmodel.cpp:10,
                 from /tmp/bunion/GammaRay/plugins/network/gammaray_network_autogen/mocs_compilation.cpp:2:
/tmp/bunion/GammaRay/plugins/network/networkconfigurationmodel.h:28:20: error: 'QNetworkConfiguration' was not declared in this scope; did you mean 'QNetworkConfigurationManager'?
   28 | Q_DECLARE_METATYPE(QNetworkConfiguration::Purpose)
      |                    ^~~~~~~~~~~~~~~~~~~~~
/tmp/bunion/GammaRay/plugins/network/networkconfigurationmodel.h:28:1: error: template argument 1 is invalid
   28 | Q_DECLARE_METATYPE(QNetworkConfiguration::Purpose)
      | ^~~~~~~~~~~~~~~~~~
/tmp/bunion/GammaRay/plugins/network/networkconfigurationmodel.h:29:20: error: 'QNetworkConfiguration' was not declared in this scope; did you mean 'QNetworkConfigurationManager'?
   29 | Q_DECLARE_METATYPE(QNetworkConfiguration::StateFlags)
      |                    ^~~~~~~~~~~~~~~~~~~~~
/tmp/bunion/GammaRay/plugins/network/networkconfigurationmodel.h:29:1: error: template argument 1 is invalid
   29 | Q_DECLARE_METATYPE(QNetworkConfiguration::StateFlags)
      | ^~~~~~~~~~~~~~~~~~
/tmp/bunion/GammaRay/plugins/network/networkconfigurationmodel.h:30:20: error: 'QNetworkConfiguration' was not declared in this scope; did you mean 'QNetworkConfigurationManager'?
   30 | Q_DECLARE_METATYPE(QNetworkConfiguration::Type)
      |                    ^~~~~~~~~~~~~~~~~~~~~
/tmp/bunion/GammaRay/plugins/network/networkconfigurationmodel.h:30:1: error: template argument 1 is invalid
   30 | Q_DECLARE_METATYPE(QNetworkConfiguration::Type)
      | ^~~~~~~~~~~~~~~~~~
In file included from /tmp/bunion/GammaRay/plugins/network/gammaray_network_autogen/EWIEGA46WW/moc_networkconfigurationmodel.cpp:10,
                 from /tmp/bunion/GammaRay/plugins/network/gammaray_network_autogen/mocs_compilation.cpp:3:
/tmp/bunion/GammaRay/plugins/network/networkconfigurationmodel.h:51:35: error: 'QNetworkConfiguration' does not name a type; did you mean 'NetworkConfigurationModel'?
   51 |     void configurationAdded(const QNetworkConfiguration &config);
      |                                   ^~~~~~~~~~~~~~~~~~~~~
      |                                   NetworkConfigurationModel
/tmp/bunion/GammaRay/plugins/network/networkconfigurationmodel.h:52:37: error: 'QNetworkConfiguration' does not name a type; did you mean 'NetworkConfigurationModel'?
   52 |     void configurationChanged(const QNetworkConfiguration &config);
      |                                     ^~~~~~~~~~~~~~~~~~~~~
      |                                     NetworkConfigurationModel
/tmp/bunion/GammaRay/plugins/network/networkconfigurationmodel.h:53:37: error: 'QNetworkConfiguration' does not name a type; did you mean 'NetworkConfigurationModel'?
   53 |     void configurationRemoved(const QNetworkConfiguration &config);
      |                                     ^~~~~~~~~~~~~~~~~~~~~
      |                                     NetworkConfigurationModel
/tmp/bunion/GammaRay/plugins/network/networkconfigurationmodel.h:56:17: error: 'QNetworkConfiguration' was not declared in this scope; did you mean 'NetworkConfigurationModel'?
   56 |     std::vector<QNetworkConfiguration> m_configs;
      |                 ^~~~~~~~~~~~~~~~~~~~~
      |                 NetworkConfigurationModel
/tmp/bunion/GammaRay/plugins/network/networkconfigurationmodel.h:56:38: error: template argument 1 is invalid
   56 |     std::vector<QNetworkConfiguration> m_configs;
      |                                      ^
/tmp/bunion/GammaRay/plugins/network/networkconfigurationmodel.h:56:38: error: template argument 2 is invalid
make[2]: *** [plugins/network/CMakeFiles/gammaray_network.dir/build.make:63: plugins/network/CMakeFiles/gammaray_network.dir/gammaray_network_autogen/mocs_compilation.cpp.o] Error 1
make[2]: Leaving directory '/tmp/bunion/GammaRay'
make[1]: *** [CMakeFiles/Makefile2:2869: plugins/network/CMakeFiles/gammaray_network.dir/all] Error 2
make[1]: Leaving directory '/tmp/bunion/GammaRay'
make: *** [Makefile:163: all] Error 2

@Cuperino
Copy link
Member

GammaRay's CMake is finding that you have Qt 5 available in this toolkit, which allows plugins/network/CMakeLists.txt#27 to include networkconfigurationmodel.h. This is a problem because now you're compiling against Qt 6, where QNetworkConfiguration is no longer available. Commenting out that line will work around your issue.

Let us know if you get other errors like this, because it's just a matter of using a different and better way to tell which mayor version of Qt is actually being used.

Make sure that you know which version of Qt is being used by the app you want to inspect. If the version doesn't exactly match, GammaRay won't inject or randomly crash during use.

Cuperino added a commit that referenced this issue Apr 17, 2024
Fixes #977 by making suggested change to connect to QCoreApplication
Cuperino added a commit that referenced this issue Apr 17, 2024
Fixes #977 by making suggested change to connect to QCoreApplication
@Cuperino
Copy link
Member

@Etn40ff Try again with the latest master. There should be no errors like the one you experienced yesterday and I've included the change proposed in your first comment. If anything is left to be resolved it should be the issue with the missing symbols.

@Cuperino Cuperino added the bug label Apr 17, 2024
@Etn40ff
Copy link
Author

Etn40ff commented Apr 17, 2024

Thanks again for your support. Things are better but not working yet.

With a qt5 toolchain:

[ 81%] Building CXX object plugins/network/CMakeFiles/gammaray_network.dir/gammaray_network_autogen/mocs_compilation.cpp.o
In file included from /opt/codex/rm11x/3.1.15/sysroots/cortexa7hf-neon-remarkable-linux-gnueabi/usr/include/QtCore/qvariant.h:46,
                 from /opt/codex/rm11x/3.1.15/sysroots/cortexa7hf-neon-remarkable-linux-gnueabi/usr/include/QtCore/qabstractitemmodel.h:43,
                 from /opt/codex/rm11x/3.1.15/sysroots/cortexa7hf-neon-remarkable-linux-gnueabi/usr/include/QtCore/QAbstractTableModel:1,
                 from /tmp/bunion/GammaRay-new/plugins/network/cookies/cookiejarmodel.h:17,
                 from /tmp/bunion/GammaRay-new/plugins/network/gammaray_network_autogen/OLEVYTESI7/moc_cookiejarmodel.cpp:10,
                 from /tmp/bunion/GammaRay-new/plugins/network/gammaray_network_autogen/mocs_compilation.cpp:2:
/tmp/bunion/GammaRay-new/plugins/network/networkconfigurationmodel.h:28:20: error: 'QNetworkConfiguration' was not declared in this scope; did you mean 'QNetworkConfigurationManager'?
   28 | Q_DECLARE_METATYPE(QNetworkConfiguration::Purpose)
      |                    ^~~~~~~~~~~~~~~~~~~~~
/tmp/bunion/GammaRay-new/plugins/network/networkconfigurationmodel.h:28:1: error: template argument 1 is invalid
   28 | Q_DECLARE_METATYPE(QNetworkConfiguration::Purpose)
      | ^~~~~~~~~~~~~~~~~~
/tmp/bunion/GammaRay-new/plugins/network/networkconfigurationmodel.h:29:20: error: 'QNetworkConfiguration' was not declared in this scope; did you mean 'QNetworkConfigurationManager'?
   29 | Q_DECLARE_METATYPE(QNetworkConfiguration::StateFlags)
      |                    ^~~~~~~~~~~~~~~~~~~~~
/tmp/bunion/GammaRay-new/plugins/network/networkconfigurationmodel.h:29:1: error: template argument 1 is invalid
   29 | Q_DECLARE_METATYPE(QNetworkConfiguration::StateFlags)
      | ^~~~~~~~~~~~~~~~~~
/tmp/bunion/GammaRay-new/plugins/network/networkconfigurationmodel.h:30:20: error: 'QNetworkConfiguration' was not declared in this scope; did you mean 'QNetworkConfigurationManager'?
   30 | Q_DECLARE_METATYPE(QNetworkConfiguration::Type)
      |                    ^~~~~~~~~~~~~~~~~~~~~
/tmp/bunion/GammaRay-new/plugins/network/networkconfigurationmodel.h:30:1: error: template argument 1 is invalid
   30 | Q_DECLARE_METATYPE(QNetworkConfiguration::Type)
      | ^~~~~~~~~~~~~~~~~~
In file included from /tmp/bunion/GammaRay-new/plugins/network/gammaray_network_autogen/EWIEGA46WW/moc_networkconfigurationmodel.cpp:10,
                 from /tmp/bunion/GammaRay-new/plugins/network/gammaray_network_autogen/mocs_compilation.cpp:3:
/tmp/bunion/GammaRay-new/plugins/network/networkconfigurationmodel.h:51:35: error: 'QNetworkConfiguration' does not name a type; did you mean 'NetworkConfigurationModel'?
   51 |     void configurationAdded(const QNetworkConfiguration &config);
      |                                   ^~~~~~~~~~~~~~~~~~~~~
      |                                   NetworkConfigurationModel
/tmp/bunion/GammaRay-new/plugins/network/networkconfigurationmodel.h:52:37: error: 'QNetworkConfiguration' does not name a type; did you mean 'NetworkConfigurationModel'?
   52 |     void configurationChanged(const QNetworkConfiguration &config);
      |                                     ^~~~~~~~~~~~~~~~~~~~~
      |                                     NetworkConfigurationModel
/tmp/bunion/GammaRay-new/plugins/network/networkconfigurationmodel.h:53:37: error: 'QNetworkConfiguration' does not name a type; did you mean 'NetworkConfigurationModel'?
   53 |     void configurationRemoved(const QNetworkConfiguration &config);
      |                                     ^~~~~~~~~~~~~~~~~~~~~
      |                                     NetworkConfigurationModel
/tmp/bunion/GammaRay-new/plugins/network/networkconfigurationmodel.h:56:17: error: 'QNetworkConfiguration' was not declared in this scope; did you mean 'NetworkConfigurationModel'?
   56 |     std::vector<QNetworkConfiguration> m_configs;
      |                 ^~~~~~~~~~~~~~~~~~~~~
      |                 NetworkConfigurationModel
/tmp/bunion/GammaRay-new/plugins/network/networkconfigurationmodel.h:56:38: error: template argument 1 is invalid
   56 |     std::vector<QNetworkConfiguration> m_configs;
      |                                      ^
/tmp/bunion/GammaRay-new/plugins/network/networkconfigurationmodel.h:56:38: error: template argument 2 is invalid
make[2]: *** [plugins/network/CMakeFiles/gammaray_network.dir/build.make:63: plugins/network/CMakeFiles/gammaray_network.dir/gammaray_network_autogen/mocs_compilation.cpp.o] Error 1
make[2]: Leaving directory '/tmp/bunion/GammaRay-new'
make[1]: *** [CMakeFiles/Makefile2:2869: plugins/network/CMakeFiles/gammaray_network.dir/all] Error 2
make[1]: Leaving directory '/tmp/bunion/GammaRay-new'
make: *** [Makefile:163: all] Error 2

and with a Qt6 toolchain:

[ 73%] Building CXX object plugins/quickinspector/CMakeFiles/gammaray_quickinspector.dir/quickinspector.cpp.o
/tmp/bunion/GammaRay-new/plugins/quickinspector/quickinspector.cpp:73:10: fatal error: private/qquickshadereffectsource_p.h: No such file or directory
   73 | #include <private/qquickshadereffectsource_p.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [plugins/quickinspector/CMakeFiles/gammaray_quickinspector.dir/build.make:104: plugins/quickinspector/CMakeFiles/gammaray_quickinspector.dir/quickinspector.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2216: plugins/quickinspector/CMakeFiles/gammaray_quickinspector.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

@Cuperino
Copy link
Member

@Etn40ff It looks like the Qt 5 toolchain is actually trying to build with Qt 6, because otherwise QNetworkConfiguration would've been found as it was only removed in Qt 6. In the same way, it looks like the Qt 6 toolchain is trying to build with Qt 5, because private/qquickshadereffectsource_p.h is the old path to that file, which was moved in Qt 6.

Try passing -DQT_VERSION_MAJOR=5 to cmake when building against Qt 5, and changing the number to 6 respectively for Qt 6. QT_VERSION_MAJOR gets automatically cached by CMake, so you should also do a clean build and maybe delete CMakeLists.txt.user, just in case.

@Etn40ff
Copy link
Author

Etn40ff commented Apr 17, 2024

I tried without success: I got precisely the same two errors.

If what you say about relocation is correct something is fishy about these toolchains:

# find /opt/codex -iname qquickshadereffectsource_p.h
/opt/codex/rm11x/3.1.15/sysroots/cortexa7hf-neon-remarkable-linux-gnueabi/usr/src/debug/qtdeclarative/5.15.1+gitAUTOINC+02c499996b-r0/git/src/quick/items/qquickshadereffectsource_p.h
/opt/codex/rm11x/3.1.15/sysroots/cortexa7hf-neon-remarkable-linux-gnueabi/usr/include/QtQuick/5.15.1/QtQuick/private/qquickshadereffectsource_p.h
/opt/codex/rm2/4.0.367/sysroots/x86_64-codexsdk-linux/usr/include/QtQuick/6.5.2/QtQuick/private/qquickshadereffectsource_p.h

Is it possible that qquickshadereffectsource_p.h was not relocated in early versions of Qt6?

@Cuperino
Copy link
Member

Hmm... No, you're right, I mistakenly compared source paths against binary paths. Now that I check again, both paths remain consistent across all versions of Qt (checked from 5.10.1 to 6.7.0).

qquickshadereffectsource_p.h is a private header. Some Linux distributions put them in separate packages, but you just proved that they're installed... It should've become accessible with plugins/quickinspector/CMakeLists.txt#87 Qt::QuickPrivate. I think it's something with the CMake configuration. The first error (the one one with Qt 5) at least should've changed.

@mattkdab mattkdab reopened this Apr 17, 2024
@Cuperino Cuperino added user setup and removed bug labels Apr 17, 2024
@Etn40ff
Copy link
Author

Etn40ff commented Apr 20, 2024

I am still trying to figure out why is this not compiling. As it turns out qquickshadereffectsource_p.h is available in the qt6 toolchain I linked above but not in the associated sysroot. Do you have any good advice on how to fix this issue?

@Cuperino
Copy link
Member

@Etn40ff Try specifying -DCMAKE_PREFIX_PATH=path/to/toolchain/root -DCMAKE_INSTALL_PREFIX=path/to/sysroot on your first call to cmake. That'll have cmake find the dependencies needed to compile the software and place the binaries on your desired sysroot when you run cmake --install.

@Eeems
Copy link

Eeems commented May 27, 2024

https://github.com/toltec-dev/toolchain/blob/faa26ae58cc1cc1222f8ef2b7090cee8bb82c554/qt/Dockerfile#L6-L47
This is the steps used by the toltec toolchain to build qt to match what is provided in the SDK. It's possible that https://github.com/reMarkable/qtbase is the only publicly exposed qt repo from rM, and that they have other ones in their private repos that would cause differences in the build. They haven't put any qt6 related stuff out yet other than what would be in the sdk files.

I thought for a moment that xochitl might be statically compiled, which would prevent plugins from loading on GammaRay making it unusable in this situation; but that is not the case, as we can see by looking at the file extension of the libraries returned by nm (.so meaning dynamic loaded libraries).

xochitl does have some statically compiled libraries. I don't expect that they would cause issues, but there is a chance that they are implementing something here that obfuscates the symbols so they are no longer in use.

@Cuperino
Copy link
Member

Cuperino commented Jun 7, 2024

xochitl does have some statically compiled libraries. I don't expect that they would cause issues

As long as Qt libraries aren't among the statically compiled libraries it should be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants