ros-industrial / ros_qtc_plugin

ROS Qt Creator Plug-in (https://ros-qtc-plugin.readthedocs.io)
396 stars 213 forks source link

Segmentation fault (core dumped) when creating or opening ros project #508

Closed Tomas-Deane closed 3 weeks ago

Tomas-Deane commented 1 month ago

I am new to ros and trying to get qtcreator working with a ros project. Distro=Foxy, Build System=Colcon, OS=Ubuntu 20.04

I am launching qtcreator through the terminal, first sourcing /opt/ros/foxy/setup.bash, then sourcing install/setup.bash

With qtcreator-ros installed through snap when I create a ros project (foxy, colcon) qt crashes after creating only the .workspace file:

intel@intelnuc3:~/ros2qtlast$ qtcreator-ros
Failed to create wl_display (No such file or directory)
qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "" even though it was found.
"Previously SDK provided CMakeTool \"/home/intel/Qt/Tools/CMake/bin/cmake\" (qt.tools.cmake) dropped."
Segmentation fault (core dumped)

I can reopen this project using the created .workspace file (only when installed through snap). With no CMakeLists.txt in the project im unsure how to make the packages in the src folder visible in qt. And when trying to build the project this is the compile output:

10:23:47: Running steps for project ros2qtlast...
10:23:47: Starting: "/usr/bin/colcon" build --event-handlers status+ console_start_end+ --cmake-args -G 'CodeBlocks - Unix Makefiles' -DCMAKE_BUILD_TYPE=Debug
Traceback (most recent call last):
  File "/usr/bin/colcon", line 33, in <module>
    sys.exit(load_entry_point('colcon-core==0.16.1', 'console_scripts', 'colcon')())
  File "/usr/lib/python3/dist-packages/colcon_core/command.py", line 118, in main
    return _main(command_name=command_name, argv=argv)
  File "/usr/lib/python3/dist-packages/colcon_core/command.py", line 185, in _main
    create_log_path(args.verb_name)
  File "/usr/lib/python3/dist-packages/colcon_core/location.py", line 186, in create_log_path
    os.makedirs(str(path))
  File "/usr/lib/python3.8/os.py", line 213, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File "/usr/lib/python3.8/os.py", line 223, in makedirs
    mkdir(name, mode)
OSError: [Errno 38] Function not implemented: 'log'
10:23:47: The process "/usr/bin/colcon" exited with code 1.
Error while building/deploying project ros2qtlast (kit: Desktop)
When executing step "Colcon Step"
10:23:47: Elapsed time: 00:01.

When following the manual installation guide in the readme then this is the output when creating a ros project (again only the .workspace file is created before the crash):

intel@intelnuc3:~/ros2qtlast$ ~/Qt/Tools/QtCreator/bin/qtcreator
Failed to initialize instances shared memory:  "QSharedMemory::handle: doesn't exist"
qt.core.qobject.connect: QObject::connect: Cannot connect (nullptr)::usageStatisticsNotifier(QString) to UsageStatistic::Internal::QmlDesignerUsageEventSource::handleUsageStatisticsNotifier(QString)
qt.core.qobject.connect: QObject::connect: Cannot connect (nullptr)::usageStatisticsUsageTimer(QString, int) to UsageStatistic::Internal::QmlDesignerUsageEventSource::handleUsageStatisticsUsageTimer(QString, int)
qt.core.qobject.connect: QObject::connect: Cannot connect (nullptr)::usageStatisticsUsageDuration(QString, int) to UsageStatistic::Internal::QmlDesignerUsageEventSource::handleUsageStatisticsUsageDuration(QString, int)
qt.core.qobject.connect: QObject::connect: Cannot connect (nullptr)::usageStatisticsInsertFeedback(QString, QString, int) to UsageStatistic::Internal::QmlDesignerUsageEventSource::insertFeedback(QString, QString, int)
qt.core.qobject.connect: QObject::connect: Cannot connect UsageStatistic::Internal::QmlDesignerUsageEventSource::launchPopup(QString) to (nullptr)::lauchFeedbackPopup(QString)
SOFT ASSERT [17:24:54.586]: "KitManager::isLoaded()" in /home/qt/work/build/qt-creator/src/plugins/projectexplorer/kitmanager.cpp:575
qt.tlsbackend.ossl: Incompatible version of OpenSSL (built with OpenSSL >= 3.x, runtime version is < 3.x)
qt.network.ssl: The backend "cert-only" does not support QSslKey
qt.network.ssl: Active TLS backend does not support key creation
qt.network.ssl: The backend "cert-only" does not support QSslKey
qt.network.ssl: Active TLS backend does not support key creation
qt.network.ssl: The backend "cert-only" does not support QSslKey
qt.network.ssl: Active TLS backend does not support key creation
qt.network.ssl: The backend "cert-only" does not support QSslKey
qt.network.ssl: Active TLS backend does not support key creation
qt.network.ssl: The backend "cert-only" does not support QSslKey
qt.network.ssl: Active TLS backend does not support key creation
qt.network.ssl: The backend "cert-only" does not support QSslKey
qt.network.ssl: Active TLS backend does not support key creation
qt.network.ssl: The backend "cert-only" does not support QSslSocket
qt.network.ssl: The backend named "cert-only" does not support TLS
qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed
org.kde.UserFeedback: failed to submit user feedback: "TLS initialization failed" "" . Calling scheduleNextSubmission with minTime 2 minutes
Segmentation fault (core dumped)

And the output when trying to reopen that project:

intel@intelnuc3:~/ros2qtlast$ ~/Qt/Tools/QtCreator/bin/qtcreator
Failed to initialize instances shared memory:  "QSharedMemory::handle: doesn't exist"
qt.core.qobject.connect: QObject::connect: Cannot connect (nullptr)::usageStatisticsNotifier(QString) to UsageStatistic::Internal::QmlDesignerUsageEventSource::handleUsageStatisticsNotifier(QString)
qt.core.qobject.connect: QObject::connect: Cannot connect (nullptr)::usageStatisticsUsageTimer(QString, int) to UsageStatistic::Internal::QmlDesignerUsageEventSource::handleUsageStatisticsUsageTimer(QString, int)
qt.core.qobject.connect: QObject::connect: Cannot connect (nullptr)::usageStatisticsUsageDuration(QString, int) to UsageStatistic::Internal::QmlDesignerUsageEventSource::handleUsageStatisticsUsageDuration(QString, int)
qt.core.qobject.connect: QObject::connect: Cannot connect (nullptr)::usageStatisticsInsertFeedback(QString, QString, int) to UsageStatistic::Internal::QmlDesignerUsageEventSource::insertFeedback(QString, QString, int)
qt.core.qobject.connect: QObject::connect: Cannot connect UsageStatistic::Internal::QmlDesignerUsageEventSource::launchPopup(QString) to (nullptr)::lauchFeedbackPopup(QString)
SOFT ASSERT [17:36:25.579]: "KitManager::isLoaded()" in /home/qt/work/build/qt-creator/src/plugins/projectexplorer/kitmanager.cpp:575
qt.tlsbackend.ossl: Incompatible version of OpenSSL (built with OpenSSL >= 3.x, runtime version is < 3.x)
qt.network.ssl: The backend "cert-only" does not support QSslKey
qt.network.ssl: Active TLS backend does not support key creation
qt.network.ssl: The backend "cert-only" does not support QSslKey
qt.network.ssl: Active TLS backend does not support key creation
qt.network.ssl: The backend "cert-only" does not support QSslKey
qt.network.ssl: Active TLS backend does not support key creation
qt.network.ssl: The backend "cert-only" does not support QSslKey
qt.network.ssl: Active TLS backend does not support key creation
qt.network.ssl: The backend "cert-only" does not support QSslKey
qt.network.ssl: Active TLS backend does not support key creation
qt.network.ssl: The backend "cert-only" does not support QSslKey
qt.network.ssl: Active TLS backend does not support key creation
qt.network.ssl: The backend "cert-only" does not support QSslSocket
qt.network.ssl: The backend named "cert-only" does not support TLS
qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed
org.kde.UserFeedback: failed to submit user feedback: "TLS initialization failed" "" . Calling scheduleNextSubmission with minTime 2 minutes
Segmentation fault (core dumped)

QMake -v: QMake version 3.1, Using Qt version 5.12.8 in /usr/lib/x86_64-linux-gnu The only version file in the ~/Qt directory is 6.7.2

Following the debug steps in the qt terminal (qtcreator-ros) I received this output:

ROS_DISTRO was set to 'foxy' before. Please make sure that the environment does not mix paths from different distributions.
intel@intelnuc3:/run/user/1000/doc/b719c266$ ~/Downloads/qtc-sdk/Tools/QtCreator/bin/qtcreator -pluginpath build/lib/qtcreator/plugins/
qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "" even though it was found.
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: vnc, wayland, vkkhrdisplay, eglfs, wayland-egl, offscreen, xcb, linuxfb, minimal, minimalegl.

Aborted (core dumped)
intel@intelnuc3:/run/user/1000/doc/b719c266$ gdb --ex=r --args ~/Downloads/qtc-sdk/Tools/QtCreator/bin/qtcreator -pluginpath build/lib/qtcreator/plugins/
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.2) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
--Type <RET> for more, q to quit, c to continue without paging--c
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/intel/Downloads/qtc-sdk/Tools/QtCreator/bin/qtcreator...
(No debugging symbols found in /home/intel/Downloads/qtc-sdk/Tools/QtCreator/bin/qtcreator)
Starting program: /home/intel/Downloads/qtc-sdk/Tools/QtCreator/bin/qtcreator -pluginpath build/lib/qtcreator/plugins/
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "" even though it was found.
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
[Detaching after vfork from child process 11364]
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: vnc, wayland, vkkhrdisplay, eglfs, wayland-egl, offscreen, xcb, linuxfb, minimal, minimalegl.

Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) n
Program not restarted.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff5a54859 in __GI_abort () at abort.c:79
#2  0x00007ffff608c93c in qAbort() () from /home/intel/Downloads/qtc-sdk/Tools/QtCreator/bin/../lib/Qt/lib/libQt6Core.so.6
#3  0x00007ffff60c2a15 in ?? () from /home/intel/Downloads/qtc-sdk/Tools/QtCreator/bin/../lib/Qt/lib/libQt6Core.so.6
#4  0x00007ffff608d548 in QMessageLogger::fatal(char const*, ...) const ()
   from /home/intel/Downloads/qtc-sdk/Tools/QtCreator/bin/../lib/Qt/lib/libQt6Core.so.6
