robotology / gz-sim-yarp-plugins

YARP plugins for Modern Gazebo (gz-sim).
BSD 3-Clause "New" or "Revised" License
9 stars 2 forks source link

Add workflow to run tests with pixi #214

Closed xela-95 closed 1 month ago

xela-95 commented 1 month ago

Closes #213

traversaro commented 1 month ago

I see that we have a failure:

CMake Error at .pixi/envs/default/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:9 (message):
  Failed to find "GL/gl.h" in
  "/home/runner/work/gz-sim-yarp-plugins/gz-sim-yarp-plugins/.pixi/envs/default/include".
Call Stack (most recent call first):
  .pixi/envs/default/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake:233 (include)
  .pixi/envs/default/lib/cmake/Qt5Quick/Qt5QuickConfig.cmake:100 (find_package)
  .pixi/envs/default/lib/cmake/Qt5/Qt5Config.cmake:28 (find_package)
  .pixi/envs/default/lib/cmake/gz-gui8/gz-gui8-config.cmake:101 (find_package)
  .pixi/envs/default/lib/cmake/gz-sim8/gz-sim8-config.cmake:98 (find_package)
  .pixi/envs/default/share/cmake/gz-cmake3/cmake3/GzFindPackage.cmake:243 (find_package)
  CMakeLists.txt:14 (gz_find_package)

We can fix this by adding a dependency on libgl-devel on Linux, https://github.com/conda-forge/staged-recipes/pull/27107 .

traversaro commented 1 month ago

The Windows failure is tracked in https://github.com/robotology/gz-sim-yarp-plugins/issues/205, probably we can just skip the test on Windows at the action level?

xela-95 commented 1 month ago

@traversaro, what do you think is the most appropriate thing to do between running the action against the pixi.lock already committed in the repository or removing it and creating a fresh one with the latest available dependencies from the action?

traversaro commented 1 month ago

@traversaro, what do you think is the most appropriate thing to do between running the action against the pixi.lock already committed in the repository or removing it and creating a fresh one with the latest available dependencies from the action?

It depends. If the action is trigged by a pull request, we should keep the pixi.lock as we want understand test failures related to the PR, not related to the package update. I just suggesting removing the pixi.lock in the context of scheduled jobs.

xela-95 commented 1 month ago

I see that we have a failure:

CMake Error at .pixi/envs/default/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:9 (message):
  Failed to find "GL/gl.h" in
  "/home/runner/work/gz-sim-yarp-plugins/gz-sim-yarp-plugins/.pixi/envs/default/include".
Call Stack (most recent call first):
  .pixi/envs/default/lib/cmake/Qt5Gui/Qt5GuiConfig.cmake:233 (include)
  .pixi/envs/default/lib/cmake/Qt5Quick/Qt5QuickConfig.cmake:100 (find_package)
  .pixi/envs/default/lib/cmake/Qt5/Qt5Config.cmake:28 (find_package)
  .pixi/envs/default/lib/cmake/gz-gui8/gz-gui8-config.cmake:101 (find_package)
  .pixi/envs/default/lib/cmake/gz-sim8/gz-sim8-config.cmake:98 (find_package)
  .pixi/envs/default/share/cmake/gz-cmake3/cmake3/GzFindPackage.cmake:243 (find_package)
  CMakeLists.txt:14 (gz_find_package)

We can fix this by adding a dependency on libgl-devel on Linux, conda-forge/staged-recipes#27107 .

Now the pixi test on ubuntu is failing with a different error always related to OpenGL:

Error while loading the library [/home/runner/work/gz-sim-yarp-plugins/gz-sim-yarp-plugins/.pixi/envs/default/lib/gz-rendering-8/engine-plugins/libgz-rendering-ogre2.so]: libOpenGL.so.0: cannot open shared object file: No such file or directory
Error while loading the library [/home/runner/work/gz-sim-yarp-plugins/gz-sim-yarp-plugins/.pixi/envs/default/lib/gz-rendering-8/engine-plugins/libgz-rendering-ogre2.so]: libOpenGL.so.0: cannot open shared object file: No such file or directory
traversaro commented 1 month ago

We need also libopengl-devel : https://github.com/conda-forge/libglvnd-feedstock/blob/main/recipe/meta.yaml#L66 . This will not be needed once we migrate gz-* conda packages to use these packages instead of CDTs packages.

traversaro commented 1 month ago

Probably also libegl-devel will be needed.

