[MacPorts] #62742: opencv4: Fails to build if opencv is installed

MacPorts noreply at macports.org
Sat Apr 24 08:02:49 UTC 2021


#62742: opencv4: Fails to build if opencv is installed
--------------------------+---------------------
 Reporter:  cjones051073  |      Owner:  (none)
     Type:  defect        |     Status:  new
 Priority:  Normal        |  Milestone:
Component:  ports         |    Version:
 Keywords:                |       Port:  opencv4
--------------------------+---------------------
 Building the latest version of opencv4 (4.5.2) fails if the opencv port is
 installed at the same time, due to a conflict with the headers it finds
 from  /opt/local/include/opencv2

 {{{
 :info:build [ 86%] Building CXX object
 modules/video/CMakeFiles/opencv_video.dir/opencl_kernels_video.cpp.o
 :info:build cd
 /opt/local/var/macports/build/_Users_chris_Projects_MacPorts_ports_graphics_opencv4/opencv4/work/build/modules/video
 && /usr/bin/clang++ -DCVAPI_EXPORTS -D_USE_MATH_DEFINES -D__OPENCV_BUILD=1
 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
 -I/opt/local/var/macports/build/_Users_chris_Projects_MacPorts_ports_graphics_opencv4/opencv4/work/opencv-4.5.2/modules/video/include
 -I/opt/local/var/macports/build/_Users_chris_Projects_MacPorts_ports_graphics_opencv4/opencv4/work/build/modules/video
 -I/opt/local/var/macports/build/_Users_chris_Projects_MacPorts_ports_graphics_opencv4/opencv4/work/opencv-4.5.2/modules/core/include
 -I/opt/local/var/macports/build/_Users_chris_Projects_MacPorts_ports_graphics_opencv4/opencv4/work/opencv-4.5.2/modules/flann/include
 -I/opt/local/var/macports/build/_Users_chris_Projects_MacPorts_ports_graphics_opencv4/opencv4/work/opencv-4.5.2/modules/imgproc/include
 -I/opt/local/var/macports/build/_Users_chris_Projects_MacPorts_ports_graphics_opencv4/opencv4/work/opencv-4.5.2/modules/features2d/include
 -I/opt/local/var/macports/build/_Users_chris_Projects_MacPorts_ports_graphics_opencv4/opencv4/work/opencv-4.5.2/modules/calib3d/include
 -isystem
 /opt/local/var/macports/build/_Users_chris_Projects_MacPorts_ports_graphics_opencv4/opencv4/work/build
 -pipe -Os -DNDEBUG -I/opt/local/include -stdlib=libc++
 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk
 -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor
 -Werror=address -Werror=sequence-point -Wformat -Werror=format-security
 -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef
 -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wno-
 delete-non-virtual-dtor -Wno-unnamed-type-template-args -Wno-comment
 -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-
 semicolon-before-method-body -ffunction-sections -fdata-sections
 -fvisibility=hidden -fvisibility-inlines-hidden -arch x86_64 -isysroot
 /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -mmacosx-version-
 min=11.0 -fPIC -std=c++11 -o
 CMakeFiles/opencv_video.dir/opencl_kernels_video.cpp.o -c
 /opt/local/var/macports/build/_Users_chris_Projects_MacPorts_ports_graphics_opencv4/opencv4/work/build/modules/video/opencl_kernels_video.cpp
 :info:build In file included from
 /opt/local/var/macports/build/_Users_chris_Projects_MacPorts_ports_graphics_opencv4/opencv4/work/opencv-4.5.2/modules/video/src/tracking/tracker_goturn.cpp:8:
 :info:build In file included from /opt/local/include/opencv2/dnn.hpp:76:
 :info:build In file included from
 /opt/local/include/opencv2/dnn/dnn.hpp:58:
 :info:build /opt/local/include/opencv2/dnn/dict.hpp:63:35: error: cannot
 initialize a member subobject of type 'int' with an rvalue of type
 'cv::Param'
 :info:build     DictValue(bool i)           : type(Param::INT), pi(new
 AutoBuffer<int64,1>) { (*pi)[0] = i ? 1 : 0; }       //!< Constructs
 integer scalar
 :info:build                                   ^    ~~~~~~~~~~
 }}}

 deactivating opencv before the build fixes the issue.

 opencv4 should be patched so it does not opportunistically find (and fail
 to build with) the opencv2 headers from the opencv port.

-- 
Ticket URL: <https://trac.macports.org/ticket/62742>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list