#5  0x00007ffff69fbf18 in ?? () from /home/intel/Downloads/qtc-sdk/Tools/QtCreator/bin/../lib/Qt/lib/libQt6Gui.so.6
#6  0x00007ffff6a9650c in QGuiApplicationPrivate::createPlatformIntegration() ()
   from /home/intel/Downloads/qtc-sdk/Tools/QtCreator/bin/../lib/Qt/lib/libQt6Gui.so.6
#7  0x00007ffff6a96e40 in QGuiApplicationPrivate::createEventDispatcher() ()
--Type <RET> for more, q to quit, c to continue without paging--

Thank you for any help. I realise this issue is similar to #496, https://github.com/ros-industrial/ros_qtc_plugin/issues/496, but that seems to have been solved in a push and my installations are fresh.

christian-rauch commented 1 month ago

I don't see exactly what the issue is and how it is related to the plugin. Can you provide clear steps on how to reproduce this? Is this only an issue with the snap and works otherwise with a "native" Qt Creator installation?

Tomas-Deane commented 1 month ago

The issue is resolved since I freshly installed qt 6.6.3, qtcreator 13.0.0, and the plugin.

Previously I only received the segmentation fault crashes specifically upon creating a ROS project using Colcon as the build system. It happened on both the snap and native installations. I did not think that the issue was related to incompatible versions because the ros qtc plugin showed as enabled successfully in the plugin manager, and I believe installing through snap manages qt and qtc versions. Also creating a ros project using another build system did not lead to a crash.

