cmake build error
Hi,
I am working on archlinux, and my opencv version is 3.4.3(by the output of pkg-config --modversion opencv).
My CMakeLists.txt is like this:
cmake_minimum_required(VERSION 2.8.12)
project(example)
if (CMAKE_COMPILER_IS_GNUCXX)
set (CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
message ("CMAKE_CXX_FLAGS is: ${CMAKE_CXX_FLAGS}")
endif (CMAKE_COMPILER_IS_GNUCXX)
find_package(PkgConfig REQUIRED)
pkg_check_modules(OPENCV REQUIRED opencv)
add_executable(main convert_cifar10.cpp)
target_link_libraries(main PRIVATE tcmalloc ${OPENCV_LIBRARIES})
target_include_directories(main PRIVATE ${OPENCV_INCLUDE_DIRS})
target_compile_options(main PRIVATE ${OPENCV_CFLAGS_OTHER})
when I run cmake .
, I got the tons of errors like this:
[100%] Linking CXX executable main /usr/bin/ld: warning: libvtkInteractionStyle.so.1, needed by /usr/lib/libopencv_viz.so.3.4.3, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libvtkFiltersExtraction.so.1, needed by /usr/lib/libopencv_viz.so.3.4.3, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libvtkRenderingLOD.so.1, needed by /usr/lib/libopencv_viz.so.3.4.3, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libvtkIOPLY.so.1, needed by /usr/lib/libopencv_viz.so.3.4.3, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libvtkFiltersTexture.so.1, needed by /usr/lib/libopencv_viz.so.3.4.3, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libvtkIOExport.so.1, needed by /usr/lib/libopencv_viz.so.3.4.3, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libvtkIOImage.so.1, needed by /usr/lib/libopencv_viz.so.3.4.3, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libvtkRenderingGL2PSOpenGL2.so.1, needed by /usr/lib/libopencv_viz.so.3.4.3, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libvtkIOGeometry.so.1, needed by /usr/lib/libopencv_viz.so.3.4.3, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libvtkImagingCore.so.1, needed by /usr/lib/libopencv_viz.so.3.4.3, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libvtkRenderingFreeType.so.1, needed by /usr/lib/libopencv_viz.so.3.4.3, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libvtkRenderingOpenGL2.so.1, needed by /usr/lib/libopencv_viz.so.3.4.3, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libvtkRenderingCore.so.1, needed by /usr/lib/libopencv_viz.so.3.4.3, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libvtkFiltersSources.so.1, needed by /usr/lib/libopencv_viz.so.3.4.3, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libvtkFiltersGeneral.so.1, needed by /usr/lib/libopencv_viz.so.3.4.3, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libvtkFiltersCore.so.1, needed by /usr/lib/libopencv_viz.so.3.4.3, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libvtkIOCore.so.1, needed by /usr/lib/libopencv_viz.so.3.4.3, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libvtkCommonExecutionModel.so.1, needed by /usr/lib/libopencv_viz.so.3.4.3, not found (try using ...
did you build the opencv libs locally (highly recommended !), or did those come from a ppm (always problematic !) ?
it seems, the libs were compiled against a different vtk version, than you have.
does your program require the (problematic) viz module ?
i highly doubt so. instead of
${OPENCV_LIBRARIES}
(which pulls in "all there is") you could try to use only the ones you really need (a program called "convert_cifar10" might only need opencv_core, opencv_imgproc, opencv_imgcodecs -- you get the idea, i hope)