conda-forge / libignition-rendering4-feedstock

A conda-smithy repository for libignition-rendering4.
BSD 3-Clause "New" or "Revised" License
2 stars 5 forks source link

Debug ignition-rendering 6 test running #21

Closed traversaro closed 2 years ago

traversaro commented 2 years ago

To debug the problems in https://github.com/conda-forge/libignition-rendering4-feedstock/pull/19, I am compiling ign-rendering on its own. I will use this issue to mark down some notes.

traversaro commented 2 years ago
mamba install cmake compilers make pkg-config xorg-libx11 xorg-libxext libignition-math6 libignition-common4 libignition-plugin1 libignition-utils1 ogre=1.10
traversaro commented 2 years ago

Indeed, I am able to reproduce the problem, after installing the dependency listed before and configuring the project (latest ign-rendering6 commit, i.e. https://github.com/ignitionrobotics/ign-rendering/commit/f93c796abffbfd979d2eebbfc7fb3e8b2d75ae75 ) as:

cmake -DCMAKE_BUILD_TYPE=Release -DSKIP_ogre2:BOOL=ON -DSKIP_optix:BOOL=ON -DCMAKE_INSTALL_PREFIX=./install -DBUILD_TESTING:BOOL=ON ..

The project fails as:

[ 76%] Building CXX object ogre/src/CMakeFiles/ignition-rendering6-ogre.dir/OgreCOMVisual.cc.o
cd /Users/traversaro/src/ign-rendering/build/ogre/src && /Users/traversaro/mambaforge/envs/ignrendering/bin/x86_64-apple-darwin13.4.0-clang++ -DMAC_OS_X_VERSION=1080 -DOGRE_VERSION_LT_1_12_0 -Dignition_rendering6_ogre_EXPORTS -I/usr/local/include -I/Users/traversaro/src/ign-rendering/include -I/Users/traversaro/src/ign-rendering/build/include -I/Users/traversaro/src/ign-rendering/ogre/include -I/Users/traversaro/src/ign-rendering/build/ogre/include -I/Users/traversaro/src/ign-rendering/build/core/include -isystem /Users/traversaro/mambaforge/envs/ignrendering/include/ignition/common4 -isystem /Users/traversaro/mambaforge/envs/ignrendering/include/ignition/math6 -isystem /Users/traversaro/mambaforge/envs/ignrendering/include/ignition/utils1 -isystem /Users/traversaro/mambaforge/envs/ignrendering/include/ignition/plugin1 -isystem /Users/traversaro/mambaforge/envs/ignrendering/include/ignition/cmake2 -isystem /Users/traversaro/mambaforge/envs/ignrendering/include/OGRE -isystem /Users/traversaro/mambaforge/envs/ignrendering/include/OGRE/OSX -isystem /Users/traversaro/mambaforge/envs/ignrendering/include/OGRE/RenderSystems/GL -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0 -isystem /Users/traversaro/mambaforge/envs/ignrendering/include -stdlib=libc++ -O3 -DNDEBUG  -Wall -Wextra -Wno-long-long -Wno-unused-value -Wfloat-equal -Wshadow -Winit-self -Wswitch-default -Wmissing-include-dirs -pedantic  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -fPIC -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -fPIC -std=c++17 -MD -MT ogre/src/CMakeFiles/ignition-rendering6-ogre.dir/OgreCOMVisual.cc.o -MF CMakeFiles/ignition-rendering6-ogre.dir/OgreCOMVisual.cc.o.d -o CMakeFiles/ignition-rendering6-ogre.dir/OgreCOMVisual.cc.o -c /Users/traversaro/src/ign-rendering/ogre/src/OgreCOMVisual.cc
In file included from /Users/traversaro/src/ign-rendering/ogre/src/OgreCOMVisual.cc:18:
In file included from /Users/traversaro/src/ign-rendering/ogre/include/ignition/rendering/ogre/OgreCOMVisual.hh:24:
In file included from /Users/traversaro/src/ign-rendering/ogre/include/ignition/rendering/ogre/OgreIncludes.hh:68:
/Users/traversaro/mambaforge/envs/ignrendering/include/OGRE/Terrain/OgreTerrainPaging.h:33:10: fatal error: 'OgrePagedWorldSection.h' file not found
#include "OgrePagedWorldSection.h"
traversaro commented 2 years ago

Ok, I was able to understand the root behind the fatal error: 'OgrePagedWorldSection.h' file not found. The problem is that at the moment the CMake code is calling ign_find_package(IgnOGRE VERSION 1.10 QUIET), and after that ign_find_package(IgnOGRE VERSION 1.10 COMPONENTS ${ign_ogre_components} REQUIRED_BY ogre PRIVATE_FOR ogre). The problem is that the IgnOgre::IgnOgre target created by the first call (that does not has any component properly set in its IMPORTED_LINK_INTERFACE_LIBRARIES property) is not changed at all by the second ign_find_package call, as ign_import_target silently does nothing if a target with the same name already exists (see https://github.com/ignitionrobotics/ign-cmake/blob/ignition-cmake2_2.9.0/cmake/IgnImportTarget.cmake#L67). I guess we need to report this upstream.

traversaro commented 2 years ago

After fixing the compilation, I was able to reproduce the test segfaulting. Interesting, the test are only segfaulting if run after make install. If they are run before make install, all the test are passing successfully, except for:

     59 - UNIT_RenderingIface_TEST (SEGFAULT)
traversaro commented 2 years ago

Actually it seems that the tests that are passing before the install are not actually passing:

1: Test command: /Users/traversaro/src/ign-rendering/build/bin/UNIT_ArrowVisual_TEST "--gtest_output=xml:/Users/traversaro/src/ign-rendering/build/test_results/UNIT_ArrowVisual_TEST.xml"
1: Test timeout computed to be: 240
1: [==========] Running 2 tests from 1 test case.
1: [----------] Global test environment set-up.
1: [----------] 2 tests from ArrowVisual/ArrowVisualTest
1: [ RUN      ] ArrowVisual/ArrowVisualTest.ArrowVisual/ogre
1: [Err] [RenderEngineManager.cc:461] Failed to load plugin [ignition-rendering-ogre] : couldn't find shared library.
1: [       OK ] ArrowVisual/ArrowVisualTest.ArrowVisual/ogre (1 ms)
1: [ RUN      ] ArrowVisual/ArrowVisualTest.ArrowVisual/optix
1: [Err] [RenderEngineManager.cc:461] Failed to load plugin [optix] : couldn't find shared library.
1: [       OK ] ArrowVisual/ArrowVisualTest.ArrowVisual/optix (0 ms)
1: [----------] 2 tests from ArrowVisual/ArrowVisualTest (1 ms total)
1: 
1: [----------] Global test environment tear-down
1: [==========] 2 tests from 1 test case ran. (1 ms total)
1: [  PASSED  ] 2 tests.
1/2 Test #1: UNIT_ArrowVisual_TEST ............   Passed    0.02 sec
traversaro commented 2 years ago

The problem seems to be that ign-rendering expects the ogre plugin to start with "lib", but apparantly they are not:

test 1
    Start 1: UNIT_ArrowVisual_TEST

1: Test command: /Users/traversaro/src/ign-rendering/build/bin/UNIT_ArrowVisual_TEST "--gtest_output=xml:/Users/traversaro/src/ign-rendering/build/test_results/UNIT_ArrowVisual_TEST.xml"
1: Test timeout computed to be: 240
1: [==========] Running 2 tests from 1 test case.
1: [----------] Global test environment set-up.
1: [----------] 2 tests from ArrowVisual/ArrowVisualTest
1: [ RUN      ] ArrowVisual/ArrowVisualTest.ArrowVisual/ogre
1: [Err] [OgreRenderEngine.cc:465] Unable to load Ogre Plugin[/Users/traversaro/mambaforge/envs/ignrendering/lib/OGRE/libRenderSystem_GL]. Rendering will not be possible.Make sure you have installed OGRE properly.
1: [Err] [OgreRenderEngine.cc:508] unable to find OpenGL rendering system. OGRE is probably installed incorrectly. Double check the OGRE cmake output, and make sure OpenGL is enabled.
1/2 Test #1: UNIT_ArrowVisual_TEST ............***Exception: SegFault  0.05 sec

(ignrendering) Silvios-iMac:build traversaro$ ls /Users/traversaro/mambaforge/envs/ignrendering/lib/OGRE/
Plugin_BSPSceneManager.1.10.12.dylib    Plugin_EXRCodec.dylib           Plugin_OctreeZone.1.10.12.dylib     Plugin_PCZSceneManager.dylib        RenderSystem_GL.1.10.12.dylib       RenderSystem_GL3Plus.dylib
Plugin_BSPSceneManager.dylib        Plugin_OctreeSceneManager.1.10.12.dylib Plugin_OctreeZone.dylib         Plugin_ParticleFX.1.10.12.dylib     RenderSystem_GL.dylib
Plugin_EXRCodec.1.10.12.dylib       Plugin_OctreeSceneManager.dylib     Plugin_PCZSceneManager.1.10.12.dylib    Plugin_ParticleFX.dylib         RenderSystem_GL3Plus.1.10.12.dylib
traversaro commented 2 years ago

The problem seems to be that ign-rendering expects the ogre plugin to start with "lib", but apparantly they are not:

test 1
    Start 1: UNIT_ArrowVisual_TEST

1: Test command: /Users/traversaro/src/ign-rendering/build/bin/UNIT_ArrowVisual_TEST "--gtest_output=xml:/Users/traversaro/src/ign-rendering/build/test_results/UNIT_ArrowVisual_TEST.xml"
1: Test timeout computed to be: 240
1: [==========] Running 2 tests from 1 test case.
1: [----------] Global test environment set-up.
1: [----------] 2 tests from ArrowVisual/ArrowVisualTest
1: [ RUN      ] ArrowVisual/ArrowVisualTest.ArrowVisual/ogre
1: [Err] [OgreRenderEngine.cc:465] Unable to load Ogre Plugin[/Users/traversaro/mambaforge/envs/ignrendering/lib/OGRE/libRenderSystem_GL]. Rendering will not be possible.Make sure you have installed OGRE properly.
1: [Err] [OgreRenderEngine.cc:508] unable to find OpenGL rendering system. OGRE is probably installed incorrectly. Double check the OGRE cmake output, and make sure OpenGL is enabled.
1/2 Test #1: UNIT_ArrowVisual_TEST ............***Exception: SegFault  0.05 sec

(ignrendering) Silvios-iMac:build traversaro$ ls /Users/traversaro/mambaforge/envs/ignrendering/lib/OGRE/
Plugin_BSPSceneManager.1.10.12.dylib  Plugin_EXRCodec.dylib           Plugin_OctreeZone.1.10.12.dylib     Plugin_PCZSceneManager.dylib        RenderSystem_GL.1.10.12.dylib       RenderSystem_GL3Plus.dylib
Plugin_BSPSceneManager.dylib      Plugin_OctreeSceneManager.1.10.12.dylib Plugin_OctreeZone.dylib         Plugin_ParticleFX.1.10.12.dylib     RenderSystem_GL.dylib
Plugin_EXRCodec.1.10.12.dylib     Plugin_OctreeSceneManager.dylib     Plugin_PCZSceneManager.1.10.12.dylib    Plugin_ParticleFX.dylib         RenderSystem_GL3Plus.1.10.12.dylib

This was a problem in ignition-rendering indeed, that was fixed long ago in Gazebo Classic: https://github.com/ignitionrobotics/ign-rendering/pull/454 .

traversaro commented 2 years ago

simple_demo example is now running fine on macOS, see https://github.com/conda-forge/libignition-rendering4-feedstock/pull/19#issuecomment-937678806 .