Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin library path issues #1836

Closed
simonschmeisser opened this issue Jan 4, 2021 · 3 comments · Fixed by #1839
Closed

plugin library path issues #1836

simonschmeisser opened this issue Jan 4, 2021 · 3 comments · Fixed by #1839

Comments

@simonschmeisser
Copy link
Contributor

I'm testing my new ubuntu ppa and somehow library paths are still messed up

simon@sisBook:~/proggn/isys/ws$ LANG=c rosrun rviz rviz 
[ INFO] [1609771263.214425856]: rviz version 1.14.4
[ INFO] [1609771263.214476142]: compiled against Qt version 5.15.2
[ INFO] [1609771263.214492089]: compiled against OGRE version 1.12.10 (Rhagorthua)
[ INFO] [1609771263.225121082]: Forcing OpenGl version 0.
terminate called after throwing an instance of 'Ogre::InternalErrorException'
  what():  InternalErrorException: Could not load dynamic library /usr/lib/OGRE/RenderSystem_GL.  System Error: /usr/lib/OGRE/RenderSystem_GL.so.1.12.10: cannot open shared object file: No such file or directory in DynLib::load at /build/ogre-1.12-o5dbVM/ogre-1.12-1.12.10+dfsg1/OgreMain/src/OgreDynLib.cpp (line 113)

the plugins are actually installed at /usr/lib/x86_64-linux-gnu/OGRE/RenderSystem_GL.so.1.12.10

packages can be found here: https://launchpad.net/~s-schmeisser/+archive/ubuntu/ogre-1.12

@paroj
Copy link
Member

paroj commented Jan 4, 2021

are you in a folder that contains a plugins.cfg?

I just tried

import Ogre.Bites
ctx = Ogre.Bites.ApplicationContext()
ctx.initApp()

with your package and everything seems to be resolved correctly.

@simonschmeisser
Copy link
Contributor Author

ah, rviz uses a dummy one: https://github.com/ros-visualization/rviz/blob/melodic-devel/ogre_media/plugins.cfg

and then reconstructs it in code: https://github.com/ros-visualization/rviz/blob/d4603a4f6bd0a0009a049268bfbdc11435dea36f/src/rviz/ogre_helpers/render_system.cpp#L163

where the plugin path is a CMake variable: https://github.com/ros-visualization/rviz/blob/d4603a4f6bd0a0009a049268bfbdc11435dea36f/src/rviz/env_config.cpp.in#L52

which gets read from pkconfig here: https://github.com/ros-visualization/rviz/blob/d4603a4f6bd0a0009a049268bfbdc11435dea36f/CMakeLists.txt#L64

or from CMake:

set(OGRE_PLUGIN_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@/@OGRE_PLUGIN_DIR_CMAKE@")

however there is some strange code in @PACKAGE_INIT@:

####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
####### Any changes to this file will be overwritten by the next CMake run ####
####### The input file was OGREConfig.cmake.in                            ########

get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../" ABSOLUTE)

# Use original install prefix when loaded through a "/usr move"
# cross-prefix symbolic link such as /lib -> /usr/lib.
get_filename_component(_realCurr "${CMAKE_CURRENT_LIST_DIR}" REALPATH)
get_filename_component(_realOrig "/usr/lib/x86_64-linux-gnu/OGRE/cmake" REALPATH)
if(_realCurr STREQUAL _realOrig)
  set(PACKAGE_PREFIX_DIR "/usr")
endif()
unset(_realOrig)
unset(_realCurr)

macro(set_and_check _var _file)
  set(${_var} "${_file}")
  if(NOT EXISTS "${_file}")
    message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
  endif()
endmacro()

macro(check_required_components _NAME)
  foreach(comp ${${_NAME}_FIND_COMPONENTS})
    if(NOT ${_NAME}_${comp}_FOUND)
      if(${_NAME}_FIND_REQUIRED_${comp})
        set(${_NAME}_FOUND FALSE)
      endif()
    endif()
  endforeach()
endmacro()

####################################################################################

which leads to OGRE_PLUGIN_PATH being set as /usr/lib/OGRE instead of /usr/lib/x86_64-linux-gnu/OGRE/

@paroj
Copy link
Member

paroj commented Jan 4, 2021

that code comes from:
https://cmake.org/cmake/help/latest/module/CMakePackageConfigHelpers.html#generating-a-package-configuration-file

which is supposed to make the cmake scripts relocatable. I have no idea though, what is going wrong here..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants