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

Some embedded paths are not relocated on Windows #25

Closed traversaro closed 2 years ago

traversaro commented 2 years ago

I am debugging some test failure on ign-sensors6, and they are failing with:

test 21
    Start 21: INTEGRATION_rgbd_camera

21: Test command: C:\src\ign-sensors\build\bin\INTEGRATION_rgbd_camera.exe "--gtest_output=xml:C:/src/ign-sensors/build/test_results/INTEGRATION_rgbd_camera.xml"
21: Test timeout computed to be: 240
21: [==========] Running 1 test from 1 test case.
21: [----------] Global test environment set-up.
21: [----------] 1 test from RgbdCameraSensor/RgbdCameraSensorTest
21: [ RUN      ] RgbdCameraSensor/RgbdCameraSensorTest.ImagesWithBuiltinSDF/ogre
21: [Msg] Loading plugin [ignition-rendering-ogre]
21: [Err] [D:\bld\libignition-rendering6_1633681302936\work\ogre\src\OgreRTShaderSystem.cc:527] Unable to find shader lib. Shader generating will fail.
21: [Err] [D:\bld\libignition-rendering6_1633681302936\work\ogre\src\OgreRTShaderSystem.cc:112] Cannot find OGRE rtshaderlib. Shadows will be disabled.
21: [Dbg] [C:\src\ign-sensors\src\RgbdCameraSensor.cc:222] RGB images for [camera1] advertised on [/test/integration/RgbdCameraPlugin_imagesWithBuiltinSDF/image]
21: [Dbg] [C:\src\ign-sensors\src\RgbdCameraSensor.cc:236] Depth images for [camera1] advertised on [/test/integration/RgbdCameraPlugin_imagesWithBuiltinSDF/depth_image]
21: [Dbg] [C:\src\ign-sensors\src\RgbdCameraSensor.cc:250] Points for [camera1] advertised on [/test/integration/RgbdCameraPlugin_imagesWithBuiltinSDF/points]
21: [Dbg] [C:\src\ign-sensors\src\CameraSensor.cc:524] Camera info for [camera1] advertised on [/test/integration/RgbdCameraPlugin_imagesWithBuiltinSDF/camera_info]
21: [Err] [D:\bld\libignition-rendering6_1633681302936\work\ogre\src\OgreMaterial.cc:433] Vertex shader path does not exist: D:\bld\libignition-rendering6_1633681302936\_h_env\Library\share\ignition\ignition-rendering6\ogre\media\materials\programs\depth_points_vs.glsl
21: [Err] [D:\bld\libignition-rendering6_1633681302936\work\ogre\src\OgreMaterial.cc:482] Fragment shader path does not exist: D:\bld\libignition-rendering6_1633681302936\_h_env\Library\share\ignition\ignition-rendering6\ogre\media\materials\programs\depth_points_fs.glsl
21: unknown file: error: SEH exception with code 0xc0000005 thrown in the test body.
21: [  FAILED  ] RgbdCameraSensor/RgbdCameraSensorTest.ImagesWithBuiltinSDF/ogre, where GetParam() = "ogre" (408 ms)
21: [----------] 1 test from RgbdCameraSensor/RgbdCameraSensorTest (408 ms total)
21:
21: [----------] Global test environment tear-down
21: [==========] 1 test from 1 test case ran. (408 ms total)
21: [  PASSED  ] 0 tests.
21: [  FAILED  ] 1 test, listed below:
21: [  FAILED  ] RgbdCameraSensor/RgbdCameraSensorTest.ImagesWithBuiltinSDF/ogre, where GetParam() = "ogre"
21:
21:  1 FAILED TEST
1/2 Test #21: INTEGRATION_rgbd_camera ..........***Failed    0.67 sec
traversaro commented 2 years ago

In particular the path D:\bld\libignition-rendering6_1633681302936\_h_env\Library\share\ignition\ignition-rendering6\ogre\media\materials\programs should not be there and should be instead the installed one, so something in C: .

