I package Gazebo (robot simulator) as Flatpak for linux, but Ogre Error:RuntimeAssertionException: gpu...

Problems building or running the engine, queries about how to use features etc.
Post Reply
andythe_great
Gnoblar
Posts: 1
Joined: Sat May 29, 2021 9:01 pm

I package Gazebo (robot simulator) as Flatpak for linux, but Ogre Error:RuntimeAssertionException: gpu...

Post by andythe_great »

Hello,

I am trying to package Gazebo as Flatpak for Linux distros.
Gazebo is a FOSS robot simulator software. http://gazebosim.org/
Flatpak is a software distribution method that can be installed on any distro, similar to AppImage and Snaps.
https://www.flatpak.org/

I am using

Code: Select all

openSUSE Tumbleweed KDE
Flatpak 1.11.1
flatpak-builder 1.0.12
cmake version 3.20.0
gcc (GCC) 10.2.0
I am planning to submit Gazebo to Flathub (Flatpak apps store)
Gazebo need OGRE as renderer, so must be include as dependency.

I build OGRE 1.12.12 in Flatpak with cmake and the following flags.
This is the format that Flatpak manifest look like.

Code: Select all

  - name: OGRE
    buildsystem: cmake
    config-opts:
      - -DOGRE_INSTALL_DOCS:BOOL=OFF
      - -DOGRE_BUILD_TESTS:BOOL=OFF
      - -DOGRE_BUILD_COMPONENT_CSHARP:BOOL=OFF
    sources:
      - type: git
        url: https://github.com/OGRECave/ogre
        tag: v1.12.12
      - type: archive
        url: https://github.com/ocornut/imgui/archive/refs/tags/v1.79.tar.gz
        sha256: f1908501f6dc6db8a4d572c29259847f6f882684b10488d3a8d2da31744cd0a4
        dest: imgui-1.79
and Gazebo 11.5.0

Code: Select all

  - name: Gazebo
    buildsystem: cmake
    config-opts:
      - -DCMAKE_BUILD_TYPE:STRING=Release
      - -DCMAKE_INSTALL_PREFIX:PATH=/app
      - -DBUILD_TESTING:BOOL=ON
      - -DENABLE_PROFILER:BOOL=ON
    build-options:
      env:
        LIBRARY_PATH: "/app/lib:/usr/lib"
        LD_LIBRARY_PATH: "/app/lib:/usr/lib"
    sources:
      - type: archive
        url: https://github.com/osrf/gazebo/archive/refs/tags/gazebo11_11.5.0.tar.gz
        sha256: cd46d85e01aa40ad181a7b0afcbe23dfd13ecdfb6ea37b881655205d8fc1aec0
        # Protobuf patch adopt from https://github.com/osrf/gazebo/issues/2639
      - type: patch
        path: Gazebo_fix_protobuf_linking.patch
After successfully build Gazebo.
I have to export some env before starting Gazebo as per this discussion.
https://github.com/osrf/gazebo/issues/2986

Note that /app is a Flatpak specific filesystem that is reminiscent to /usr.

Code: Select all

