[ITK] [ITK-dev] ITKExamples OpenCV related link errors

Matt McCormick matt.mccormick at kitware.com
Fri Oct 2 15:10:06 EDT 2015


Hi Arnaud,

This means that OpenCV's *Targets.cmake file is not read.  This file
informs CMake of all the imported library targets' full paths.

To ensure this file is read, 'find_package(OpenCV)' should be called.
This reads in the OpenCVConfig.cmake file, which should read in the
OpenCVTargets.cmake file (I have not checked if these files have these
exact names, but that is the idea).

To make this happen,

  Modules/Video/BridgeOpenCV/CMakeLists.txt

should set ITKVideoBridgeOpenCV_EXPORT_CODE_BUILD and
ITKVideoBridgeOpen_EXPORT_CODE_INSTALL to strings that contain

  set(OpenCV_DIR \"${OpenCV_DIR}\")
  find_package(OpenCV REQUIRED)

The contents of these variable are added to a module's CMake
information file, which is loaded when the module is loaded.

The file

  Modules/ThirdParty/DCMTK/CMakeLists.txt

serves as a good example.

HTH,
Matt

On Thu, Oct 1, 2015 at 9:39 AM, Arnaud Gelas <arnaudgelas at gmail.com> wrote:
> Hi all,
>
> I have built ITK with BridgeOpenCV turned ON and when I compile ITKExamples,
> I get the following linking errors:
>
> FAILED: : && /usr/lib/ccache/c++   -msse2  -g
> src/CMakeFiles/ImageCompareCommand.dir/ImageCompareCommand.cxx.o  -o
> bin/ImageCompareCommand  -rdynamic
> /home/arnaud/install/lib/libITKIOBMP-4.9.so.1 -lexpat -lz
> /home/arnaud/install/lib/libITKIOGDCM-4.9.so.1
> /home/arnaud/install/lib/libITKIOGIPL-4.9.so.1 -ljpeg
> /home/arnaud/install/lib/libITKIOJPEG-4.9.so.1
> /home/arnaud/install/lib/libITKIOMeta-4.9.so.1
> /home/arnaud/install/lib/libITKIONIFTI-4.9.so.1
> /home/arnaud/install/lib/libITKIONRRD-4.9.so.1 -lpng
> /home/arnaud/install/lib/libITKIOPNG-4.9.so.1 -ltiff
> /home/arnaud/install/lib/libITKIOVTK-4.9.so.1
> /home/arnaud/install/lib/libITKLabelMap-4.9.so.1
> /home/arnaud/install/lib/libITKQuadEdgeMesh-4.9.so.1
> /home/arnaud/install/lib/libITKPolynomials-4.9.so.1
> /home/arnaud/install/lib/libITKBiasCorrection-4.9.so.1
> /home/arnaud/install/lib/libITKBioCell-4.9.so.1
> /home/arnaud/install/lib/libITKDICOMParser-4.9.so.1
> /home/arnaud/install/lib/libITKIOSpatialObjects-4.9.so.1
> /home/arnaud/install/lib/libITKFEM-4.9.so.1
> /home/arnaud/install/lib/libITKIOMesh-4.9.so.1
> /usr/lib/x86_64-linux-gnu/hdf5/serial/lib/libhdf5_cpp.so
> /usr/lib/x86_64-linux-gnu/hdf5/serial/lib/libhdf5.so -lpthread -ldl -lm
> /home/arnaud/install/lib/libITKIOBioRad-4.9.so.1
> /home/arnaud/install/lib/libITKIOCSV-4.9.so.1
> /home/arnaud/install/lib/libITKIOGE-4.9.so.1
> /home/arnaud/install/lib/libITKIOSiemens-4.9.so.1
> /home/arnaud/install/lib/libITKIOHDF5-4.9.so.1
> /home/arnaud/install/lib/libITKIOLSM-4.9.so.1
> /home/arnaud/install/lib/libITKIOMRC-4.9.so.1
> /home/arnaud/install/lib/libITKIOStimulate-4.9.so.1
> /home/arnaud/install/lib/libITKIOTransformHDF5-4.9.so.1
> /home/arnaud/install/lib/libITKIOTransformInsightLegacy-4.9.so.1
> /home/arnaud/install/lib/libITKIOTransformMatlab-4.9.so.1
> /home/arnaud/install/lib/libITKKLMRegionGrowing-4.9.so.1
> /home/arnaud/install/lib/libITKWatersheds-4.9.so.1
> /home/arnaud/install/lib/libITKOptimizersv4-4.9.so.1
> /home/arnaud/install/lib/libITKVideoBridgeOpenCV-4.9.so.1
> /home/arnaud/install/lib/libITKVtkGlue-4.9.so.1
> /home/arnaud/install/lib/libitkgdcmMSFF-4.9.so.1
> /home/arnaud/install/lib/libitkgdcmDICT-4.9.so.1
> /home/arnaud/install/lib/libitkgdcmIOD-4.9.so.1
> /home/arnaud/install/lib/libitkgdcmDSED-4.9.so.1
> /home/arnaud/install/lib/libitkgdcmCommon-4.9.so.1
> /home/arnaud/install/lib/libITKNrrdIO-4.9.so.1
> /home/arnaud/install/lib/libITKIOXML-4.9.so.1
> /home/arnaud/install/lib/libITKMetaIO-4.9.so.1
> /home/arnaud/install/lib/libITKgiftiio-4.9.so.1 -lexpat
> /home/arnaud/install/lib/libITKniftiio-4.9.so.1
> /home/arnaud/install/lib/libITKznz-4.9.so.1
> /home/arnaud/install/lib/libITKIOIPL-4.9.so.1
> /home/arnaud/install/lib/libITKIOTIFF-4.9.so.1
> /home/arnaud/install/lib/libITKIOTransformBase-4.9.so.1
> /home/arnaud/install/lib/libITKSpatialObjects-4.9.so.1
> /home/arnaud/install/lib/libITKMesh-4.9.so.1
> /home/arnaud/install/lib/libITKPath-4.9.so.1
> /home/arnaud/install/lib/libITKOptimizers-4.9.so.1
> /home/arnaud/install/lib/libITKStatistics-4.9.so.1
> /home/arnaud/install/lib/libitkNetlibSlatec-4.9.so.1
> /home/arnaud/install/lib/libITKVideoIO-4.9.so.1
> /home/arnaud/install/lib/libITKIOImageBase-4.9.so.1
> /home/arnaud/install/lib/libITKVideoCore-4.9.so.1 -lopencv_videostab
> -lopencv_video -lopencv_ts -lopencv_superres -lopencv_stitching
> -lopencv_photo -lopencv_ocl -lopencv_objdetect -lopencv_nonfree -lopencv_ml
> -lopencv_legacy -lopencv_imgproc -lopencv_highgui -lopencv_gpu
> -lopencv_flann -lopencv_features2d -lopencv_core -lopencv_contrib
> -lopencv_calib3d -ljpeg -lpng -ltiff
> /home/arnaud/install/lib/libITKVTK-4.9.so.1
> /home/arnaud/install/lib/libITKCommon-4.9.so.1
> /home/arnaud/install/lib/libitkdouble-conversion-4.9.so.1
> /home/arnaud/install/lib/libitksys-4.9.so.1
> /home/arnaud/install/lib/libITKVNLInstantiation-4.9.so.1
> /home/arnaud/install/lib/libitkvnl_algo-4.9.so.1
> /home/arnaud/install/lib/libitkv3p_lsqr-4.9.so.1
> /home/arnaud/install/lib/libitkvnl-4.9.so.1
> /home/arnaud/install/lib/libitkvcl-4.9.so.1
> /home/arnaud/install/lib/libitkv3p_netlib-4.9.so.1 -lm -lpthread -lm
> /home/arnaud/install/lib/libvtkRenderingOpenGL-6.3.so.1 -lGLU -lSM -lICE
> -lX11 -lXext -lSM -lICE -lX11 -lXext -lXt
> /home/arnaud/install/lib/libvtkImagingHybrid-6.3.so.1
> /home/arnaud/install/lib/libvtkIOImage-6.3.so.1
> /home/arnaud/install/lib/libvtkDICOMParser-6.3.so.1
> /home/arnaud/install/lib/libvtkIOCore-6.3.so.1
> /home/arnaud/install/lib/libvtkmetaio-6.3.so.1 -lz
> /home/arnaud/install/lib/libvtkRenderingFreeType-6.3.so.1
> /home/arnaud/install/lib/libvtkftgl-6.3.so.1 -lfreetype -lGL
> /home/arnaud/install/lib/libvtkInteractionStyle-6.3.so.1
> /home/arnaud/install/lib/libvtkRenderingCore-6.3.so.1
> /home/arnaud/install/lib/libvtkCommonColor-6.3.so.1
> /home/arnaud/install/lib/libvtkFiltersGeometry-6.3.so.1
> /home/arnaud/install/lib/libvtkFiltersExtraction-6.3.so.1
> /home/arnaud/install/lib/libvtkFiltersStatistics-6.3.so.1
> /home/arnaud/install/lib/libvtkImagingFourier-6.3.so.1
> /home/arnaud/install/lib/libvtkalglib-6.3.so.1
> /home/arnaud/install/lib/libvtkFiltersSources-6.3.so.1
> /home/arnaud/install/lib/libvtkFiltersGeneral-6.3.so.1
> /home/arnaud/install/lib/libvtkFiltersCore-6.3.so.1
> /home/arnaud/install/lib/libvtkCommonComputationalGeometry-6.3.so.1
> /home/arnaud/install/lib/libvtkImagingSources-6.3.so.1
> /home/arnaud/install/lib/libvtkImagingCore-6.3.so.1
> /home/arnaud/install/lib/libvtkCommonExecutionModel-6.3.so.1
> /home/arnaud/install/lib/libvtkCommonDataModel-6.3.so.1
> /home/arnaud/install/lib/libvtkCommonMisc-6.3.so.1
> /home/arnaud/install/lib/libvtkCommonSystem-6.3.so.1
> /home/arnaud/install/lib/libvtksys-6.3.so.1 -ldl
> /home/arnaud/install/lib/libvtkCommonTransforms-6.3.so.1
> /home/arnaud/install/lib/libvtkCommonMath-6.3.so.1
> /home/arnaud/install/lib/libvtkCommonCore-6.3.so.1
> -Wl,-rpath,/home/arnaud/install/lib:/usr/lib/x86_64-linux-gnu/hdf5/serial/lib
> -Wl,-rpath-link,/home/arnaud/install/lib && :
> /usr/bin/ld: cannot find -lopencv_videostab
> /usr/bin/ld: cannot find -lopencv_video
> /usr/bin/ld: cannot find -lopencv_ts
> /usr/bin/ld: cannot find -lopencv_superres
> /usr/bin/ld: cannot find -lopencv_stitching
> /usr/bin/ld: cannot find -lopencv_photo
> /usr/bin/ld: cannot find -lopencv_ocl
> /usr/bin/ld: cannot find -lopencv_objdetect
> /usr/bin/ld: cannot find -lopencv_nonfree
> /usr/bin/ld: cannot find -lopencv_ml
> /usr/bin/ld: cannot find -lopencv_legacy
> /usr/bin/ld: cannot find -lopencv_imgproc
> /usr/bin/ld: cannot find -lopencv_highgui
> /usr/bin/ld: cannot find -lopencv_gpu
> /usr/bin/ld: cannot find -lopencv_flann
> /usr/bin/ld: cannot find -lopencv_features2d
> /usr/bin/ld: cannot find -lopencv_core
> /usr/bin/ld: cannot find -lopencv_contrib
> /usr/bin/ld: cannot find -lopencv_calib3d
> collect2: error: ld returned 1 exit status
> [14/255] Building CXX object
> src/Core/Common/ObserveAnEvent/CMakeFiles/ObserveAnEvent.dir/Code.cxx.o
>
>
> It actually occurs for all executables...
>
>  ${ITK_LIBRARIES} does not contain ${OpenCV_LIBS}, leading to this error.
> Correct?
>
> What would be the best/correct way to fix this error?
>
>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-developers


More information about the Community mailing list