ilpincy/argos3

[Fatal] Can't load library "/usr/lib/argos3/libargos3plugin_simulator_media.so"...undefined symbol

Opened this issue · 1 comments

Hello, I downloaded the argos3-git package from the Arch User Repository for Arch Linux and got this error after building:

brandon@brandons-pc $ argos3 -q all
[FATAL] Can't load library "/usr/lib/argos3/libargos3plugin_simulator_media.so" after trying the following: 

  /usr/lib/argos3/libargos3plugin_simulator_media.so: /usr/lib/argos3/libargos3plugin_simulator_media.so: undefined symbol: _ZN5argos32CDirectionalLEDEntityGridUpdaterC1ERNS_5CGridINS_21CDirectionalLEDEntityEEE

  /usr/lib/argos3/libargos3plugin_simulator_media.so.so: /usr/lib/argos3/libargos3plugin_simulator_media.so.so: cannot open shared object file: No such file or directory

  /usr/lib/argos3/libargos3plugin_simulator_media.so.so: /usr/lib/argos3/libargos3plugin_simulator_media.so.so: cannot open shared object file: No such file or directory

After reading this explanation of a previous issue I decided to try and track down the symbols which were not being found and modified the target_link_library calls in CMakeLists.txt. After making the following modifications I was no longer getting error messages and was able to run simulations.

brandon@brandons-pc $ git diff
diff --git a/src/plugins/simulator/entities/CMakeLists.txt b/src/plugins/simulator/entities/CMakeLists.txt
index 6f47056b..99ccc0ac 100644
--- a/src/plugins/simulator/entities/CMakeLists.txt
+++ b/src/plugins/simulator/entities/CMakeLists.txt
@@ -62,7 +62,7 @@ set(ARGOS3_SOURCES_PLUGINS_SIMULATOR_ENTITIES
 # Create entity plugin library
 #
 add_library(argos3plugin_${ARGOS_BUILD_FOR}_entities SHARED ${ARGOS3_SOURCES_PLUGINS_SIMULATOR_ENTITIES})
-target_link_libraries(argos3plugin_${ARGOS_BUILD_FOR}_entities argos3plugin_${ARGOS_BUILD_FOR}_media)
+#target_link_libraries(argos3plugin_${ARGOS_BUILD_FOR}_entities argos3plugin_${ARGOS_BUILD_FOR}_media)
 
 #
 # Add plugin to ARGOS_PLUGIN_PATH
diff --git a/src/plugins/simulator/media/CMakeLists.txt b/src/plugins/simulator/media/CMakeLists.txt
index f8843de7..ebb3851b 100644
--- a/src/plugins/simulator/media/CMakeLists.txt
+++ b/src/plugins/simulator/media/CMakeLists.txt
@@ -24,7 +24,10 @@ set(ARGOS3_SOURCES_PLUGINS_SIMULATOR_MEDIA
 # Create entity plugin library
 #
 add_library(argos3plugin_${ARGOS_BUILD_FOR}_media SHARED ${ARGOS3_SOURCES_PLUGINS_SIMULATOR_MEDIA})
-target_link_libraries(argos3plugin_${ARGOS_BUILD_FOR}_media argos3core_${ARGOS_BUILD_FOR})
+target_link_libraries(argos3plugin_${ARGOS_BUILD_FOR}_media
+               argos3core_${ARGOS_BUILD_FOR}
+       argos3plugin_${ARGOS_BUILD_FOR}_entities
+)
 
 #
 # Add plugin to ARGOS_PLUGIN_PATH
diff --git a/src/plugins/simulator/visualizations/qt-opengl/CMakeLists.txt b/src/plugins/simulator/visualizations/qt-opengl/CMakeLists.txt
index 62cf7793..e40c6c54 100644
--- a/src/plugins/simulator/visualizations/qt-opengl/CMakeLists.txt
+++ b/src/plugins/simulator/visualizations/qt-opengl/CMakeLists.txt
@@ -58,7 +58,7 @@ endif(ARGOS_WITH_LUA)
 include_directories(${ARGOS_QTOPENGL_INCLUDE_DIRS})
 add_library(argos3plugin_${ARGOS_BUILD_FOR}_qtopengl SHARED
   ${ARGOS3_SOURCES_PLUGINS_SIMULATOR_VISUALIZATIONS_QTOPENGL})
-target_link_libraries(argos3plugin_${ARGOS_BUILD_FOR}_qtopengl argos3plugin_${ARGOS_BUILD_FOR}_entities ${ARGOS_QTOPENGL_LIBRARIES})
+target_link_libraries(argos3plugin_${ARGOS_BUILD_FOR}_qtopengl argos3plugin_${ARGOS_BUILD_FOR}_entities argos3plugin_${ARGOS_BUILD_FOR}_media ${ARGOS_QTOPENGL_LIBRARIES})

I decided to post my solution here since I have no experience with CMake outside of building this project. I don't know if I fixed something which will cause issues in the future.

Here's some more info which may help in determining why I ran into this issue:

brandon@brandons-pc $ uname -a
Linux brandons-pc 6.7.0-arch3-1 #1 SMP PREEMPT_DYNAMIC Sat, 13 Jan 2024 14:37:14 +0000 x86_64 GNU/Linux
brandon@brandons-pc $ ld --version
GNU ld (GNU Binutils) 2.41.0

And finally, the Arch User Repository PKGBUILD which built the package on my system just followed the instructions in README.txt for downloading the repo from github and building the simulator with CMAKE_INSTALL_PREFIX set to /usr and ARGOS_BUILD_NATIVE set to ON.

Thanks! I am not the maintainer of the Arch packages, so having this fix is definitely valuable. I'll have a look at it and incorporate it in the main branch.