export GAZEBO_MASTER_URI=${GAZEBO_MASTER_URI:-http://localhost:11345}
export GAZEBO_MODEL_DATABASE_URI=http://models.gazebosim.org
export GAZEBO_RESOURCE_PATH=/app/share/gazebo-11:${GAZEBO_RESOURCE_PATH}
export GAZEBO_PLUGIN_PATH=/app/lib/gazebo-11/plugins:${GAZEBO_PLUGIN_PATH}
export GAZEBO_MODEL_PATH=/app/share/gazebo-11/models:${GAZEBO_MODEL_PATH}
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/app/lib/gazebo-11/plugins
export OGRE_RESOURCE_PATH=/app/lib/OGRE
export GAZEBO_RESOURCE_PATH=${GAZEBO_RESOURCE_PATH}:/app/share/OGRE/Media
export GAZEBO_RESOURCE_PATH=${GAZEBO_RESOURCE_PATH}:/app/share/OGRE/Media/ShadowVolume
I encounter this error when trying to start Gazebo.

Code: Select all

gazebo --verbose

Code: Select all

Gazebo multi-robot simulator, version 11.5.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
Gazebo multi-robot simulator, version 11.5.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 192.168.2.14
[Msg] Loading world file [/app/share/gazebo-11/worlds/empty.world]
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 192.168.2.14
[Wrn] [GuiIface.cc:120] Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt.
You must not let any exception whatsoever propagate through Qt code.
If that is not possible, in Qt 5 you must at least reimplement
QCoreApplication::notify() and catch all exceptions there.

[Err] [main.cc:37] Ogre Error:RuntimeAssertionException: gpu program could not be created in createGpuPrograms at /run/build/OGRE/Components/RTShaderSystem/src/OgreShaderProgramManager.cpp (line 251)
I found this thread with the same looking error log.

Code: Select all

https://forums.ogre3d.org/viewtopic.php?t=95581
So I create a patch to

Code: Select all

ogre/Components/RTShaderSystem/src/OgreShaderProgramManager.cpp
from the second comment.

Code: Select all

diff -ruN a/Components/RTShaderSystem/src/OgreShaderProgramProcessor.cpp b/Components/RTShaderSystem/src/OgreShaderProgramProcessor.cpp
--- a/Components/RTShaderSystem/src/OgreShaderProgramProcessor.cpp	2021-04-18 06:55:39.000000000 +0700
+++ b/Components/RTShaderSystem/src/OgreShaderProgramProcessor.cpp	2021-05-29 17:07:32.687497070 +0700
@@ -105,7 +105,7 @@
 //-----------------------------------------------------------------------------
 bool ProgramProcessor::compactVsOutputs(Function* vsMain, Function* fsMain)
 {
-
+return true;
     int outTexCoordSlots;
     int outTexCoordFloats;
However, same error. No different.

The full flatpak manifest can be found here.
https://github.com/kevinsmia1939/flathu ... sim.Gazebo

Also, you can try install Gazebo Flatpak yourself.
First, install Flatpak on your distro. It is important to keep Flatpak up-to-date, since Ubuntu ship old version of Flatpak, you will need to add Flatpak PPA.

Code: Select all

https://flatpak.org/setup/
To install Gazebo Flatpak.

Code: Select all

flatpak install --user https://dl.flathub.org/build-repo/47512/org.gazebosim.Gazebo.flatpakref
The above binary is under development and can be found here.

Code: Select all

https://github.com/flathub/flathub/pull/2296
To run Gazebo flatpak, we will start bash inside Gazebo flatpak first for debuggin purpose.

Code: Select all

flatpak run --command=bash org.gazebosim.Gazebo
Which will now bring you into bash inside Gazebo Flatpak. Then set environment like wise.

Code: Select all

export GAZEBO_MASTER_URI=${GAZEBO_MASTER_URI:-http://localhost:11345}
export GAZEBO_MODEL_DATABASE_URI=http://models.gazebosim.org
export GAZEBO_RESOURCE_PATH=/app/share/gazebo-11:${GAZEBO_RESOURCE_PATH}
export GAZEBO_PLUGIN_PATH=/app/lib/gazebo-11/plugins:${GAZEBO_PLUGIN_PATH}
export GAZEBO_MODEL_PATH=/app/share/gazebo-11/models:${GAZEBO_MODEL_PATH}
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/app/lib/gazebo-11/plugins
export OGRE_RESOURCE_PATH=/app/lib/OGRE
export GAZEBO_RESOURCE_PATH=${GAZEBO_RESOURCE_PATH}:/app/share/OGRE/Media
export GAZEBO_RESOURCE_PATH=${GAZEBO_RESOURCE_PATH}:/app/share/OGRE/Media/ShadowVolume
Now run Gazebo.

Code: Select all

gazebo --verbose
Which will show Gazebo UI, but will freeze with error mention previously.

Thank for any suggestion.
Post Reply