o3de / o3de-extras

Other
61 stars 61 forks source link

Bug Report: ROS2 gem doesn't work with the default O3DE template #765

Closed pawelbudziszewski closed 2 weeks ago

pawelbudziszewski commented 2 weeks ago

Describe the bug In the stabilization branches of O3DE and Extras: when I create a new project using the default O3DE template and add the ROS2 gem, I have a segfault when launching the Editor. This is caused by the fact, that the default template includes PhysX 4 gem, while ROS2 gem includes PhysX 5 (in the same time). This can be fixed easily by removing the PhysX gem from the project.json (or changing it to PhysX5). However, diagnosing the problem is extremely hard, even for experienced users:

At the same time, I can't see any information about this problem and the solution in the ROS2 gem README.

IMHO using the default template to create a ROS2 project may be a common practice. This is what I usually do when I don't need all the assets from robotic templates in my project. This issue, together with a fix should be at least described in the ROS2 README. This is the fastest solution, but in general, applications shouldn't crash in such cases.

Assets required n/a.

Steps to reproduce Steps to reproduce the behavior:

  1. Create a project using the default template
  2. Add ROS2 into project.json
  3. Build
  4. Run the Editor

Expected behavior The application should inform about the problem. Maybe even during compilation

Actual behavior Crash without any information which would help to spot the problem

Screenshots/Video n/a

Found in Branch stabilization/2409

Commit ID from o3de/o3de and o3de/o3de-extras repositories ed3d36f354f2b75a45aa44d2fbf384f49531108b

Desktop/Device (please complete the following information):

Additional context Debugger backtrace:

