thodan/bop_renderer

Could NOT find OSMesa (missing: OSMESA_INCLUDE_DIR OSMESA_LIBRARY)

jfitzg7 opened this issue · 0 comments

I ran into this problem when trying to run cmake -B build -S . -DCMAKE_BUILD_TYPE=Release:

(gdrnpp) jack@nami:/data2/6d-pose-estimation/bop_renderer$ cmake -B build -S . -DCMAKE_BUILD_TYPE=Release                                                                                                                                       
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):                                                               
  Could NOT find OSMesa (missing: OSMESA_INCLUDE_DIR OSMESA_LIBRARY)                                                                                          
Call Stack (most recent call first):                                                                                                                          
  /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)                                                              
  CMake/FindOSMesa.cmake:45 (find_package_handle_standard_args)                                                                                               
  CMakeLists.txt:7 (find_package)                                                                                                                             
                                                                                                                                                              
                                                                                                                                                              
-- Configuring incomplete, errors occurred!

I then looked into it a little bit more and noticed this block of code in FindOSMesa.cmake:

find_path(OSMESA_INCLUDE_DIR
  NAMES GL/osmesa.h
  PATHS "${OSMESA_ROOT}/include"
        "$ENV{OSMESA_ROOT}/include"
        /usr/openwin/share/include
        /opt/graphics/OpenGL/include
  DOC   "OSMesa include directory")
mark_as_advanced(OSMESA_INCLUDE_DIR)

find_library(OSMESA_LIBRARY
  NAMES OSMesa OSMesa16 OSMesa32
  PATHS "${OSMESA_ROOT}/lib"
        "$ENV{OSMESA_ROOT}/lib"
        /opt/graphics/OpenGL/lib
        /usr/openwin/lib
  DOC   "OSMesa library")
mark_as_advanced(OSMESA_LIBRARY)

I noticed I did not have OSMESA_ROOT set as an environment variable, so I ran export OSMESA_ROOT=/opt/osmesa and then it built successfully.

My question is, where and when is OSMESA_ROOT supposed to be set? Does this happen during the osmesa-install.sh script?