opencv_contrib icon indicating copy to clipboard operation
opencv_contrib copied to clipboard

OpenCV 4.5.5 building CVV module fails with Qt6 selected

Open ozzaman opened this issue 3 years ago • 7 comments

System information (version)
  • OpenCV => 4.5.5:
  • Operating System / Platform => Linux/Ubuntu 64 Bit
  • Compiler => gcc (ver 9.3.0)
Detailed description

I am trying to build OpenCV 4.5.5 from source but it fails when compiling CVV module and throws out QString: No such file or directory

[2/1368] Building CXX object modules/c...v_cvv.dir/src/gui/image_call_tab.cpp.o FAILED: modules/cvv/CMakeFiles/opencv_cvv.dir/src/gui/image_call_tab.cpp.o /usr/bin/c++ -DCVAPI_EXPORTS -D_USE_MATH_DEFINES -D__OPENCV_BUILD=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/opt/opencv/release/modules/cvv -I/opt/opencv/opencv_contrib/modules/cvv -I/opt/opencv/release/modules/cvv/opencv_cvv_autogen/include -I/opt/opencv/release/3rdparty/ippicv/ippicv_lnx/icv/include -I/opt/opencv/release/3rdparty/ippicv/ippicv_lnx/iw/include -I/opt/opencv/release -I/opt/opencv/opencv_contrib/modules/cvv/include -I/opt/opencv/modules/core/include -I/opt/opencv/modules/flann/include -I/opt/opencv/modules/imgproc/include -I/opt/opencv/modules/features2d/include -isystem /opt/intel/oneapi/mkl/2022.0.1/include -isystem /usr/include/eigen3 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wundef -Winit-self -Wpointer-arith -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -Wno-shadow -Wno-missing-declarations -O3 -DNDEBUG -DNDEBUG -fPIC -std=c++11 -MD -MT modules/cvv/CMakeFiles/opencv_cvv.dir/src/gui/image_call_tab.cpp.o -MF modules/cvv/CMakeFiles/opencv_cvv.dir/src/gui/image_call_tab.cpp.o.d -o modules/cvv/CMakeFiles/opencv_cvv.dir/src/gui/image_call_tab.cpp.o -c /opt/opencv/opencv_contrib/modules/cvv/src/gui/image_call_tab.cpp /opt/opencv/opencv_contrib/modules/cvv/src/gui/image_call_tab.cpp:1:10: fatal error: QString: No such file or directory 1 | #include <QString> | ^~~~~~~~~ compilation terminated.

Steps to reproduce

<!-WITH_QT on Platform: Timestamp: 2021-12-30T12:20:27Z
Host: Linux 5.11.0-43-generic x86_64 CMake: 3.22.1 CMake generator: Ninja CMake build tool: /usr/bin/ninja\n" Configuration: Release

GUI: QT6 QT: YES (ver 6.2.2 ) QT OpenGL support: YES (Qt6::OpenGL ) GTK+: YES (ver 3.24.20) GThread : YES (ver 2.64.6) GtkGlExt: NO OpenGL support: YES (/usr/lib/x86_64-linux-gnu/libOpenGL.so /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libGLU.so)

The problem is somewhat related with Qt version 6 since I have built it in my other computer with all the same settings but the Qt version 5.15.2

Is there any way to modify OpenCVFindGUILibs.cmake file and make Qt6 compatible with OpenCV and Contrib modules? -->

Issue submission checklist
  • [ ] I report the issue, it's not a question
  • [ ] I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found solution
  • [ x] I updated to latest OpenCV version and the issue is still there
  • [ ] There is reproducer code and related data files: videos, images, onnx, etc

ozzaman avatar Jan 06 '22 06:01 ozzaman

If you don't need "cvv" module, then you can disable it: -DBUILD_opencv_cvv=OFF

alalek avatar Jan 06 '22 07:01 alalek

If you don't need "cvv" module, then you can disable it: -DBUILD_opencv_cvv=OFF

Well, this is an option, yes, but the underlying problem is strange since I built the same key settings but with Qt version 5.15.2 on another machine and it didn't throw out any errors.

After i switched off the opencv_cvv then i got the error building opencv_rgbd which originates from openGL.

