opencv / opencv_contrib

Repository for OpenCV's extra modules
Apache License 2.0
9.36k stars 5.75k forks source link

Build with QT4 disables VTK which throws opencv_contrib dep error in cnn_3dobj.hpp #2051

Open Joel-Mckay opened 5 years ago

Joel-Mckay commented 5 years ago

System information (version)

QT4 disables VTK api ( WITH_VTK=OFF ) and module llb still wants to use the include header: file: opencv_contrib/modules/cnn_3dobj/include/opencv2/cnn_3dobj.hpp line in need of build if macro: #include "opencv2/viz/vizcore.hpp"

note too BUILD_EXAMPLES=OFF as to avoid the VTK dependency in the cpp example, but still allow the cnn module SO binary to build. We must use -D BUILD_opencv_cnn_3dobj=OFF when building the examples or compile job will fail to complete.

cmake -D BUILD_TIFF=ON \ -D CPACK_PACKAGE_VERSION=4 -D EXTRA_MODULES_VCSVERSION=4 -D OPENCV_VCSVERSION=4 \ -D CMAKE_BUILD_TYPE=RELEASE -D OPENCV_EXTRA_MODULES_PATH=/home/pi/SRC/opencv_contrib/modules \ -D WITH_GSTREAMER=ON -D WITH_GSTREAMER_0_10=OFF -D WITH_FFMPEG=ON \ -D_GLIBCXX_USE_CXX11_ABI=0 -D WITH_UNICAP=ON -D BLAS=open \ -D WITH_MATLAB=OFF -D WITH_TESTS=OFF -D ENABLE_PRECOMPILED_HEADERS=OFF \ -D BUILD_opencv_gpulegacy=OFF \ -D OPENCV_ENABLE_NONFREE=ON \ -D WITH_CAFFE=ON -D BUILD_CAFFE=OFF -D Caffe_LIBS=/usr/local/caffe/lib/libcaffe.so -D Caffe_INCLUDE_DIR=/usr/local/caffe/include \ -D WITH_CERES=ON -D BUILD_CERES=OFF -D CERES_LIBS=/usr/local/lib/libceres.a -D CERES_INCLUDE_DIR=/usr/local/include \ -D Atlas_LAPACK_LIBRARY=/usr/lib/liblapack.so \ -D ATLAS_INCLUDE_DIR==/usr/include/atlas/ \ -D ENABLE_NEON=ON \ -D ENABLE_VFPV3=ON \ -D CMAKE_CXX_FLAGS="-DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0" \ -D WITH_GTK=OFF -DWITH_GTK_2_X=OFF -D WITH_QT=4 -D WITH_VTK=OFF \ -D WITH_OPENGL=ON \ -D WITH_CAROTENE=ON -D WITH_OPENCL=OFF -D WITH_OPENCLAMDFFT=OFF -D WITH_OPENCLAMDBLAS=OFF -D WITH_VA_INTEL=OFF \ -D ocv_add_testdata=OFF \ -D CPACK_BINARY_DEB=ON -D CPACK_BINARY_TZ=OFF -D CPACK_BINARY_STGZ=OFF -D CPACK_BINARY_TGZ=OFF \ -D PROTOBUF_UPDATE_FILES=ON \ -D BUILD_PROTOBUF=OFF \ -D PROTOBUF_MIN_PROTOC_VERSION=3004000 \ -D PROTOBUF_LIBRARY=/usr/local/lib/libprotobuf.so \ -D PROTOBUF_LITE_LIBRARY=/usr/local/lib/libprotobuf-lite.so \ -D PROTOBUF_PROTOC_EXECUTABLE=/usr/local/bin/protoc \ -D Protobuf_PROTOC_EXECUTABLE=/usr/local/bin/protoc \ -D PROTOBUF_PROTOC_LIBRARY=/usr/local/lib/libprotoc.so \ -D Protobuf_LIBS=/usr/local/lib/libprotobuf.so \ -D PYTHON2_INCLUDE_DIR2=/usr/local/caffe/include \ -D PYTHON3_INCLUDE_DIR2=/usr/local/caffe/include \ -D PYTHON_DEFAULT_EXECUTABLE=$(which python2) \ -D BUILD_opencv_python2=ON \ -D BUILD_opencv_python3=ON \ -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_opencv_dnn=ON \ -D BUILD_opencv_world=OFF -D BUILD_opencv_cnn_3dobj=ON \ -D WITH_EIGEN=ON -D BUILD_opencv_gs=ON -D BUILD_opencv_ovis=ON -D BUILD_opencv_gpu=ON \ -D BUILD_opencv_gpuarithm=ON -D BUILD_opencv_gpubgsegm=ON -D BUILD_opencv_gpucodec=ON \ -D BUILD_opencv_gpufeatures2d=ON -D BUILD_opencv_gpufilters=ON -D BUILD_opencv_gpuimgproc=ON \ -D BUILD_opencv_gpuoptflow=ON -D BUILD_opencv_gpustereo=ON -D BUILD_opencv_gpuwarping=ON \ -D WITH_OPENMP=ON -D WITH_TBB=ON -D WITH_V4L=ON \ -D CMAKE_INSTALL_PREFIX=/usr -D INSTALL_C_EXAMPLES=ON -D BUILD_EXAMPLES=OFF ..

alalek commented 5 years ago

There is this line in cnn_3dobj's CMake file:

set(BUILD_opencv_cnn_3dobj_INIT OFF)

So this module has been disabled by default (has problems with build scripts).

Enabling this by -D BUILD_opencv_cnn_3dobj=ON custom parameter is user's risk.


We supporting / testing default (almost) set of parameters only. Others are low priority. Feel free to contribute of your want to support / fix custom set of parameters.

BTW, There are too many unused ("gpu"), broken options ("-D ocv_add_testdata=OFF") or misused ("-D_GLIBCXX_USE_CXX11_ABI=0" - compiler option, not CMake).

Joel-Mckay commented 5 years ago

@alalek Thank you for your kind invitation, as I am familiar with a few of your commits, and saw they actually made sense. Yet I fear the current API has been permuted several times since the code base I was more familiar with in 2.x/3... The C interfaces don't even exist in 4.0.1 anymore as far as I can grep.

Also, I tend to follow a philosophy of never modifying public lib interfaces (no exceptions.. ever... you dare to put a version number on it... than it's functionally there forever in my opinion), consistent versioning with namespaces, and immutable macro definitions (add if one must, but never modify... because progress is always fugly). I recall talking with opencv devs in 2014 about the ripple caused by fiddling with the interfaces and structures other projects rely upon. "Impossible to build a house on shifting sands" was the quote I used if I recall. Nobody here seems to acknowledge this is still a serious problem, and thus I don't think my opinions on "hold my beer" coder culture would be welcome. ;-)

I can only responsibly make small bug reports, as when I see a project reach this life-cycle stage... I can only offer my sympathetic support for the devs... as I too have inherited a Sisyphean code base before. ;-)

Best of luck. J

alalek commented 5 years ago

never modifying public lib interfaces

Unfortunately, bag of such legacy code is very huge:

BTW, You may consider different major versions of OpenCV as a different projects (like many other big projects), so you don't need to unify build parameters.