I will close this issue.

Tomas-Deane commented 1 month ago

I don't see exactly what the issue is and how it is related to the plugin. Can you provide clear steps on how to reproduce this? Is this only an issue with the snap and works otherwise with a "native" Qt Creator installation?

Apologies for last message, this error has begun to happen again and fresh installs do not solve now.

I do have the plugin working on a different laptop also with Ubuntu 22.04, Foxy, Qt 6.7.2 and QtC 14.0.1. But for various reasons i need to get it working on the original machine.

In terms of replicating, I am on Ubuntu 20.04, using ROS Foxy and Colcon. I have tried native installations of Qt 6.6.3 paired with Qt Creator 13.0.2, 13.0.0 and the 13.1 ros qtc plugin release. I also tried uninstalling these and instead installing Qt 6.7.2 paired with Qt Creator 14.0.1 and the 14.1 ros qtc plugin release. The Qt versions and QtC 14 were installed from the online installer, QtC 13 from here https://download.qt.io/official_releases/qtcreator/13.0/13.0.2/installer_source/linux_x64/ I installed the plugin using both the curl command in the readme and also by installing the zip file to the ~/Qt/Tools/QtCreator/lib/qtcreator/plugins/, then opening qtcreator > help > about plugins > install. I also tried installing through snap. All lead to the same error.

I take it for granted that the error is related to the plugin because Qt and QtCreator function fine, and I only get the seg fault when trying to open a .workspace file with the build system as colcon.

All that I need to do to replicate the issue is install Qt, QtCreator, ros qtc plugin. Create simple ros2 foxy workspace. Launch QtCreator. Create project. (Foxy, Colcon) QtCreator then generates the .workspace file and crashes when opening the editor screen.

Upon reopening qtcreator and opening the project with the .workspace file QtCreator will crash in the same manner.

intel@intelnuc3:~$ source /opt/ros/foxy/setup.bash
intel@intelnuc3:~$ mkdir test
intel@intelnuc3:~$ cd test
intel@intelnuc3:~/test$ mkdir src
intel@intelnuc3:~/test$ cd src
intel@intelnuc3:~/test/src$ ros2 pkg create --build-type ament_cmake my_pubsub
going to create a new package
package name: my_pubsub
destination directory: /home/intel/test/src
package format: 3
version: 0.0.0
description: TODO: Package description
maintainer: ['intel <email@gmail.com>']
licenses: ['TODO: License declaration']
build type: ament_cmake
dependencies: []
creating folder ./my_pubsub
creating ./my_pubsub/package.xml
creating source and include folder
creating folder ./my_pubsub/src
creating folder ./my_pubsub/include/my_pubsub
creating ./my_pubsub/CMakeLists.txt
intel@intelnuc3:~/test/src$ cd ..
intel@intelnuc3:~/test$ colcon build
[0.456s] WARNING:colcon.colcon_ros.prefix_path.ament:The path '/home/intel/test/install/my_pubsub' in the environment variable AMENT_PREFIX_PATH doesn't exist
[0.456s] WARNING:colcon.colcon_ros.prefix_path.catkin:The path '/home/intel/test/install/my_pubsub' in the environment variable CMAKE_PREFIX_PATH doesn't exist
Starting >>> my_pubsub
Finished <<< my_pubsub [0.75s]                  

Summary: 1 package finished [1.04s]
intel@intelnuc3:~/test$ qmake --version
QMake version 3.1
Using Qt version 6.6.3 in /home/intel/Qt/6.6.3/gcc_64/lib
intel@intelnuc3:~/test$ ~/Qt/Tools/QtCreator/bin/qtcreator
Failed to initialize instances shared memory:  "QSharedMemory::handle: doesn't exist"
Segmentation fault (core dumped)
intel@intelnuc3:~/test$ ~/Qt/Tools/QtCreator/bin/qtcreator
Segmentation fault (core dumped)

If you have more questions or need more details please let me know, I am eager to solve this problem. Thanks very much for any help. I hope any of the above terminal outputs are of use to you.

christian-rauch commented 1 month ago

I still cannot reproduce this. I am using Qt Creator 14.0.1 from the online installer (i.e. located at ~/Qt/Tools/QtCreator/) and installed the plugin from the archive with the curl command.

I created a workspace with the layout:

.
└── src
    └── my_pubsub
        ├── CMakeLists.txt
        ├── include
        │   └── my_pubsub
        ├── package.xml
        └── src

and then created a new project -> "ROS Workspace" -> Colcon and jazzy. The workspaces opens and I can compile. After this, the layout looks as expected:

.
├── bla_ws.workspace
├── build
│   ├── COLCON_IGNORE
│   └── my_pubsub
├── install
│   ├── COLCON_IGNORE
│   ├── local_setup.bash
│   ├── local_setup.ps1
│   ├── local_setup.sh
│   ├── _local_setup_util_ps1.py
│   ├── _local_setup_util_sh.py
│   ├── local_setup.zsh
│   ├── my_pubsub
│   ├── setup.bash
│   ├── setup.ps1
│   ├── setup.sh
│   └── setup.zsh
├── log
│   ├── build_2024-08-07_21-41-59
│   ├── COLCON_IGNORE
│   ├── latest -> latest_build
│   └── latest_build -> build_2024-08-07_21-41-59
└── src
    └── my_pubsub

Other than different ROS 2 versions (foxy vs jazzy) I cannot see why yours should fail and mine not. Unless you want to compile and link Qt, you do not have to install Qt manually to use Qt Creator. The offline and online installed Qt Creator versions come with their own Qt distribution.

If you want to further debug this, I can only suggest that you take a look at the README again, in particular the section about "Debugging" with gdb. Compile the plugin from source with debug info and then generate a backtrace.

Tomas-Deane commented 3 weeks ago

To update, after installing from source the plugin worked fine and led to no crashes, this is still the case after some time. Unfortunately I still do not know the exact reason for the initial crashes.

christian-rauch commented 3 weeks ago

Unfortunately I still do not know the exact reason for the initial crashes.

Did you follow the Development & Debugging instructions that I mentioned in my previous post to debug the issue and create a backtrace from the crash?