[1251/1906] Linking CXX executable bin/opencv_test_rgbd FAILED: bin/opencv_test_rgbd : && /usr/bin/c++ -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -fopenmp -O3 -DNDEBUG -DNDEBUG -Wl,--gc-sections -Wl,--as-needed modules/rgbd/CMakeFiles/opencv_test_rgbd.dir/test/ocl/test_tsdf.cpp.o modules/rgbd/CMakeFiles/opencv_test_rgbd.dir/test/test_colored_kinfu.cpp.o modules/rgbd/CMakeFiles/opencv_test_rgbd.dir/test/test_dynafu.cpp.o modules/rgbd/CMakeFiles/opencv_test_rgbd.dir/test/test_kinfu.cpp.o modules/rgbd/CMakeFiles/opencv_test_rgbd.dir/test/test_main.cpp.o modules/rgbd/CMakeFiles/opencv_test_rgbd.dir/test/test_normal.cpp.o modules/rgbd/CMakeFiles/opencv_test_rgbd.dir/test/test_odometry.cpp.o modules/rgbd/CMakeFiles/opencv_test_rgbd.dir/test/test_pose_graph.cpp.o modules/rgbd/CMakeFiles/opencv_test_rgbd.dir/test/test_registration.cpp.o modules/rgbd/CMakeFiles/opencv_test_rgbd.dir/test/test_tsdf.cpp.o modules/rgbd/CMakeFiles/opencv_test_rgbd.dir/test/test_utils.cpp.o -o bin/opencv_test_rgbd -Wl,-rpath,/opt/opencv/release/lib:/home/htr/Qt/6.2.2/gcc_64/lib:/usr/local/lib lib/libopencv_ts.a lib/libopencv_rgbd.so.4.5.5 lib/libopencv_highgui.so.4.5.5 lib/libopencv_viz.so.4.5.5 lib/libopencv_calib3d.so.4.5.5 -ldl -lm -lpthread -lrt 3rdparty/lib/libippiw.a 3rdparty/ippicv/ippicv_lnx/icv/lib/intel64/libippicv.a lib/libopencv_videoio.so.4.5.5 lib/libopencv_imgcodecs.so.4.5.5 -ldl -lm -lpthread -lrt lib/libopencv_features2d.so.4.5.5 lib/libopencv_flann.so.4.5.5 lib/libopencv_imgproc.so.4.5.5 lib/libopencv_core.so.4.5.5 -Wl,-rpath-link,/home/htr/Qt/6.2.2/gcc_64/lib:/usr/local/lib && : /usr/bin/ld: lib/libopencv_rgbd.so.4.5.5: undefined reference to glRenderbufferStorageEXT' /usr/bin/ld: lib/libopencv_rgbd.so.4.5.5: undefined reference to glGenFramebuffersEXT' /usr/bin/ld: lib/libopencv_rgbd.so.4.5.5: undefined reference to glGenRenderbuffersEXT' /usr/bin/ld: lib/libopencv_rgbd.so.4.5.5: undefined reference to glFramebufferRenderbufferEXT' /usr/bin/ld: lib/libopencv_rgbd.so.4.5.5: undefined reference to glBindFramebufferEXT' /usr/bin/ld: lib/libopencv_rgbd.so.4.5.5: undefined reference to glBindRenderbufferEXT' collect2: error: ld returned 1 exit status

Is this also be related with Qt6 ?

I could built after switching off opencv_rgbd, but this was not the thing i wanted.

ozzaman avatar Jan 06 '22 09:01 ozzaman

Do you have this patch for opencv_contrib? https://github.com/opencv/opencv_contrib/pull/3128

alalek avatar Jan 06 '22 10:01 alalek

Do you have this patch for opencv_contrib? #3128

Yes, i have it in CMakeLists.txt file in folder /opt/opencv/opencv_contrib/modules/rgbd ... if(HAVE_OPENGL) ocv_target_link_libraries(${the_module} PRIVATE "${OPENGL_LIBRARIES}") endif()

ozzaman avatar Jan 06 '22 10:01 ozzaman

It looks strange.

Could you please dump variable (before if(HAVE_OPENGL) statement)?

message("!!! ${HAVE_OPENGL} / ${OPENGL_LIBRARIES}")

Could you please dump linker parameters of lib/libopencv_rgbd.so.4.5.5 ?

$ rm lib/libopencv_rgbd*
$ ninja -v opencv_rgbd

alalek avatar Jan 06 '22 11:01 alalek

Same with 4.6.0 and GCC 12.

bebuch avatar Jun 15 '22 13:06 bebuch

Looks like #3208 will fix this.

bebuch avatar Jun 16 '22 09:06 bebuch