xela-95 commented 1 month ago

Now we have this 😅

[Wrn] [Ogre2RenderEngine.cc:548] Unable to open display: . Trying to run in headless mode.
[Err] [Ogre2RenderEngine.cc:749] Unable to load Ogre Plugin[/home/runner/work/gz-sim-yarp-plugins/gz-sim-yarp-plugins/.pixi/envs/default/lib/OGRE-Next/RenderSystem_GL3Plus]. Rendering will not be possible.Make sure you have installed OGRE properly.
[Err] [Ogre2RenderEngine.cc:800] unable to find OpenGL 3+ Rendering Subsystem. OGRE is probably installed incorrectly. Double check the OGRE cmake output, and make sure OpenGL is enabled.
traversaro commented 1 month ago

I think that is ok. CI needs to have at least an EGL driver (even software only) installed, and that is supposed to be installed via apt, as it is a driver of the system.

traversaro commented 1 month ago

Ok, installing all the packages that we installed in the CI of conda worked fine, but let's try to be a bit more methodical. The conda-forge package libegl contains the library that is linked by the conda program, and that looks in the system for EGL drivers (that are instead installed by the system). How does libegl finds the system driver? Looking for some json files called icd, see https://github.com/NVIDIA/libglvnd/blob/master/src/EGL/icd_enumeration.md#icd-discovery .

In particular, to run the mesa software implementation of OpenGL, it needs to find the /usr/share/glvnd/egl_vendor.d/50_mesa.json file. This file belongs (as we can see from the apt-file output) to the libegl-mesa0 package:

traversaro@IITBMP014LW012:~$ apt-file search /usr/share/glvnd/egl_vendor.d/50_mesa.json
libegl-mesa0: /usr/share/glvnd/egl_vendor.d/50_mesa.json

The .icd file refers to the /usr/lib/x86_64-linux-gnu/libEGL_mesa.so.0 file, that is also installed by libegl-mesa0:

traversaro@IITBMP014LW012:~$ cat /usr/share/glvnd/egl_vendor.d/50_mesa.json
{
    "file_format_version" : "1.0.0",
    "ICD" : {
        "library_path" : "libEGL_mesa.so.0"
    }
}
traversaro@IITBMP014LW012:~$ apt-file search /usr/lib/x86_64-linux-gnu/libEGL_mesa.so.0
libegl-mesa0: /usr/lib/x86_64-linux-gnu/libEGL_mesa.so.0

So, for sure we can try to first install libegl-mesa0 . By installing only that package, the test fail with error:

libEGL warning: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)

libEGL warning: MESA-LOADER: failed to open zink: /usr/lib/dri/zink_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)

libEGL warning: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)

libEGL warning: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)

libEGL warning: MESA-LOADER: failed to open zink: /usr/lib/dri/zink_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)

libEGL warning: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)

so libEGL_mesa.so.0 is loaded correctly, but then it fails as it can't find dri/swrast_dri.so and similar libraries. And which packages contains tese files?

traversaro@IITBMP014LW012:~$ apt-file search /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
libgl1-mesa-dri: /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so`

So indeed by installing libegl-mesa0 and libgl1-mesa-dri the test pass.

traversaro commented 1 month ago

After:

if we update the packages to use this latest builds, it should be not necessary anymore to manually add the libegl-devel packages.

xela-95 commented 1 month ago

Ok, installing all the packages that we installed in the CI of conda worked fine, but let's try to be a bit more methodical.

Thanks a lot, @traversaro for you time and effort. This, apart from solving this particular issue, taught me how to solve the next ones!

traversaro commented 1 month ago

Yes, unfortunately the related section in the conda-forge docs (https://conda-forge.org/docs/maintainer/knowledge_base/#when-should-cdts-be-used) is outdated, we need to eventually fix that.

xela-95 commented 1 month ago

if we update the packages to use this latest builds, it should be not necessary anymore to manually add the libegl-devel packages.

Ok so when both these PR will be merged we could eventually update our pixi.toml and the conda feedstock?

traversaro commented 1 month ago

if we update the packages to use this latest builds, it should be not necessary anymore to manually add the libegl-devel packages.

Ok so when both these PR will be merged we could eventually update our pixi.toml and the conda feedstock?

Yes, we need to make sure that those build are the one actually installed and not older versions for some reason. Anyhow, for some time we can just keep the lib*gl packages there just to be sure.

xela-95 commented 1 month ago

Squashed some minor commits. Merging 🚀