<10:38:54> BackupNameAttachment=" Build(1) 04 Oct 24 (10 38 54)"  -- used by backup system
<10:38:54> Log Started at Fri 04 Oct 2024 10:38:54 AM CEST
<10:38:54> Built on Oct  3 2024 14:56:38
<10:38:54> Running 64 bit Linux version
<10:38:54> FileVersion: 1.0.0.1
<10:38:54> ProductVersion: 1.0.0.1
<10:38:54> Using CLANG C++ Standard Library implementation
<10:38:54> Loading Config file game.cfg (/home/pawel/####/Project/Cache/linux/game.cfg)
<10:38:54> creating CVarGroups from directory 'Config/CVarGroups' ...
<10:38:54> Loading Config file user.cfg (/home/pawel/####/Project/Cache/linux/config/user.cfg)
<10:38:54> GameName: #####
<10:38:54> BuildTime: Oct  3 2024 14:56:38
<10:38:54> [Warning] (System) - <Audio>: Running without any AudioSystem!
<10:38:54> Current Language: English (United States)
<10:38:54> Linux
<10:38:54> Local time is 10:38:54, system running for 75 minutes
<10:38:54> 63984MB phys. memory installed, 40959MB paging available
<10:38:54> Current display mode is 1920x1080x24, eDP-1
<10:38:54> project_path = /home/pawel/####/Project
<10:38:54> sys_localization_folder = Localization
<10:38:54> Console Variable r_MeasureOverdraw not declared
<10:38:54> [Plugin Manager] Loading plugins...
<10:38:55> [Plugin Manager] Successfully loaded plugin 'ComponentEntityEditor', version '1' (GUID: {11B0041C-BC34-4827-A3E4-AB7458FFF678})
<10:38:55> FFMPEG plugin: CreatePluginInstance
Process 110914 stopped and restarted: thread 1 received signal: SIGCHLD
<10:38:55> FFMPEG plugin: Failed to execute FFmpeg. Please install FFmpeg.
<10:38:55> [Plugin Manager] Successfully loaded plugin 'FFMPEG Writer', version '1' (GUID: {D2A3A44A-00FF-4341-90BA-89A473F44A65})
<10:38:56> [Plugin Manager] Successfully loaded plugin 'ProjectSettingsTool', version '1' (GUID: {C5B96A1A-036A-46F9-B7F0-5DF93494F988})
<10:38:56> [Plugin Manager] Successfully loaded plugin 'Perforce Client', version '1' (GUID: {FD5F1023-8F02-4051-89FA-DF1F038863A2})
<10:38:57> [Plugin Manager] Successfully loaded plugin 'QtAssetImporter', version '1' (GUID: {0abf28f2-ef56-4ac9-a459-175abb40d649})
Process 110914 stopped
* thread #1, name = 'Editor', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
    frame #0: 0x00007ffff39d5418 libEditorLib.so`AtomToolsFramework::RenderViewportWidget::InitializeViewportContext(int) + 232
libEditorLib.so`AtomToolsFramework::RenderViewportWidget::InitializeViewportContext:
->  0x7ffff39d5418 <+232>: movq   (%rax), %rcx
    0x7ffff39d541b <+235>: movq   %rax, %rdi
    0x7ffff39d541e <+238>: xorl   %esi, %esi
    0x7ffff39d5420 <+240>: callq  *0x40(%rcx)
(lldb) bt
* thread #1, name = 'Editor', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
  * frame #0: 0x00007ffff39d5418 libEditorLib.so`AtomToolsFramework::RenderViewportWidget::InitializeViewportContext(int) + 232
    frame #1: 0x00007ffff13df29a libEditorLib.so`EditorViewportWidget::SetViewportId(int) + 218
    frame #2: 0x00007ffff13e0717 libEditorLib.so`non-virtual thunk to EditorViewportWidget::SetViewportId(int) + 23
    frame #3: 0x00007ffff13e7258 libEditorLib.so`CLayoutViewPane::AttachViewport(QWidget*) + 232
    frame #4: 0x00007ffff13fa65e libEditorLib.so`CLayoutViewPane::SetViewClass(QString const&) + 254
    frame #5: 0x00007ffff14b8699 libEditorLib.so`CLayoutWnd::MaximizeViewport(int) + 713
    frame #6: 0x00007ffff14ba7d7 libEditorLib.so`CLayoutWnd::LoadConfig() + 1079
    frame #7: 0x00007ffff1872ed2 libEditorLib.so`MainWindow::InitCentralWidget() + 146
    frame #8: 0x00007ffff1873088 libEditorLib.so`MainWindow::Initialize() + 120
    frame #9: 0x00007ffff190ee88 libEditorLib.so`CCryEditApp::InitInstance() + 1816
    frame #10: 0x00007ffff19164c0 libEditorLib.so`CryEditMain + 1216
    frame #11: 0x00005555556fcc05 Editor`main + 229
    frame #12: 0x00007ffff7029d90 libc.so.6`__libc_start_call_main(main=(Editor`main), argc=1, argv=0x00007fffffffdb68) at libc_start_call_main.h:58:16
    frame #13: 0x00007ffff7029e40 libc.so.6`__libc_start_main_impl(main=(Editor`main), argc=1, argv=0x00007fffffffdb68, init=0x00007ffff7ffd040, fini=<unavailable>, rtld_fini=<unavailable>, stack_end=0x00007fffffffdb58) at libc-start.c:392:3
    frame #14: 0x00005555556fca55 Editor`_start + 37
jhanca-robotecai commented 2 weeks ago

This is not a problem of ROS 2 Gem, but the problem of Gem management within O3DE. This issue was raised by me recently here: https://github.com/o3de/o3de/issues/18363

pawelbudziszewski commented 2 weeks ago

Ok, I see, thanks. From the "o3de-extras" point of view, IMHO we should add a relevant note in the README. @jhanca-robotecai feel free to close this issue if you think it's not needed.

michalpelka commented 2 weeks ago

This problem is user's fault. There is clear error message in Editor.log https://github.com/o3de/o3de/pull/18253. This issue is duplication of resolved https://github.com/o3de/o3de/issues/18234.

jhanca-robotecai commented 2 weeks ago

I closed the issue due to the duplication. However, I do not agree with the statement that this problem is the user's fault - adding a Gem to the empty project (ROS 2 Gem in this example) should not cause a crash. Message in logs helps to debug the problem, but we still need a solution that ensures there is nothing to debug.