Skip to content

OpenCV Config provides targets with generic names "numeric", "multiview" #24890

@ilya-lavrenov

Description

@ilya-lavrenov

System Information

OpenCV 4.9.0 installed via brew contains generic targets which conflicts with protobuf's ABSEIL names

Detailed description

# Import target "numeric" for configuration "Release"
set_property(TARGET numeric APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(numeric PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/opencv4/3rdparty/libnumeric.a"
  )

list(APPEND _cmake_import_check_targets numeric )
list(APPEND _cmake_import_check_files_for_numeric "${_IMPORT_PREFIX}/lib/opencv4/3rdparty/libnumeric.a" )

# Import target "simple_pipeline" for configuration "Release"
set_property(TARGET simple_pipeline APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(simple_pipeline PROPERTIES
  IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
  IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/opencv4/3rdparty/libsimple_pipeline.a"
  )

list(APPEND _cmake_import_check_targets simple_pipeline )
list(APPEND _cmake_import_check_files_for_simple_pipeline "${_IMPORT_PREFIX}/lib/opencv4/3rdparty/libsimple_pipeline.a" )

I am not sure that it's OpenCV issue or brew dependencies specific (https://github.com/Homebrew/homebrew-core/blob/master/Formula/o/opencv.rb). Could you please advise?

From the OpenCV formula code we can see brew does not patch OpenCV config somehow, so it means OpenCV itself generates such generic names. In my scenario when I use OpenCV and protobuf together, I see the following error:

CMake Error at /opt/homebrew/lib/cmake/opencv4/OpenCVModules.cmake:42 (message):
  Some (but not all) targets in this export set were already defined.

  Targets Defined: numeric

  Targets not yet defined: opencv_core, opencv_flann, opencv_imgproc,
  opencv_intensity_transform, opencv_ml, opencv_phase_unwrapping,
  opencv_photo, opencv_plot, opencv_quality, opencv_reg,
  opencv_surface_matching, opencv_viz, opencv_xphoto, opencv_alphamat,
  opencv_dnn, opencv_dnn_superres, opencv_features2d, opencv_freetype,
  opencv_fuzzy, opencv_hfs, opencv_img_hash, opencv_imgcodecs,
  opencv_line_descriptor, opencv_saliency, opencv_text, opencv_videoio,
  opencv_calib3d, opencv_datasets, opencv_highgui, opencv_mcc,
  opencv_objdetect, opencv_rapid, opencv_rgbd, opencv_shape,
  opencv_structured_light, opencv_video, opencv_videostab,
  opencv_wechat_qrcode, opencv_xfeatures2d, opencv_ximgproc,
  opencv_xobjdetect, opencv_aruco, opencv_bgsegm, opencv_bioinspired,
  opencv_ccalib, opencv_dnn_objdetect, opencv_dpm, opencv_face, opencv_gapi,
  opencv_optflow, opencv_sfm, correspondence, multiview, simple_pipeline,
  opencv_stitching, opencv_superres, opencv_tracking, opencv_stereo

Call Stack (most recent call first):
  /opt/homebrew/lib/cmake/opencv4/OpenCVConfig.cmake:126 (include)
  samples/cpp/common/format_reader/CMakeLists.txt:20 (find_package)

Steps to reproduce

brew install opencv
subl /opt/homebrew/lib/cmake/opencv4/OpenCVModules-release.cmake

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 any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcategory: build/installcategory: contribTarget patches to **opencv_contrib** repository: https://github.com/opencv/opencv_contrib

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions