From a7cf4f0dba349f9f6fa9a70a8f082862e387f2e7 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Wed, 3 Jul 2024 10:16:10 -0500 Subject: [PATCH] Fix debug builds of gz-rendering-ogre2 plugin (#1014) The ogre2 plugin fails to load in gz-sim when gz-rendering is built in Debug mode. The following error message is emitted: ``` Error while loading the library [....lib/gz-rendering-8/engine-plugins/libgz-rendering-ogre2.so]: ....lib/gz-rendering-8/engine-plugins/libgz-rendering-ogre2.so: undefined symbol: _ZThn1008_N4Ogre7HlmsPbs19_changeRenderSystemEPNS_12RenderSystemE ``` This is because we set `DEBUG=1` and `_DEBUG=1` on the ogre2 target which seem to change the ABI of the generated library. These defines should really be set if Ogre2 itself is built in debug mode, so this PR simply comments out the CMake command that adds those defines. Signed-off-by: Addisu Z. Taddese --- ogre2/src/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ogre2/src/CMakeLists.txt b/ogre2/src/CMakeLists.txt index 0111d3200..58f5ac9e3 100644 --- a/ogre2/src/CMakeLists.txt +++ b/ogre2/src/CMakeLists.txt @@ -65,7 +65,10 @@ if (TARGET OpenGL::EGL) add_definitions(-DHAVE_EGL=1) endif() -target_compile_definitions(${ogre2_target} PRIVATE $<$:DEBUG=1 _DEBUG=1>) +# You might need to uncomment the following `target_compile_definitions` +# if you've built Ogre from source in Debug mode +# https://github.com/OGRECave/ogre-next/blob/003f51a0a90d1cf93fbea3c7302565b07c4f87b0/OgreMain/include/OgrePlatform.h#L350-L372 +# target_compile_definitions(${ogre2_target} PRIVATE $<$:DEBUG=1 _DEBUG=1>) set (versioned ${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME_LOWER}-${engine_name}${CMAKE_SHARED_LIBRARY_SUFFIX})