traversaro commented 2 years ago

Apparently a workaround is to set (see https://github.com/ignitionrobotics/ign-rendering/blob/fe9b5b3e1614f4f7ff3fb275a361d6de26d0fc6b/ogre/src/OgreRenderEngine.cc#L566):

set IGN_RENDERING_PLUGIN_PATH=%CONDA_PREFIX%\Library\lib\ign-rendering-6\engine-plugins\
set OGRE_RESOURCE_PATH=%CONDA_PREFIX%\Library\bin
set IGN_RENDERING_RESOURCE_PATH=%CONDA_PREFIX%\Library\share\ignition\ignition-rendering6

By setting this env variables, the test is finally able to pass:

test 21
    Start 21: INTEGRATION_rgbd_camera

21: Test command: C:\src\ign-sensors\build\bin\INTEGRATION_rgbd_camera.exe "--gtest_output=xml:C:/src/ign-sensors/build/test_results/INTEGRATION_rgbd_camera.xml"
21: Test timeout computed to be: 240
21: [==========] Running 1 test from 1 test case.
21: [----------] Global test environment set-up.
21: [----------] 1 test from RgbdCameraSensor/RgbdCameraSensorTest
21: [ RUN      ] RgbdCameraSensor/RgbdCameraSensorTest.ImagesWithBuiltinSDF/ogre
21: [Msg] Loading plugin [ignition-rendering-ogre]
21: [Dbg] [C:\src\ign-sensors\src\RgbdCameraSensor.cc:222] RGB images for [camera1] advertised on [/test/integration/RgbdCameraPlugin_imagesWithBuiltinSDF/image]
21: [Dbg] [C:\src\ign-sensors\src\RgbdCameraSensor.cc:236] Depth images for [camera1] advertised on [/test/integration/RgbdCameraPlugin_imagesWithBuiltinSDF/depth_image]
21: [Dbg] [C:\src\ign-sensors\src\RgbdCameraSensor.cc:250] Points for [camera1] advertised on [/test/integration/RgbdCameraPlugin_imagesWithBuiltinSDF/points]
21: [Dbg] [C:\src\ign-sensors\src\CameraSensor.cc:524] Camera info for [camera1] advertised on [/test/integration/RgbdCameraPlugin_imagesWithBuiltinSDF/camera_info]
21: [       OK ] RgbdCameraSensor/RgbdCameraSensorTest.ImagesWithBuiltinSDF/ogre (891 ms)
21: [----------] 1 test from RgbdCameraSensor/RgbdCameraSensorTest (891 ms total)
21:
21: [----------] Global test environment tear-down
21: [==========] 1 test from 1 test case ran. (891 ms total)
21: [  PASSED  ] 1 test.
1/2 Test #21: INTEGRATION_rgbd_camera ..........   Passed    1.15 sec

While we could just set these in the activation scripts, we would lose the feature of being able to install side by side different major version of ignition-rendering. Probably we should just check the point in which the paths are used, and add a workaround like the one in https://github.com/conda-forge/libignition-common-feedstock/pull/36 where needed.

traversaro commented 2 years ago

As some of the problems seems to affect at least also macOS (see https://github.com/conda-forge/libignition-sensors-feedstock/pull/17#issuecomment-939277971), I think that perhaps just setting the env variables in the activation scripts is the least worst solution. Tryng to fix the binary relocation by reading https://github.com/conda/conda-build/issues/1674 and https://github.com/conda/conda-build/issues/2524 seems to be quite black magic (at least from what I understand of it right now) and that seems time that would be better spent by making properly relocatable (something like https://www.qt.io/blog/qt-is-relocatable) ignition-rendering upstream, that would benefit also other package managers that do not have "magic" binary relocation like conda (there was already some interest in this direction from people packaging ign-gazebo in conan, see https://github.com/ignitionrobotics/ign-gazebo/issues/626 for example).