opencv_contrib
opencv_contrib copied to clipboard
complling errors on ubuntu 20.04
My computer configurations are: gcc (Ubuntu 7.5.0-6ubuntu2) 7.5.0 cuda 11.3 cudnn 8.2.1 numpy 1.24.3 pandas 2.0.2 matplotlib 3.7.1 scipy 1.10.1 scikit-mage 0.21.0 scikit-learn 1.2.2 lapack 3.11.0
I installed all the needed dependencies ,but when I typed in:
cmake -D CMAKE_BUILD_TYPE=Release
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.7.0/modules
-D OPENCV_ENABLE_NONFREE=ON
-D WITH_OPENMP=ON
-D WITH_TBB=ON
-D WITH_QT=ON
-D CUDA_NVCC_FLAGS="--Wno-deprecated-gpu-targets"
-D OPENCV_EXTRA_EXE_LINKER_FLAGS=-latomic
-D ENABLE_PRECOMPILED_HEADERS=OFF
-D WITH_CUDA=ON
-D WITH_CUDNN=ON
-D ENABLE_FAST_MATH=ON
-D CUDA_FAST_MATH=ON
-D WITH_CUBLAS=ON
-D PYTHON3_EXECUTABLE=/usr/bin/python3
-D PYTHON3_INCLUDE_DIR=/usr/include/python3.8
-D PYTHON3_LIBRARY=/usr/lib/python3.8/config-3.8-x86_64-linux-gnu/libpython3.8.so
-D PYTHON3_PACKAGES_PATH=$(/usr/bin/python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
-D PYTHON3_NUMPY_INCLUDE_DIRS=$(/usr/bin/python3 -c "import numpy as np;import os; print(os.path.dirname(np.file)+'/core/include')")
-D OPENCV_GENERATE_PKGCONFIG=ON
-D CMAKE_INSTALL_PREFIX=/usr/local/opencv4
..
sudo make
Errors occurred as follows:
[ 57%] Automatic MOC for target opencv_cvv [ 57%] Built target opencv_cvv_autogen [ 57%] Building CXX object modules/cvv/CMakeFiles/opencv_cvv.dir/opencv_cvv_autogen/mocs_compilation.cpp.o In file included from /home/Software/opencv4/opencv_contrib-4.7.0/modules/cvv/src/gui/overview_panel.hpp:12:0, from /home/Software/opencv4/opencv_contrib-4.7.0/modules/cvv/src/gui/main_call_window.hpp:9, from /home/Software/opencv4/opencv-4.7.0/build/modules/cvv/opencv_cvv_autogen/MXUWEOXILK/moc_main_call_window.cpp:10, from /home/Software/opencv4/opencv-4.7.0/build/modules/cvv/opencv_cvv_autogen/mocs_compilation.cpp:6: /home/Software/opencv4/opencv_contrib-4.7.0/modules/cvv/src/gui/../stfl/stfl_engine.hpp:31:42: error: ‘constexpr const QString::SplitBehavior Qt::SkipEmptyParts’ redeclared as different kind of symbol static constexpr QString::SplitBehavior SkipEmptyParts = QString::SkipEmptyParts; ^~~~~~~~~~~~~~ In file included from /opt/Qt5.14.2/5.14.2/gcc_64/include/QtCore/qbytearray.h:45:0, from /opt/Qt5.14.2/5.14.2/gcc_64/include/QtCore/qstring.h:50, from /opt/Qt5.14.2/5.14.2/gcc_64/include/QtCore/QString:1, from /home/Software/opencv4/opencv_contrib-4.7.0/modules/cvv/src/gui/call_tab.hpp:4, from /home/Software/opencv4/opencv-4.7.0/build/modules/cvv/opencv_cvv_autogen/MXUWEOXILK/moc_call_tab.cpp:10, from /home/Software/opencv4/opencv-4.7.0/build/modules/cvv/opencv_cvv_autogen/mocs_compilation.cpp:2: /opt/Qt5.14.2/5.14.2/gcc_64/include/QtCore/qnamespace.h:199:9: note: previous declaration ‘Qt::SplitBehaviorFlags SkipEmptyParts’ SkipEmptyParts = 0x1, ^~~~~~~~~~~~~~ make[2]: *** [modules/cvv/CMakeFiles/opencv_cvv.dir/build.make:63:modules/cvv/CMakeFiles/opencv_cvv.dir/opencv_cvv_autogen/mocs_compilation.cpp.o] 错误 1 make[1]: *** [CMakeFiles/Makefile2:7805:modules/cvv/CMakeFiles/opencv_cvv.dir/all] 错误 2 make: *** [Makefile:163:all] 错误 2 zengletian@zengletian-ThinkStation-P520c:/home/Software/opencv4/opencv-4.7.0/build$
Could you give me some suggestions?Thanks very much!
Hello, I think this problem is related with https://github.com/opencv/opencv_contrib/pull/3285 .
I tried Ubuntu 20.04LTS with official Qt 5.12.8 apt packages, but there are no problem.
cvv module has workaroud to change from QString::SplitBehavior
to Qt::SplitBehavior
.
https://github.com/opencv/opencv_contrib/blob/353e37e91f01ae16caca919806b7c38bd255db0c/modules/cvv/src/stfl/stfl_engine.hpp#L26-L33
QT_VERSION | Qt::SplitBehavior | QString::SplitBehaviour | CVV Workaround |
---|---|---|---|
5.12.x | N/S | Supported | Enable |
5.13.x | N/S | Suppotted | Enable |
5.14.x | Supported | Supported | Enable |
5.15.x | Supported | Supported(Deprecated) | Disable |
6.0.x | Supported | N/S | Disable |
- 5.12,x : CVV module defines
Qt::SkipEmptyParts
instfl_engine.hpp
. - 5.15,x : QtCore defines
Qt::SkipEmptyParts
inqnamespace.h
. - 6.0.x : QtCore defines
Qt::SkipEmptyParts
inqnamespace.h
.
But it seems that this workaround is not good for Qt 5.14.
- 5.14,x : CVV module defines
Qt::SkipEmptyParts
instfl_engine.hpp
and QtCore definesQt::SkipEmptyParts
inqnamespace.h
.
Sorry, ubuntu doesn't support Qt 5.14. So testing is hard for me ( it needs to compile from source code). 20.04LTS supports 5.12.8, 22.04LTS/22.10/... support 5.15 series.
Could you try to it ?
- #if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+ #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
When I change “ if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)” to “ if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) ”, the compiling process works well ! Thanks very much!