Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#62742 closed defect (wontfix)

opencv4, pyX-opencv4 : Fails to build if opencv port is installed

Reported by: cjones051073 (Chris Jones) Owned by: stromnov (Andrey Stromnov)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: mascguy (Christopher Nielsen), cjones051073 (Chris Jones)
Port: opencv4 py38-opencv4

Description

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.

Attachments (2)

opencv4-error.txt.xz (24.7 KB) - added by cjones051073 (Chris Jones) 4 years ago.
py38-opencv4-error.txt.xz (24.4 KB) - added by cjones051073 (Chris Jones) 4 years ago.

Download all attachments as: .zip

Change History (13)

Changed 4 years ago by cjones051073 (Chris Jones)

Attachment: opencv4-error.txt.xz added

Changed 4 years ago by cjones051073 (Chris Jones)

Attachment: py38-opencv4-error.txt.xz added

comment:1 Changed 4 years ago by cjones051073 (Chris Jones)

Port: py38-opencv4 added
Summary: opencv4: Fails to build if opencv is installedopencv4, pyX-opencv4 : Fails to build if opencv port is installed

comment:2 Changed 4 years ago by cjones051073 (Chris Jones)

Owner: set to stromnov
Status: newassigned

comment:3 Changed 4 years ago by cjones051073 (Chris Jones)

Cc: cjones051073 added

comment:4 Changed 4 years ago by mascguy (Christopher Nielsen)

Yes, this is a known issue. The solution is to migrate ports from opencv to opencv3; the latter is completely isolated, like opencv4, and eliminates these problems.

Now that opencv3 has a valid pkgconfig, per merged PR opencv3: update to 3.4.14; fix paths in pkgconfig, that should eliminate the final migration barrier.

I'm actively working on the migration effort. But if anyone wants to help, let me know... ;-)

comment:5 Changed 4 years ago by cjones051073 (Chris Jones)

Ah right, I see, perfect. My situation is I have openimagiio installed that requires opec, so I'll take a look at that ....

comment:6 Changed 4 years ago by mascguy (Christopher Nielsen)

Of note, most folks never encounter this, as a binary install doesn't have this problem. So unless folks either a) install opencv4 with variants enabled, forcing a source build; or b) happen to update their ports before the latest binary is built (perhaps your case?), this isn't a wide-spread issue.

If you don't need any variants, you can simply reinstall opencv4 manually, and a binary will be pulled. (It looks like binaries have been built for everything but Big Sur ARM. So as along as you're not running on an M1 Mac, that'll work.)

That being said, if you want to update openimageio, I'd appreciate it!

comment:8 Changed 4 years ago by cjones051073 (Chris Jones)

Resolution: wontfix
Status: assignedclosed

resolving as 'wont fix' as the solution is to migrate ports away from using opencv at all, to opencv{3,4}.

comment:9 Changed 4 years ago by mascguy (Christopher Nielsen)

Beautiful, that's one less to migrate. Thanks so much Chris!

comment:10 Changed 4 years ago by mascguy (Christopher Nielsen)

Two more migrations are ready-to-go, pending review and CI build completion:

PR 10781 - nomacs: migrate to opencv4

PR 10782 - mlt: migrate to opencv4

Version 0, edited 4 years ago by mascguy (Christopher Nielsen) (next)

comment:11 Changed 4 years ago by mascguy (Christopher Nielsen)

Another migration ready for review:

PR 10790 - sdrangel: migrate from opencv to opencv3

Note: See TracTickets for help on using tickets.