From 3df49b8c1ef1199066d346004f136d0fec08e68c Mon Sep 17 00:00:00 2001 From: Igor Murzov Date: Wed, 28 Oct 2020 23:16:48 +0300 Subject: [PATCH] Fix rgbd build failure glBindRenderbufferEXT() and some others are GLEW APIs. Fixes the following errors: Linking CXX executable ../../bin/opencv_test_rgbd /usr/bin/ld: ../../lib/libopencv_rgbd.so.4.5.0: undefined reference to `glBindRenderbufferEXT' /usr/bin/ld: ../../lib/libopencv_rgbd.so.4.5.0: undefined reference to `glGenFramebuffersEXT' /usr/bin/ld: ../../lib/libopencv_rgbd.so.4.5.0: undefined reference to `glRenderbufferStorageEXT' /usr/bin/ld: ../../lib/libopencv_rgbd.so.4.5.0: undefined reference to `glGenRenderbuffersEXT' /usr/bin/ld: ../../lib/libopencv_rgbd.so.4.5.0: undefined reference to `glBindFramebufferEXT' /usr/bin/ld: ../../lib/libopencv_rgbd.so.4.5.0: undefined reference to `glFramebufferRenderbufferEXT' collect2: error: ld returned 1 exit status Fixes: https://github.com/opencv/opencv_contrib/issues/2307 on Linux --- modules/rgbd/CMakeLists.txt | 4 ++++ modules/rgbd/src/dynafu.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff -u a/modules/rgbd/CMakeLists.txt b/modules/rgbd/CMakeLists.txt @@ -9,3 +9,9 @@ if(HAVE_OPENGL) ocv_target_link_libraries(${the_module} PRIVATE "${OPENGL_LIBRARIES}") endif() + +if(HAVE_GLEW) + ocv_target_link_libraries(${the_module} ${GLEW_LIBRARIES}) +endif() ++ + diff --git a/modules/rgbd/src/dynafu.cpp b/modules/rgbd/src/dynafu.cpp index 002be7bd6d7..b740ca62e88 100644 --- a/modules/rgbd/src/dynafu.cpp +++ b/modules/rgbd/src/dynafu.cpp @@ -153,7 +153,7 @@ DynaFuImpl::DynaFuImpl(const Params &_params) : params.raycast_step_factor)), pyrPoints(), pyrNormals(), warpfield() { -#ifdef HAVE_OPENGL +#ifdef HAVE_GLEW // Bind framebuffer for off-screen rendering unsigned int fbo_depth; glGenRenderbuffersEXT(1, &fbo_depth);