Bug 210505 - [exp-run] graphics/opencv: Update to 3.4.1
Summary: [exp-run] graphics/opencv: Update to 3.4.1
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Steve Wills
URL: https://github.com/opencv/opencv/wiki...
Keywords: needs-qa, patch, patch-ready
: 219618 (view as bug list)
Depends on: 215649 215907
Blocks:
  Show dependency treegraph
 
Reported: 2016-06-23 23:22 UTC by rozhuk.im
Modified: 2018-12-19 02:33 UTC (History)
12 users (show)

See Also:
swills: exp-run?
koobs: merge-quarterly-


Attachments
upgraded port (6.39 KB, application/x-gzip)
2016-06-23 23:22 UTC, rozhuk.im
no flags Details
core (1018 bytes, application/x-gzip)
2016-06-23 23:22 UTC, rozhuk.im
no flags Details
upgraded port (8.08 KB, application/x-gzip)
2016-06-25 13:09 UTC, rozhuk.im
no flags Details
fix: implicit declaration of function 'cvRound' (1.27 KB, patch)
2016-07-15 12:35 UTC, rozhuk.im
no flags Details | Diff
opencv (9.06 KB, application/x-gzip)
2016-07-16 02:31 UTC, rozhuk.im
no flags Details
opencv-core (1019 bytes, application/x-gzip)
2016-07-16 02:31 UTC, rozhuk.im
no flags Details
opencv cleanup (interdiff) (16.85 KB, patch)
2016-07-16 23:12 UTC, Jan Beich
no flags Details | Diff
opencv3 (43.65 KB, patch)
2016-10-11 13:57 UTC, rozhuk.im
koobs: maintainer-approval+
Details | Diff
update to 3.2 (61.19 KB, patch)
2017-01-10 15:19 UTC, rozhuk.im
no flags Details | Diff
OpenCV 3.2 (61.52 KB, patch)
2017-02-04 22:31 UTC, rozhuk.im
no flags Details | Diff
add opencv3-core, update (65.58 KB, patch)
2017-04-14 01:03 UTC, rozhuk.im
no flags Details | Diff
c #55 fixes (56.30 KB, patch)
2017-04-15 01:23 UTC, rozhuk.im
no flags Details | Diff
+ pathes (76.05 KB, patch)
2017-04-16 03:08 UTC, rozhuk.im
no flags Details | Diff
update to 3.4 (79.97 KB, patch)
2018-03-21 09:04 UTC, rozhuk.im
no flags Details | Diff
opencv-core 3.4 pkg-plist (4.38 KB, patch)
2018-04-06 06:34 UTC, Matthieu Volat
no flags Details | Diff
opencv 3.4.1 update (95.62 KB, patch)
2018-04-27 20:40 UTC, Steve Wills
no flags Details | Diff
opencv 3.4.1 update (95.62 KB, patch)
2018-04-27 21:08 UTC, Steve Wills
no flags Details | Diff
complete 3.4.1 patch (94.91 KB, patch)
2018-04-28 14:49 UTC, Steve Wills
no flags Details | Diff
opencv 3.4.1 update without ffmpeg changes and with cmake improvements (108.36 KB, patch)
2018-04-28 21:12 UTC, Steve Wills
no flags Details | Diff
opencv 3.4.1 update with fixes (128.09 KB, patch)
2018-05-02 21:52 UTC, Steve Wills
no flags Details | Diff
opencv 3.4.1 update with more fixes (129.00 KB, patch)
2018-05-08 21:15 UTC, Steve Wills
no flags Details | Diff
opencv 3.4.1 final version (129.07 KB, patch)
2018-05-09 01:05 UTC, Steve Wills
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description rozhuk.im 2016-06-23 23:22:20 UTC
Created attachment 171727 [details]
upgraded port

Not tested with other ports.
All options work.
ffmpeg, v4l input work.

Also see: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=202239
Comment 1 rozhuk.im 2016-06-23 23:22:51 UTC
Created attachment 171728 [details]
core
Comment 2 Rainer Hurling 2016-06-24 07:11:59 UTC
(In reply to rozhuk.im from comment #0)
Thanks for investigating in this update :)

Some quick and dirty first tests on HEAD revealed some built problems for me:


graphics/opencv-core needs the following in pkg-plist

#diff -urN pkg-plist.orig pkg-plist
--- pkg-plist.orig	2016-06-23 16:32:22.000000000 +0200
+++ pkg-plist	2016-06-24 07:20:41.589194000 +0200
@@ -73,11 +73,14 @@
 include/opencv2/core/va_intel.hpp
 include/opencv2/core/version.hpp
 include/opencv2/core/wimage.hpp
+include/opencv2/cvconfig.h
 include/opencv2/imgproc.hpp
 include/opencv2/imgproc/detail/distortion_model.hpp
 include/opencv2/imgproc/imgproc.hpp
 include/opencv2/imgproc/imgproc_c.h
 include/opencv2/imgproc/types_c.h
+include/opencv2/opencv.hpp
+include/opencv2/opencv_modules.hpp
 lib/libopencv_core.so
 lib/libopencv_core.so.3.1
 lib/libopencv_core.so.%%VERSION%%


graphics/opencv built breaks with OPTION QT4 enabled, especially opengl related ones. So I had to disable opencl in the ports Makefile:

#diff -urN Makefile.orig Makefile
--- Makefile.orig	2016-06-24 01:01:31.000000000 +0200
+++ Makefile	2016-06-24 07:56:59.704854000 +0200
@@ -24,6 +24,7 @@
 PLIST_SUB+=	VERSION=${DISTVERSION}
 
 CMAKE_ARGS+=	-DWITH_CUDA:BOOL=Off \
+		-DWITH_OPENCL:BOOL=Off \
 		-DWITH_PVAPI:BOOL=Off \
 		-DWITH_UNICAP:BOOL=Off \
 		-DBUILD_CUDA_STUBS:BOOL=Off \


A first test with the successful built of graphics/opencv with math/saga seems to work fine.
Comment 3 rozhuk.im 2016-06-24 08:48:43 UTC
include/opencv2/opencv.hpp
include/opencv2/opencv_modules.hpp
is in graphics/opencv, so you will get conflict that files install into same place.

I made tests on 10.3 with GTK and without QT.
Comment 4 rozhuk.im 2016-06-25 13:09:25 UTC
Created attachment 171788 [details]
upgraded port

add extra/contrib modules
fix QT4 build errors
Comment 5 Jan Beich freebsd_committer 2016-07-12 08:18:31 UTC
opencv and its slaves has yet to pass |poudriere bulk -t| (build, plist checks). Here're a few examples:

graphics/opencv-java and graphics/py-opencv depend on a removed library

  ===>   py27-opencv-3.1.0_3 depends on shared library: libopencv_legacy.so - not found
  *** Error code 1

9.3 i386 needs a fix similar to multimedia/libvpx

  modules/core/include/opencv2/core/hal/intrin_sse.hpp: In member function 'uint64 cv::v_uint64x2::get0() const':
  modules/core/include/opencv2/core/hal/intrin_sse.hpp:211: note: use -flax-vector-conversions to permit conversions between vectors with differing element types or numbers of subparts
  modules/core/include/opencv2/core/hal/intrin_sse.hpp:211: error: cannot convert 'int __vector__' to 'long long int __vector__' for argument '1' to 'long long int __vector__ __builtin_ia32_psrlqi128(long long int __vector__, int)'

EXAMPLES=on + OPENGL=off breaks configure

  samples/gpu/CMakeLists.txt:100 (list):
    list sub-command REMOVE_ITEM

EXTRA_MODULES=off breaks install/package

  ===>  Building package for opencv-3.1.0
  pkg-static: Unable to access file /wrkdirs/usr/ports/graphics/opencv/work/stage/usr/local/l@comment ib/libopencv_ccalib.so: No such file or directory
  pkg-static: DEVELOPER_MODE: Plist error, missing file: l@comment ib/libopencv_ccalib.so
  pkg-static: Unable to access file /wrkdirs/usr/ports/graphics/opencv/work/stage/usr/local/lib/libopencv_optflow.so: No such file or directory
  pkg-static: DEVELOPER_MODE: Plist error, missing file: lib/libopencv_optflow.so
  pkg-static: Unable to access file /wrkdirs/usr/ports/graphics/opencv/work/stage/usr/local/lib/libopencv_optflow.so.3.1: No such file or directory
  pkg-static: DEVELOPER_MODE: Plist error, missing file: lib/libopencv_optflow.so.3.1
  pkg-static: Unable to access file /wrkdirs/usr/ports/graphics/opencv/work/stage/usr/local/lib/libopencv_optflow.so.3.1.0: No such file or directory
  pkg-static: DEVELOPER_MODE: Plist error, missing file: lib/libopencv_optflow.so.3.1.0
  *** Error code 1

and the following files do not appear to be in a any package which may break some consumers

  include/opencv2/cvconfig.h
  include/opencv2/opencv.hpp
  include/opencv2/opencv_modules.hpp

After those are fixed the bug can be marked for exp-run? to measure the regression impact. But you may want to check high-profile consumers like multimedia/ffmpeg beforehand:

  In file included from libavfilter/vf_libopencv.c:26:
  In file included from /usr/local/include/opencv2/imgproc/imgproc_c.h:46:
  In file included from /usr/local/include/opencv2/imgproc/types_c.h:46:
  In file included from /usr/local/include/opencv2/core/core_c.h:48:
  /usr/local/include/opencv2/core/types_c.h:929:13: error: implicit declaration of function 'cvRound'
	is invalid in C99 [-Werror,-Wimplicit-function-declaration]
      ipt.x = cvRound(point.x);
	      ^
Comment 6 rozhuk.im 2016-07-15 12:35:08 UTC
Created attachment 172552 [details]
fix: implicit declaration of function 'cvRound'
Comment 7 rozhuk.im 2016-07-15 12:40:19 UTC
I have no i386 platform, try to buld without sse, avx.

error: implicit declaration of function 'cvRound' - with GCC, clang 3.8 build ok.
Patch added.
Comment 8 rozhuk.im 2016-07-16 02:31:07 UTC
Created attachment 172569 [details]
opencv

"EXAMPLES=on + OPENGL=off breaks configure" - fixed
"EXTRA_MODULES=off breaks install/package" - fixed
add files to include/opencv2/

"py27-opencv-3.1.0_3 depends on shared library: libopencv_legacy.so - not found" - you must rebuild port

multimedia/ffmpeg - build ok
Comment 9 rozhuk.im 2016-07-16 02:31:57 UTC
Created attachment 172570 [details]
opencv-core
Comment 10 Antoine Brodin freebsd_committer 2016-07-16 06:09:25 UTC
Jan or Jason : is this ready for an exp-run?  if so please assign this PR to portmgr

Rozhuk : the preferred way to submit updates is to submit a patch, not tar.gz.gz
Comment 11 Rainer Hurling 2016-07-16 12:17:08 UTC
(1) Trying to build graphics/opencv 3.1 on 12-CURRENT shows some problems with dependencies, not mentioned by the ports Makefile until now:

#with option EXTRA_MODULES enabled:
LIB_DEPENDS+=libprotobuf.so:devel/protobuf
LIB_DEPENDS+=libhdf5.so:science/hdf5

# with option OPENEXR enabled:
LIB_DEPENDS+=libImath-2_2.so:graphics/ilmbase


(2) In the Makefile, there are mentioned some libs, not present in version 3.1
anymore: libopencv_legacy, libopencv_contrib.
Because of this, other ports like graphics/py-opencv aren't able to build ...


(3) A special dependend port, graphics/gimp-gmic-plugin, also has more problems:

--- Makefile.orig       2016-04-01 22:02:12.024689000 +0200
+++ Makefile    2016-07-16 13:09:22.530466000 +0200
@@ -13,7 +13,7 @@

 LIB_DEPENDS=   libGraphicsMagick++.so:graphics/GraphicsMagick \
                libIlmImf.so:graphics/OpenEXR \
-               libopencv_legacy.so:graphics/opencv \
+               libopencv_ml.so:graphics/opencv \
                libMagick++-6.so:graphics/ImageMagick \
                libavcodec.so:multimedia/ffmpeg \
                libfftw3.so:math/fftw3 \

# After that, I don't know, if gimp-gmic-plugin stop because libopencv_hdf
# is really needed, or because this port should be adapted:
[..snip..]
gmake[4]: Verzeichnis „/usr/ports/graphics/gimp-gmic-plugin/work/gmic-1.6.9/src“ wird betreten
g++48 -o gmic gmic.cpp -Dgmic_main  -isystem /usr/local/include -fstack-protector -Wl,-rpath=/usr/local/lib/gc
/usr/local/bin/ld: cannot find -lopencv_hdf
collect2: error: ld returned 1 exit status
gmake[4]: *** [Makefile:404: gmic] Fehler 1
gmake[4]: Verzeichnis „/usr/ports/graphics/gimp-gmic-plugin/work/gmic-1.6.9/src“ wird verlassen
gmake[3]: *** [Makefile:342: cli] Fehler 2
gmake[3]: Verzeichnis „/usr/ports/graphics/gimp-gmic-plugin/work/gmic-1.6.9/src“ wird verlassen
gmake[2]: *** [Makefile:326: all] Fehler 2
gmake[2]: Verzeichnis „/usr/ports/graphics/gimp-gmic-plugin/work/gmic-1.6.9/src“ wird verlassen
*** Error code 1
Comment 12 Jan Beich freebsd_committer 2016-07-16 23:12:43 UTC
Created attachment 172597 [details]
opencv cleanup (interdiff)

9.3 i386 build fails with (worked around via USES=compiler:c++11-lang)

  modules/core/include/opencv2/core/hal/intrin_sse.hpp: In function 'void cv::calcPixelCostBT(const cv::Mat&, const cv::Mat&, int, int, int, cv::CostType*, cv::PixType*, const cv::PixType*, int, int)':
  modules/core/include/opencv2/core/hal/intrin_sse.hpp:966: error: shift must be an immediate
  modules/core/include/opencv2/core/hal/intrin_sse.hpp:966: error: shift must be an immediate
  *** [modules/calib3d/CMakeFiles/opencv_calib3d.dir/src/stereosgbm.cpp.o] Error code 1

Some CFLAGS if passed ignoring CPUID may break runtime on old hardware (worked around via MACHINE_CPU).

  ... -march=i686 ... -msse -msse2 -mno-sse3 -mno-ssse3 -mfpmath=sse ...

graphics/py-opencv is broken even with s/_legacy/_ml/ and needs to be fixed before exp-run

  =======================<phase: stage          >============================
  [...]
  ===>   Generating temporary packing list
  make[1]: cannot open Makefile.

  make[1]: stopped in /wrkdirs/usr/ports/graphics/py-opencv/work/opencv-3.1.0/modules/python
  *** Error code 2

  Stop.
  make: stopped in /usr/ports/graphics/py-opencv

False positives like the following one can be ignored or fixed by LDFLAGS+=-Wl,-as-needed. The issue comes from science/hdf5.

  ====> Running Q/A tests (stage-qa)
  Error: /usr/local/lib/libopencv_hdf.so.3.1.0 is linked to /usr/local/lib/libsz.so.2 from science/szi
  p but it is not declared as a dependency
  Warning: you need LIB_DEPENDS+=libsz.so:science/szip
Comment 13 Jason E. Hale freebsd_committer 2016-09-19 22:58:47 UTC
Return to pool.
Comment 14 commit-hook freebsd_committer 2016-10-03 17:47:34 UTC
A commit references this bug:

Author: jbeich
Date: Mon Oct  3 17:47:14 UTC 2016
New revision: 423216
URL: https://svnweb.freebsd.org/changeset/ports/423216

Log:
  graphics/opencv: add suffix to make room for 3.x series

  To avoid confusion, the main port is to track the latest release.
  Whether to rename includes/libraries as well making it possible to
  install 2.x and 3.x side-by-side remains to be investigated.

  PR:		210505 (for tracking)
  Inspired by:	PkgSrc

Changes:
  head/MOVED
  head/graphics/Makefile
  head/graphics/cimg/Makefile
  head/graphics/frei0r/Makefile
  head/graphics/gimp-gmic-plugin/Makefile
  head/graphics/gstreamer-plugins-opencv/Makefile
  head/graphics/gstreamer1-plugins-opencv/Makefile
  head/graphics/kipi-plugin-removeredeyes/Makefile
  head/graphics/libkface/Makefile
  head/graphics/nomacs/Makefile
  head/graphics/opencv/
  head/graphics/opencv-core/
  head/graphics/opencv-java/
  head/graphics/opencv2/
  head/graphics/opencv2/Makefile
  head/graphics/opencv2/distinfo
  head/graphics/opencv2/files/
  head/graphics/opencv2/files/FindOpenCVCore.cmake.in
  head/graphics/opencv2/files/patch-cmake__OpenCVCompilerOptions.cmake
  head/graphics/opencv2/files/patch-cmake__OpenCVFindLibsGUI.cmake
  head/graphics/opencv2/files/patch-cmake__OpenCVVersion.cmake
  head/graphics/opencv2/files/patch-modules__contrib__src__spinimages.cpp
  head/graphics/opencv2/files/patch-modules__core__src__system.cpp
  head/graphics/opencv2/files/patch-modules__highgui__src__cap_libv4l.cpp
  head/graphics/opencv2/files/patch-modules__highgui__src__cap_v4l.cpp
  head/graphics/opencv2/files/patch-modules__python__src2__cv2.cv.hpp
  head/graphics/opencv2/files/patch-modules__ts__src__ts.cpp
  head/graphics/opencv2/files/patch-samples__cpp__tutorial_code__core__how_to_scan_images__how_to_scan_images.cpp
  head/graphics/opencv2/pkg-descr
  head/graphics/opencv2/pkg-plist
  head/graphics/opencv2-core/
  head/graphics/opencv2-core/Makefile
  head/graphics/opencv2-core/pkg-plist
  head/graphics/opencv2-java/
  head/graphics/opencv2-java/Makefile
  head/graphics/opencv2-java/pkg-plist
  head/graphics/openimageio/Makefile
  head/graphics/p5-Image-ObjectDetect/Makefile
  head/graphics/php-facedetect/Makefile
  head/graphics/py-opencv/
  head/graphics/py-opencv2/
  head/graphics/py-opencv2/Makefile
  head/graphics/py-opencv2/pkg-plist
  head/graphics/rubygem-objectdetect/Makefile
  head/graphics/waifu2x-converter-cpp/Makefile
  head/math/saga/Makefile
  head/math/scilab-toolbox-sivp/Makefile
  head/misc/auto-multiple-choice/Makefile
  head/multimedia/ffmpeg/Makefile
  head/multimedia/ffmpeg0/Makefile
  head/multimedia/gstreamer-plugins/Makefile.common
  head/multimedia/gstreamer1-plugins/Makefile.common
  head/multimedia/libav/Makefile
  head/multimedia/lives/Makefile
  head/multimedia/py-moviepy/Makefile
  head/net/freeswitch/Makefile
  head/net-im/qTox/Makefile
  head/net-p2p/retroshare/Makefile
  head/x11-toolkits/py-kivy/Makefile
Comment 15 Jan Beich freebsd_committer 2016-10-03 18:36:27 UTC
Here's the rest of my plan:
1. Sync graphics/opencv changes just before comment 14
2. Land 3.x port, replacing MOVED with advice in UPDATING
3. Switch leaf consumers that build fine with 3.x
4. Figure out what to do with indirect dependencies on both

If you have other ideas or disagree ports r423216 is trivial to back out.
Comment 16 rozhuk.im 2016-10-04 22:59:15 UTC
I will update files in next few days.
Comment 17 rozhuk.im 2016-10-05 10:30:30 UTC
src contain some dependencies that used as fallback: 
opencv-3.1.0/modules/dnn/3rdparty/protobuf/
opencv-3.1.0/3rdparty/openexr/ (contain libImath-2_2.so:graphics/ilmbase)

so
LIB_DEPENDS+=libprotobuf.so:devel/protobuf
LIB_DEPENDS+=libImath-2_2.so:graphics/ilmbase
not required for work, I write build patch to always use 3rdparty.

LIB_DEPENDS+=libhdf5.so:science/hdf5
required for opencv_hdf module, i add them for extramodules.
Comment 18 rozhuk.im 2016-10-05 11:03:41 UTC
For build with OpenEXR 
LIB_DEPENDS=	libIlmImf.so:graphics/OpenEXR
LIB_DEPENDS+=   libImath-2_2.so:graphics/ilmbase
does not required, opencv contain 1.7 in opencv-3.1.0/3rdparty/openexr/
Comment 19 Jan Beich freebsd_committer 2016-10-05 11:06:19 UTC
(In reply to rozhuk.im from comment #17)
> src contain some dependencies that used as fallback:

Which should be avoided (if possible) according to https://www.freebsd.org/doc/en/books/porters-handbook/bundled-libs.html
Comment 20 rozhuk.im 2016-10-07 12:15:14 UTC
libdata/pkgconfig/libgflag.pc
file required for libopencv_sfm build.

opencv-3.1.0/modules/sfm/CMakeLists.txt
uses pkgconf in build test:
=========================================================
...
if(NOT DEFINED GFLAGS_LIBRARIES)
  set(GFLAGS_LIBRARIES "gflags")
endif()

if(NOT DEFINED GLOG_LIBRARIES)
  set(GLOG_LIBRARIES "glog")
endif()

if(NOT DEFINED SFM_DEPS_OK)

  set(_fname "${CMAKE_CURRENT_BINARY_DIR}/test_sfm_deps.cpp")
  file(WRITE "${_fname}" "#include <glog/logging.h>\n#include <gflags/gflags.h>\nint main() { (void)(0); return 0; }\n")
  try_compile(SFM_DEPS_OK "${CMAKE_CURRENT_BINARY_DIR}" "${_fname}"
      CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${GLOG_INCLUDE_DIRS};${GFLAGS_INCLUDE_DIRS}"
      LINK_LIBRARIES ${GLOG_LIBRARIES} ${GFLAGS_LIBRARIES}
      OUTPUT_VARIABLE OUTPUT
  )
...
=========================================================
-DGFLAGS_LIBRARIES="${LOCALBASE}/lib/libgflags.so" - does not help.

I will wait for devel/gflags port update before continue.
Or I can disable libopencv_sfm build.
Comment 21 Jan Beich freebsd_committer 2016-10-07 13:47:44 UTC
I'm not sure what you're waiting from devel/gflags update. It's not like opencv-3.x looks for gflags via pkg-config. Maybe you're missing USES=localbase or USES=localbase:ldflags.

SFM built fine for me in poudriere with attachment 172597 [details].
Comment 22 rozhuk.im 2016-10-07 17:05:49 UTC
root@rimwks# pkgconf --libs libglog
-L/usr/local/lib -lglog  

root@rimwks# pkgconf --libs libgflag
Package libgflag was not found in the pkg-config search path.
Perhaps you should add the directory containing `libgflag.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libgflag', required by 'virtual:world', not found
Comment 23 Jan Beich freebsd_committer 2016-10-07 17:20:44 UTC
Which line in comment 20 calls pkg-config? Neither PKG_CHECK_MODULES() nor OpenCV wrapper CHECK_MODULE() are there.
Comment 24 rozhuk.im 2016-10-10 16:45:04 UTC
Yes, seem problem was not in missing libgflags.pc
I add libgflags.pc: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213360
but this wont help.

This is works:
--- modules/sfm/CMakeLists.txt.orig	2015-12-17 20:11:31.000000000 +0300
+++ modules/sfm/CMakeLists.txt	2016-10-10 18:28:05.556797000 +0300
@@ -18,9 +18,7 @@
   set(_fname "${CMAKE_CURRENT_BINARY_DIR}/test_sfm_deps.cpp")
   file(WRITE "${_fname}" "#include <glog/logging.h>\n#include <gflags/gflags.h>\nint main() { (void)(0); return 0; }\n")
   try_compile(SFM_DEPS_OK "${CMAKE_CURRENT_BINARY_DIR}" "${_fname}"
-      CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${GLOG_INCLUDE_DIRS};${GFLAGS_INCLUDE_DIRS}"
-      LINK_LIBRARIES ${GLOG_LIBRARIES} ${GFLAGS_LIBRARIES}
-      OUTPUT_VARIABLE OUTPUT
+      CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${GLOG_INCLUDE_DIRS};${GFLAGS_INCLUDE_DIRS} -DLINK_LIBRARIES:STRING=${GLOG_LIBRARIES};${GFLAGS_LIBRARIES}"
   )
   file(REMOVE "${_fname}")
   message(STATUS "Checking SFM deps... ${SFM_DEPS_OK}")
Comment 25 rozhuk.im 2016-10-11 13:57:38 UTC
Created attachment 175624 [details]
opencv3

Build and work OK with most options on my desktop.
Comment 26 Antoine Brodin freebsd_committer 2016-10-11 14:18:57 UTC
As is, I don't see what requires an exp-run.
Comment 27 otacilio.neto 2016-10-18 21:13:40 UTC
Dears,

When will this port be commited?

Thanks a lot for the work.
Comment 28 Kubilay Kocak freebsd_committer freebsd_triage 2016-10-19 10:00:42 UTC
Not a candidate for quarterly branch unless changes are security/bug/build fix related.

Correctly set (no, -) for exp-run.
Comment 29 Kubilay Kocak freebsd_committer freebsd_triage 2016-10-19 10:01:11 UTC
Comment on attachment 172597 [details]
opencv cleanup (interdiff)

Replaced by attachment 175624 [details]
Comment 30 Kubilay Kocak freebsd_committer freebsd_triage 2016-10-19 10:01:40 UTC
Comment on attachment 175624 [details]
opencv3

Port is unmaintained, implicit approval.
Comment 31 Mathieu Arnold freebsd_committer 2016-10-19 10:16:34 UTC
remove the exp-run=-, there was no exp-run, so it did not fail.
Comment 32 Kubilay Kocak freebsd_committer freebsd_triage 2016-10-19 10:23:25 UTC
? records requests, - or + the outcome(s), whether or not additional action was or needed to be taken. 

Cancelling (setting to null) a previously requested flag is always incorrect, please don't do it.
Comment 33 Mathieu Arnold freebsd_committer 2016-10-19 11:29:34 UTC
The documentation says :

  Can mean want/needs/passed/failed exp-run by portmgr:
  * Set (?) to request an exp-run
  * Set (+) means exp-run PASSED
  * Set (-) means exp-run FAILED (new failures, regressions)

FAILED (-) means you cannot commit the patch before fixing failures or regressions.

In that case, there was no need to do an exp-run, so the flag should be removed.

Or the doc needs to be changed, but having the meaning of (-) change from "NO, PLEASE FIX" to "NO, PLEASE FIX, OR DO IT ANYWAY" feels like a bad idea.
Comment 34 otacilio.neto 2016-10-23 13:37:31 UTC
When building OpenCV 3.1 on FreeBSD11-p1, the configure shows that OpenGL support was not enabled but I have enabled it when run make config. Also, python is not found but I have python installed.


--   GUI: 
--     QT:                          NO
--     GTK+ 3.x:                    YES (ver 3.18.8)
--     GThread :                    YES (ver 2.46.2)
--     GtkGlExt:                    NO
--     OpenGL support:              NO
--     VTK support:                 NO
-- 
--   Media I/O: 
--     ZLib:                        /usr/lib/libz.so (ver 1.2.8)
--     JPEG:                        /usr/local/lib/libjpeg.so (ver )
--     WEBP:                        /usr/local/lib/libwebp.so (ver encoder: 0x0209)
--     PNG:                         /usr/local/lib/libpng.so (ver 1.6.21)
--     TIFF:                        /usr/local/lib/libtiff.so (ver 42 - 4.0.6)
--     JPEG 2000:                   /usr/local/lib/libjasper.so (ver 1.900.1)
--     OpenEXR:                     NO
--     GDAL:                        NO
-- 
--   Video I/O:
--     DC1394 1.x:                  NO
--     DC1394 2.x:                  NO
--     FFMPEG:                      YES
--       codec:                     YES (ver 56.60.100)
--       format:                    YES (ver 56.40.101)
--       util:                      YES (ver 54.31.100)
--       swscale:                   YES (ver 3.1.101)
--       resample:                  YES (ver 2.1.0)
--       gentoo-style:              YES
--     GStreamer:                   NO
--     OpenNI:                      NO
--     OpenNI PrimeSensor Modules:  NO
--     OpenNI2:                     NO
--     PvAPI:                       NO
--     GigEVisionSDK:               NO
--     UniCap:                      NO
--     UniCap ucil:                 NO
--     V4L/V4L2:                    Using libv4l1 (ver 1.6.3) / libv4l2 (ver 1.6.3)
--     XIMEA:                       NO
--     Xine:                        NO
--     gPhoto2:                     NO
-- 
--   Parallel framework:            pthreads
-- 
--   Other third-party libraries:
--     Use IPP:                     NO
--     Use IPP Async:               NO
--     Use VA:                      NO
--     Use Intel VA-API/OpenCL:     NO
--     Use Eigen:                   YES (ver 3.2.8)
--     Use Cuda:                    NO
--     Use OpenCL:                  YES
--     Use custom HAL:              NO
-- 
--   OpenCL:
--     Version:                     dynamic
--     Include path:                /usr/local/include/CL
--     Use AMDFFT:                  NO
--     Use AMDBLAS:                 NO
-- 
--   Python 2:
--     Interpreter:                 NO
-- 
--   Python 3:
--     Interpreter:                 NO
-- 
--   Python (for build):            NO
-- 
--   Java:
--     ant:                         NO
--     JNI:                         NO
--     Java wrappers:               NO
--     Java tests:                  NO
-- 
--   Matlab:                        NO
-- 
--   Tests and samples:
--     Tests:                       YES
--     Performance tests:           YES
--     C/C++ Examples:              YES
-- 
--   Install path:                  /usr/local
-- 
--   cvconfig.h is in:              /usr/ports/graphics/opencv3/work/opencv-3.1.0
-- -----------------------------------------------------------------
-- 
CMake Warning at CMakeLists.txt:1250 (message):
  The source directory is the same as binary directory.  "make clean" may
  damage the source tree


-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_OPENEXR
    BUILD_PACKAGE
    BUILD_WITH_DEBUG_INFO
    BUILD_opencv_python
    CMAKE_MODULE_LINKER_FLAGS
    ENABLE_FMA3
    ENABLE_POPCNT
    ENABLE_SSE3
    ENABLE_SSE41
    ENABLE_SSE42
    ENABLE_SSSE3
Comment 35 otacilio.neto 2016-10-31 17:02:54 UTC
This small program do not compile when using this port and -std=c++11 or above.

#include <opencv2/opencv.hpp>

int main(){
	cv::Mat myMat;
	
	return 0;
}

If the user uses c++98 it compiles fine, but, from c++11 and above this error message appears:

[ota@nostromo /usr/home/ota/Desktop]$ c++ -I/usr/local/include -L/usr/local/lib -o main main.cpp -lopencv_core -std=c++11
In file included from main.cpp:1:
In file included from /usr/local/include/opencv2/opencv.hpp:46:
In file included from /usr/local/include/opencv2/core.hpp:3165:
/usr/local/include/opencv2/core/utility.hpp:362:47: error: reinterpret_cast from
      'nullptr_t' to 'int *' is not allowed
        operation(*reinterpret_cast<_Tp*>(0), reinterpret_cast<int*>(NULL));
                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.


When open the file this warning is there:

template<typename _Tp, typename Functor> inline
void Mat::forEach_impl(const Functor& operation) {
    if (false) {
        operation(*reinterpret_cast<_Tp*>(0), reinterpret_cast<int*>(NULL));
        // If your compiler fail in this line.
        // Please check that your functor signature is
        //     (_Tp&, const int*)   <- multidimential
        //  or (_Tp&, void*)        <- in case of you don't need current idx.
    }
Comment 36 Jan Beich freebsd_committer 2016-10-31 17:11:57 UTC
Would replacing NULL with 0 in in that header work? See base r228918.
Comment 37 otacilio.neto 2016-10-31 17:23:43 UTC
(In reply to Jan Beich (mail not working) from comment #36)

I think that yes, but disable this error test is the correct approach? Because this was inserted by the developers to test some compiler functionality.
Comment 38 otacilio.neto 2016-11-07 13:14:12 UTC
I did a replacement of NULL to 0 and compile works. And I posted a question about it on OpenCv developer forums. If I got some answer I will post here.
Comment 39 otacilio.neto 2016-11-08 02:08:41 UTC
I give a try to build OpenCV 3.1 with VTK enabled but it fail. What is the main difficult to build Opencv with vtk?
Comment 40 otacilio.neto 2016-11-08 02:11:15 UTC
Ab(In reply to Jan Beich (mail not working) from comment #36)

Your hint is correct. I did a post on OpenCV foruns about this and got the same answer that from you.

http://answers.opencv.org/question/111137/why-im-getting-this-error-message-usrlocalincludeopencv2coreutilityhpp36247-error-reinterpret_cast-from-nullptr_t-to-int-is-not-allowed/?comment=111152#comment-111152
Comment 41 rozhuk.im 2016-11-08 08:52:59 UTC
They move code: https://github.com/opencv/opencv/blob/master/modules/core/include/opencv2/core/utility.hpp#L481
and change NULL to 0.
A will add patch for this.
Comment 42 otacilio.neto 2016-11-08 18:57:04 UTC
Dears

I have installed math/ceres-solve in my machine. When ceres-solver is installed, Opencv tries compile SFM module. I'm trying compile OpenCV with sfm module enabled, but I'm stucked at this point. First, I have add this line to Makefile because sfm module needs C++11 explicitly.

CXXFLAGS+=        -std=c++11

Then, I have changed /usr/ports/graphics/opencv3/work/opencv-3.1.0/modules/highgui/src/window_gtk.cpp at 488 replacing a NULL to 0


But, compiles fail in this point, I think that it is only a including missing, but I'm not a CMake guy and I will appreciate if someone can give me a hint about how fix it.

Building CXX object modules/objdetect/CMakeFiles/opencv_objdetect.dir/src/detection_based_tracker.cpp.o
cd /usr/ports/graphics/opencv3/work/opencv-3.1.0/modules/objdetect && /usr/bin/c++   -DCVAPI_EXPORTS -D__OPENCV_BUILD=1 -I/usr/ports/graphics/opencv3/work/opencv-3.1.0 -isystem /usr/local/include/eigen3 -isystem /usr/local/include/CL -I/usr/ports/graphics/opencv3/work/opencv-3.1.0/modules/objdetect/include -I/usr/ports/graphics/opencv3/work/opencv-3.1.0/modules/objdetect/src -I/usr/ports/graphics/opencv3/work/opencv-3.1.0/modules/objdetect -I/usr/ports/graphics/opencv3/work/opencv-3.1.0/modules/core/include -I/usr/ports/graphics/opencv3/work/opencv-3.1.0/modules/imgproc/include -I/usr/ports/graphics/opencv3/work/opencv-3.1.0/modules/ml/include -I/usr/ports/graphics/opencv3/work/opencv-3.1.0/modules/imgcodecs/include -I/usr/ports/graphics/opencv3/work/opencv-3.1.0/modules/videoio/include -I/usr/ports/graphics/opencv3/work/opencv-3.1.0/modules/highgui/include -O2 -pipe -fstack-protector -isystem /usr/local/include -fno-strict-aliasing  -std=c++11 -isystem /usr/local/include   -fsigned-char -W -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 -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -Wno-long-long -pthread -Qunused-arguments -fomit-frame-pointer -msse -msse2 -mavx -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -O2 -pipe -fstack-protector -isystem /usr/local/include -fno-strict-aliasing  -std=c++11 -isystem /usr/local/include  -DNDEBUG -fPIC -o CMakeFiles/opencv_objdetect.dir/src/detection_based_tracker.cpp.o -c /usr/ports/graphics/opencv3/work/opencv-3.1.0/modules/objdetect/src/detection_based_tracker.cpp
/usr/ports/graphics/opencv3/work/opencv-3.1.0/modules/objdetect/src/detection_based_tracker.cpp:124:11: error: no member named 'DetectionBasedTracker' in namespace 'cv'
class cv::DetectionBasedTracker::SeparateDetectionWork
      ~~~~^
/usr/ports/graphics/opencv3/work/opencv-3.1.0/modules/objdetect/src/detection_based_tracker.cpp:192:5: error: no member named 'DetectionBasedTracker' in namespace 'cv'
cv::DetectionBasedTracker::SeparateDetectionWork::SeparateDetectionWork(DetectionBasedTracker& _detectionBasedTracker, cv::Ptr<DetectionBasedTracker::IDetector> _detector)
Comment 43 otacilio.neto 2016-11-08 20:58:06 UTC
(In reply to otacilio.neto from comment #42)

Files 

work/opencv-3.1.0/modules/objdetect/src/detection_based_tracker.cpp
work/opencv-3.1.0/modules/objdetect/include/opencv2/objdetect/detection_based_tracker.hpp

have a #if that tests the macro _LINUX_. Replace _LINUX_ by __FreeBSD__ to fix  this issue.
Comment 44 rozhuk.im 2017-01-10 15:19:32 UTC
Created attachment 178719 [details]
update to 3.2

I have no experience with python and java, so I only copy it from 2.4 without tests.

Now fail to build with clang 3.9x (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=215649).

To build set in /etc/make.conf
CC=/usr/local/bin/clang38
CXX=/usr/local/bin/clang++38
CPP=/usr/local/bin/clang-cpp38
or any other installed version.
Comment 45 otacilio.neto 2017-01-31 01:42:47 UTC
Someone have tested opengl support under GTK and QT? Can confirm that this works?
Comment 46 rozhuk.im 2017-02-01 09:12:51 UTC
OpenGL with GTK build ok.
cvShowImage() work.
Comment 47 rozhuk.im 2017-02-04 22:31:41 UTC
Created attachment 179617 [details]
OpenCV 3.2

Fix build extra module dnn with new google protobuf.

Clang in base is fixed, and OpenCV build ok.
Comment 48 marc.priggemeyer 2017-02-25 23:06:06 UTC
I tested this port locally and it appears that (just considering attachment 179617 [details]) files for graphics/opencv3-core are missing. Copying opencv2-core to opencv3-core, adapting opencv3-core/Makefile and rewriting the corresponding pkg-plist file worked for me. I can provide the patch if necessary.

Afterwards tweaking options, i.e. removing ffmpeg, for opencv3 resulted in a sucessful build. The dependencies are still problematic, for example ffmpeg can be configured to depend on opencv2 which conflicts with opencv3.
Comment 49 marc.priggemeyer 2017-02-25 23:10:19 UTC
Also devel/protobuf-c should be included in BUILD_DEPENDS for configuration option EXTRA_MODULES
Comment 50 rozhuk.im 2017-04-14 01:03:49 UTC
Created attachment 181772 [details]
add opencv3-core, update
Comment 51 rozhuk.im 2017-04-14 01:05:15 UTC
(In reply to marc.priggemeyer from comment #49)

Sorry, I forget about opencv3-core wile make patch from svn.
Try now.
Comment 52 Jan Beich freebsd_committer 2017-04-14 02:23:45 UTC
Based on bug 207547 experience making different versions of the same library co-exist isn't trivial. Beyond the basic issue of conflicting build/install some consumers can load more than one version at the same time only to crash later. Lacking time for review either way, should I back out ports r423216 in order to facilitate exp-runs or other committers joining in to help?
Comment 53 rozhuk.im 2017-04-14 02:40:59 UTC
Yes, let committers joining in to help with this.
I use OpenCV only in few my own apps.
And toxcore+uTox builded with OpenCV 3.2, but I dont test video.
Comment 54 commit-hook freebsd_committer 2017-04-14 05:30:39 UTC
A commit references this bug:

Author: jbeich
Date: Fri Apr 14 05:30:29 UTC 2017
New revision: 438490
URL: https://svnweb.freebsd.org/changeset/ports/438490

Log:
  graphics/opencv: back out r423216 and r423063 (replaying r423316)

  Renaming didn't help to unblock 3.x progress as co-existence with 2.x
  was no less complex than simply fixing consumers. This commit also
  restores directory-level history accidentally lost via git-svn.

  PR:		210505
  Pointy hat to:	jbeich (should've discussed first)

Changes:
  head/MOVED
  head/graphics/Makefile
  head/graphics/caffe/Makefile
  head/graphics/cimg/Makefile
  head/graphics/frei0r/Makefile
  head/graphics/gimp-gmic-plugin/Makefile
  head/graphics/gstreamer-plugins-opencv/Makefile
  head/graphics/gstreamer1-plugins-opencv/Makefile
  head/graphics/kipi-plugin-removeredeyes/Makefile
  head/graphics/libkface/Makefile
  head/graphics/nomacs/Makefile
  head/graphics/opencv/
  head/graphics/opencv/Makefile
  head/graphics/opencv-core/
  head/graphics/opencv-core/Makefile
  head/graphics/opencv-java/
  head/graphics/opencv-java/Makefile
  head/graphics/opencv2/
  head/graphics/opencv2-core/
  head/graphics/opencv2-java/
  head/graphics/openimageio/Makefile
  head/graphics/p5-Image-ObjectDetect/Makefile
  head/graphics/php-facedetect/Makefile
  head/graphics/py-opencv/
  head/graphics/py-opencv/Makefile
  head/graphics/py-opencv2/
  head/graphics/rubygem-objectdetect/Makefile
  head/graphics/waifu2x-converter-cpp/Makefile
  head/math/saga/Makefile
  head/math/scilab-toolbox-sivp/Makefile
  head/misc/auto-multiple-choice/Makefile
  head/multimedia/ffmpeg/Makefile
  head/multimedia/ffmpeg0/Makefile
  head/multimedia/gstreamer-plugins/Makefile.common
  head/multimedia/gstreamer1-plugins/Makefile.common
  head/multimedia/libav/Makefile
  head/multimedia/lives/Makefile
  head/multimedia/py-moviepy/Makefile
  head/net/freeswitch/Makefile
  head/net-im/qTox/Makefile
  head/net-im/tox/Makefile
  head/net-p2p/retroshare/Makefile
  head/x11/xpra/Makefile
  head/x11-toolkits/py-kivy/Makefile
Comment 55 Jan Beich freebsd_committer 2017-04-14 05:38:33 UTC
Comment on attachment 181772 [details]
add opencv3-core, update

Can you rebase and make sure at least a few consumers build fine? Apologies for the churn.

> PKGNAMESUFFIX?=	3
[...]
> PKGNAMESUFFIX=	3-${OCV_SLAVE}
[...]
> CONFLICTS_INSTALL=	${PKGBASE:S/${PORTNAME}3/${PORTNAME}/}

According to comment 15 the latest version didn't need suffix, even less now (after comment 53).

> MAINTAINER=	jhale@FreeBSD.org

Can you pick up ports r422467? Otherwise, approval is required if the new maintainer isn't the patch submitter.

> GH_ACCOUNT=	opencv

GH_ACCOUNT=${PORTNAME} is already set by default.

> PORTSCOUT=	limit:^3\.

Why? 4.0 hasn't been released yet, so we don't know how much work it'd be to update the port.

> CXXFLAGS+=	-std=c++11

Convert to USE_CXXSTD=c++11.

> CXXFLAGS+=	-stdlib=libc++

libc++ isn't supported on sparc64, mips* and DragonFly yet.

> USES=		... compiler:c++11-lang ...

Can you re-apply ports r423063 instead? It may break GCC platforms otherwise.

https://lists.freebsd.org/pipermail/svn-src-all/2015-March/101722.html

> OPTIONS_GROUP_SIMD=	SSE SSE2 SSE3 SSSE3 SSE41 SSE42 \
> 			AVX AVX2 FMA3 POPCNT NEON VFPV3

Can you properly apply ports r423062? Users may not be aware NEON/VFPV3 are armv6-specific while the rest is x86-specific.

> OPTIONS_EXCLUDE=	DC1394 EXAMPLES EXTRA_MODULES ARAVIS FFMPEG \

Try to alphabetically sort options.

> LIB_DEPENDS+=		libtesseract.so:graphics/tesseract

Why += and not =? Mandatory deps are supposed to be at the top of Makefile.

> .include <bsd.port.options.mk>
>
> .if ${PORT_OPTIONS:MEXTRA_MODULES}
> GH_PROJECT=		opencv_contrib:extra_mod \
> 			opencv_3rdparty:extra_mod_boostdesc \
> 			opencv_3rdparty:extra_mod_vgg
> GH_TAGNAME=		${PORTVERSION}:extra_mod \
> 			34e4206aef44d50e6bbcd0ab06354b52e7466d26:extra_mod_boostdesc \
> 			fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d:extra_mod_vgg
> LIB_DEPENDS+=		libgflags.so:devel/gflags \
> 			libglog.so:devel/glog \
> 			libhdf5.so:science/hdf5 \
> 			libprotobuf.so:devel/protobuf
> #			libceres.so:math/ceres-solver
> EXTRA_PATCHES+=		${FILESDIR}/extra-patch-modules_sfm_CMakeLists.txt
> .endif

Convert to option helpers and GH_TUPLE e.g.,

  EXTRA_MODULES_GH_TUPLE=	opencv:opencv_contrib:${GH_TAGNAME}:extra_mod \
  				...
  EXTRA_MODULES_LIB_DEPENDS=	libgflags.so:devel/gflags \
  				...
  EXTRA_MODULES_EXTRA_PATCHES=	${PATCHDIR}/extra-patch-modules_sfm_CMakeLists.txt

> .if ${PORT_OPTIONS:MGTK2} && ${PORT_OPTIONS:MOPENGL}
> LIB_DEPENDS+=		libgtkglext-x11-1.0.so:x11-toolkits/gtkglext
> .endif
> [...]
> .if ${PORT_OPTIONS:MQT4} && ${PORT_OPTIONS:MOPENGL}
> USE_QT4+=		opengl
> .endif

Can you pick up ports r423061? It should help to drop bsd.port.options.mk line.

> post-patch:
[...]
> .if ${PORT_OPTIONS:MOPENGL}

Convert to target option helpers, see /usr/ports/CHANGES from 20150701.

> -GSTREAMER_USE=		GSTREAMER1=yes
> +GSTREAMER_USE=		gstreamer1=yes

Try to avoid such gratuitous changes.

> -@comment include/opencv2/opencv.hpp
> -@comment include/opencv2/opencv_modules.hpp

Don't remove these to avoid "poudriere bulk -t" or "poudriere testport" complaining:

===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: include/opencv2/cvconfig.h
Error: Orphaned: include/opencv2/opencv.hpp
Error: Orphaned: include/opencv2/opencv_modules.hpp
Comment 56 rozhuk.im 2017-04-15 01:22:14 UTC
(In reply to Jan Beich from comment #55)

>> LIB_DEPENDS+=		libtesseract.so:graphics/tesseract
> 
> Why += and not =? Mandatory deps are supposed to be at the top of Makefile.

Just to be sure that I dont broke anything.


>> -@comment include/opencv2/opencv.hpp
>> -@comment include/opencv2/opencv_modules.hpp

That files now installed with opencv, not opencv-core.
Comment 57 rozhuk.im 2017-04-15 01:23:36 UTC
Created attachment 181804 [details]
c #55 fixes
Comment 58 rozhuk.im 2017-04-16 03:08:44 UTC
Created attachment 181817 [details]
+ pathes
Comment 59 Tobias C. Berner freebsd_committer 2017-09-12 20:37:05 UTC
By now 3.3.0 has been released:
https://github.com/opencv/opencv/releases/tag/3.3.0
Comment 60 rozhuk.im 2017-09-12 20:46:04 UTC
(In reply to Tobias C. Berner from comment #59)

I know.
Today I update port locally and build opencv-core.
opencv not done yet - to many options that need testing.
Comment 61 Ben Woods freebsd_committer 2018-03-05 08:43:03 UTC
*** Bug 219618 has been marked as a duplicate of this bug. ***
Comment 62 rozhuk.im 2018-03-21 09:04:56 UTC
Created attachment 191690 [details]
update to 3.4

Require more tests, but at least work with mine programs.
Comment 63 Matthieu Volat 2018-04-06 06:34:13 UTC
Created attachment 192271 [details]
opencv-core 3.4 pkg-plist

I think the diff for graphics/opencv-core/pkg-plist is missing?

Here's one I used with any combinaison of options (easier with that one)

Regards,
Comment 64 Steve Wills freebsd_committer 2018-04-27 20:40:09 UTC
Created attachment 192856 [details]
opencv 3.4.1 update

Here's an updated version based on the previous patches.

It's updated to OpenCV 3.4.1. It builds and passes stage-qa tests on 12-CURRENT, 11.1 and 10.3 on amd64 and i386. I have not tested on other architectures, but can and will try to do so soon.

It fixes the py-opencv and opencv-java ports. It enables the extra modules by default so that libopencv_dnn is built, which seems to be required by py-opencv. 

It enables ffmpeg support by default so that opencv can work on local files as well as live video. In order to avoid a circular dependency, it disables opencv support in ffmpeg by default. Perhaps we need to have a slave without ffmpeg support so ffmpeg can depend on it. I'm unsure of the level of desire for that, but if there's interest might be willing to work on that.

I have a port of PySceneDetect which uses the new OpenCV and in my testing the updated py-opencv (and by extension opencv itself) seem to work well. I have not done any runtime testing of opencv-java.

Given the number of ports that depend on opencv directly or indirectly, this may need an exp-run before committing. I would appreciate any review or testing anyone is willing to do. Of course, once this is committed I can commit PySceneDetect.
Comment 65 Jan Beich freebsd_committer 2018-04-27 20:59:34 UTC
(In reply to Steve Wills from comment #64)

opencv-core doesn't depend on ffmpeg, only opencv does. Both graphics/opencv and multimedia/ffmpeg depend on graphics/opencv-core. Did something change in 3.* update to cause a circular dependency?
Comment 66 Steve Wills freebsd_committer 2018-04-27 21:08:15 UTC
Created attachment 192857 [details]
opencv 3.4.1 update

Slight update to fix FLAVOR issue.
Comment 67 Steve Wills freebsd_committer 2018-04-27 21:09:18 UTC
(In reply to Jan Beich from comment #65)
Yeah, that was from the previous work in this bug, I can try to fix it if you want.
Comment 68 Steve Wills freebsd_committer 2018-04-27 21:10:52 UTC
(In reply to Steve Wills from comment #67)
Actually, I'm mistaken. I'm not sure why I was seeing the circular dep. Perhaps I was confused. I will investigate.
Comment 69 Jan Beich freebsd_committer 2018-04-27 22:18:59 UTC
Comment on attachment 192857 [details]
opencv 3.4.1 update

> +CMAKE_ARGS+=	-DENABLE_CXX11:BOOL=ON \
> +		-DBUILD_ZLIB:BOOL=OFF \
> +		-DBUILD_TIFF:BOOL=OFF \
[...]

Can you convert to CMAKE_ON/OFF per ports r457677? :BOOL=ON unconditional options are easy to miss.
Comment 70 Jan Beich freebsd_committer 2018-04-27 22:25:21 UTC
Comment on attachment 192857 [details]
opencv 3.4.1 update

> +V4L_CMAKE_ON=		-DWITH_V4L:BOOL=ON \
> +			-DWITH_LIBV4L:BOOL=ON \
> +			-DCMAKE_REQUIRED_INCLUDES:STRING="${LOCALBASE}/include"
> +V4L_CMAKE_OFF=		-DWITH_V4L:BOOL=OFF -DWITH_LIBV4L:BOOL=OFF

_CMAKE_BOOL supports more than one argument just fine. Try

  V4L_CMAKE_BOOL= WITH_V4L WITH_LIBV4L
  V4L_CMAKE_ON=   CMAKE_REQUIRED_INCLUDES:STRING="${LOCALBASE}/include"
Comment 71 Jan Beich freebsd_committer 2018-04-27 22:53:26 UTC
Comment on attachment 192857 [details]
opencv 3.4.1 update

(In reply to Steve Wills from comment #64)
> +LIB_DEPENDS+=		libprotobuf.so:devel/protobuf \
> +			libtesseract.so:graphics/tesseract

Any reason to put global deps intermixed with option helpers?
portlint doesn't complain due to += instead of =.


> +EXTRA_MODULES_EXTRA_PATCHES+=	${FILESDIR}/extra-patch-modules_dnn__modern_CMakeLists.txt \
> +				${FILESDIR}/extra-patch-modules_sfm_src__libmv__light_libmv_numeric_numeric.h
[...]
> +EXTRA_PATCHES+=			${FILESDIR}/extra-patch-modules_sfm_src_libmv__light_libmv_numeric_numeric.cc

I can't find the patchfiles in the attachment.
Comment 72 rozhuk.im 2018-04-28 07:15:09 UTC
(In reply to Jan Beich from comment #69)
> +		-DBUILD_ZLIB:BOOL=OFF \
> +		-DBUILD_TIFF:BOOL=OFF \

options for build bundled versions of libs.
Comment 73 Steve Wills freebsd_committer 2018-04-28 14:49:38 UTC
Created attachment 192875 [details]
complete 3.4.1 patch

Sorry, forgot to include those patches. Here's the complete one without the change for ffmpeg. I haven't looked at what's causing it yet, but the error with ffmpeg is that it can't find opencv:

===>  Configuring for ffmpeg-3.4.2_1,1
ERROR: opencv not found

I'll look at that and try to make the other changes you mentioned.
Comment 74 Steve Wills freebsd_committer 2018-04-28 14:58:10 UTC
(In reply to Steve Wills from comment #73)
Oh, the ffmpeg thing is this:

https://github.com/opencv/opencv/issues/10963

I'll patch it.
Comment 75 Steve Wills freebsd_committer 2018-04-28 21:12:34 UTC
Created attachment 192885 [details]
opencv 3.4.1 update without ffmpeg changes and with cmake improvements

Ok, fixed things so ffmpeg doesn't need changing and did the cmake changes requested. Are there more to do or is that all that's needed?
Comment 76 Jan Beich freebsd_committer 2018-04-28 22:20:49 UTC
(In reply to Steve Wills from comment #75)
> +CMAKE_ON=	ENABLE_CXX11
> +CMAKE_OFF=	BUILD_ZLIB BUILD_TIFF BUILD_JASPER BUILD_JPEG BUILD_PNG BUILD_OPENEXR BUILD_TBB BUILD_IPP_IW BUILD_ITT BUILD_PROTOBUF

To fit on ~80 column terminal maybe wrap long lines

  CMAKE_ON=  ENABLE_CXX11
  CMAKE_OFF= BUILD_ZLIB BUILD_TIFF ... \
             BUILD_ITT BUILD_PROTOBUF

or use += but group e.g.,

  CMAKE_OFF+= BUILD_ZLIB
  CMAKE_OFF+= BUILD_TIFF
  CMAKE_OFF+= BUILD_JASPER
  ...

> +# Optional 3rd party components
> +CMAKE_ARGS+=	-DWITH_1394:BOOL=OFF \
> +		-DWITH_CAROTENE:BOOL=OFF \

Sorry, I meant to convert all (unconditional) CMAKE_ARGS to CMAKE_ON/OFF.

> -V4L_CMAKE_ON=		-DCMAKE_REQUIRED_INCLUDES:STRING="${LOCALBASE}/include"
> +V4L_CMAKE_ON=		CMAKE_REQUIRED_INCLUDES:STRING="${LOCALBASE}/include"

A typo: missing -D. Simply drop the change to the line.

> Are there more to do or is that all that's needed?

That was readability cosmetics. Review is not blocking (no maintainer) and can be done in parallel to exp-run. Or did you try to build all consumers locally?
Comment 77 Jan Beich freebsd_committer 2018-04-28 22:30:57 UTC
(In reply to rozhuk.im from comment #72)
> options for build bundled versions of libs.

Sure. Duplicates are more confusing. OPTIONS_EXCLUDE already triggers OFF state of option helpers e.g.,

$ make -V CMAKE_ARGS:M\*FFMPEG\* -C /usr/ports/graphics/opencv-core
-DWITH_FFMPEG:BOOL=OFF -DWITH_FFMPEG:BOOL=false
Comment 78 Jan Beich freebsd_committer 2018-04-28 23:00:13 UTC
For one, graphics/waifu2x-converter-cpp fails to detect OpenCV 3.x because

  check_include_file_cxx("opencv2/opencv.hpp" HAVE_OPENCV)

expands into

  $ cat a.cc
  #include <opencv2/opencv.hpp>

  int main()
  {
    return 0;
  }

  $ c++ a.cc -I/usr/local/include
  /usr/bin/ld: error: undefined symbol: cv::String::deallocate()
  >>> referenced by a.cc
  >>>               /tmp/a-d07f07.o:(cv::String::~String())

  /usr/bin/ld: error: undefined symbol: cv::String::deallocate()
  >>> referenced by a.cc
  >>>               /tmp/a-d07f07.o:(cv::String::operator=(cv::String const&))
  c++: error: linker command failed with exit code 1 (use -v to see invocation)
Comment 79 Steve Wills freebsd_committer 2018-04-30 13:14:02 UTC
(In reply to Jan Beich from comment #78)

Yes, I built all the consumers locally and am trying to fix the issues I've found, including that one.

Given there's been zero positive feedback and only pointing out issues on this PR, I have to ask: Are you opposed to this update?
Comment 80 Steve Wills freebsd_committer 2018-05-02 21:52:17 UTC
Created attachment 193009 [details]
opencv 3.4.1 update with fixes

Here's an updated version which fixes almost everything that the update breaks. 

The only thing not fixed is graphics/libkface, which looks like it's no longer maintained or used upstream. In fact, it looks like digikam can just use opencv directly, I think. So I've switched digikam to do that. I noticed Fedora is no longer packaging libkface. Need feedback from kde@ here. Are there any further issues to address?
Comment 81 Steve Wills freebsd_committer 2018-05-03 11:36:03 UTC
Assign to portmgr for exp-run
Comment 86 Steve Wills freebsd_committer 2018-05-08 21:15:39 UTC
Created attachment 193190 [details]
opencv 3.4.1 update with more fixes

This should fix scilab-toolbox-sivp and libkface. Good to go now?
Comment 87 Antoine Brodin freebsd_committer 2018-05-08 21:18:05 UTC
If you tested yes.
Comment 88 Steve Wills freebsd_committer 2018-05-08 21:27:57 UTC
(In reply to Antoine Brodin from comment #87)
Well, I tested scilab-toolbox-sivp and it didn't fail on opencv, it failed in new and other interesting ways.
Comment 89 Steve Wills freebsd_committer 2018-05-09 01:04:12 UTC
(In reply to Steve Wills from comment #88)
Oh wait, I see, scilab-toolbox-sivp uses functions which were deprecated in opencv2 and removed in opencv3 so it can't build any more. And since it has no maintainer and looks safe to deprecate, I'll just do that.
Comment 90 Steve Wills freebsd_committer 2018-05-09 01:05:29 UTC
Created attachment 193196 [details]
opencv 3.4.1 final version

Final version, going to go ahead and commit this.
Comment 91 commit-hook freebsd_committer 2018-05-09 01:10:55 UTC
A commit references this bug:

Author: swills
Date: Wed May  9 01:10:16 UTC 2018
New revision: 469420
URL: https://svnweb.freebsd.org/changeset/ports/469420

Log:
  graphics/opencv: Update to 3.4.1

  PR:		210505
  Submitted by:	rozhuk.im@gmail.com (partially, further work was done)
  Exp-run by:	antoine

Changes:
  head/astro/libkgeomap/Makefile
  head/graphics/cimg/Makefile
  head/graphics/cimg/files/patch-examples__Makefile
  head/graphics/digikam/Makefile
  head/graphics/digikam-kde4/Makefile
  head/graphics/digikam-kde4/Makefile.common
  head/graphics/facedetect/Makefile
  head/graphics/frei0r/Makefile
  head/graphics/gimp-gmic-plugin/Makefile
  head/graphics/kipi-plugin-removeredeyes/Makefile
  head/graphics/libkface/Makefile
  head/graphics/opencv/Makefile
  head/graphics/opencv/distinfo
  head/graphics/opencv/files/extra-patch-modules_dnn__modern_CMakeLists.txt
  head/graphics/opencv/files/extra-patch-modules_sfm_CMakeLists.txt
  head/graphics/opencv/files/extra-patch-modules_sfm_src__libmv__light_libmv_numeric_numeric.h
  head/graphics/opencv/files/extra-patch-modules_sfm_src_libmv__light_libmv_numeric_numeric.cc
  head/graphics/opencv/files/patch-cmake__OpenCVCompilerOptions.cmake
  head/graphics/opencv/files/patch-cmake__OpenCVFindLibsGUI.cmake
  head/graphics/opencv/files/patch-cmake__OpenCVVersion.cmake
  head/graphics/opencv/files/patch-modules__contrib__src__spinimages.cpp
  head/graphics/opencv/files/patch-modules__core__src__system.cpp
  head/graphics/opencv/files/patch-modules__highgui__src__cap_libv4l.cpp
  head/graphics/opencv/files/patch-modules__highgui__src__cap_v4l.cpp
  head/graphics/opencv/files/patch-modules__python__src2__cv2.cv.hpp
  head/graphics/opencv/files/patch-modules__ts__src__ts.cpp
  head/graphics/opencv/files/patch-modules_core_include_opencv2_core_cvdef.h
  head/graphics/opencv/files/patch-modules_core_include_opencv2_core_types__c.h
  head/graphics/opencv/files/patch-modules_core_src_utils_filesystem.cpp
  head/graphics/opencv/files/patch-modules_highgui_include_opencv2_highgui_highgui__c.h
  head/graphics/opencv/files/patch-modules_highgui_src_cap__ffmpeg__impl.hpp
  head/graphics/opencv/files/patch-modules_highgui_src_window.cpp
  head/graphics/opencv/files/patch-modules_highgui_src_window__gtk.cpp
  head/graphics/opencv/files/patch-modules_videoio_src_cap__libv4l.cpp
  head/graphics/opencv/files/patch-samples__cpp__tutorial_code__core__how_to_scan_images__how_to_scan_images.cpp
  head/graphics/opencv/pkg-plist
  head/graphics/opencv-core/Makefile
  head/graphics/opencv-core/pkg-plist
  head/graphics/opencv-java/Makefile
  head/graphics/p5-Image-ObjectDetect/files/patch-lib_Image_ObjectDetect.xs
  head/graphics/php-facedetect/files/
  head/graphics/php-facedetect/files/patch-facedetect.c
  head/graphics/py-opencv/Makefile
  head/graphics/py-opencv/pkg-plist
  head/graphics/rubygem-objectdetect/Makefile
  head/graphics/waifu2x-converter-cpp/files/
  head/graphics/waifu2x-converter-cpp/files/patch-CMakeLists.txt
  head/math/scilab-toolbox-sivp/Makefile
  head/multimedia/gstreamer-plugins-bad/files/patch-ext_opencv_gstfaceblur.c
  head/multimedia/gstreamer-plugins-bad/files/patch-ext_opencv_gstfaceblur.h
  head/multimedia/gstreamer-plugins-bad/files/patch-ext_opencv_gstfacedetect.c
  head/multimedia/gstreamer-plugins-bad/files/patch-ext_opencv_gstfacedetect.h
  head/multimedia/gstreamer-plugins-bad/files/patch-ext_opencv_gsttemplatematch.c
  head/multimedia/gstreamer1-plugins-bad/files/
  head/multimedia/gstreamer1-plugins-bad/files/patch-ext_opencv_gstfacedetect.h
  head/multimedia/gstreamer1-plugins-bad/files/patch-ext_opencv_gsthanddetect.h
  head/multimedia/gstreamer1-plugins-bad/files/patch-ext_opencv_gsttemplatematch.cpp
  head/multimedia/libav/Makefile
  head/www/mod_pagespeed/Makefile
  head/x11-toolkits/py-kivy/Makefile
Comment 92 Steve Wills freebsd_committer 2018-05-09 01:18:44 UTC
Committed, thanks!
Comment 93 Antoine Brodin freebsd_committer 2018-05-11 06:10:52 UTC
There is still  a problem with libfkace:

http://beefy9.nyi.freebsd.org/data/111amd64-default/469496/logs/errors/libkface-15.04.3_4.log
Comment 94 Rainer Hurling 2018-05-11 06:27:13 UTC
(In reply to Antoine Brodin from comment #93)


The Makefile of graphics/libkface points to a non existing library of openCV 2.x. The following should fix this:

--- Makefile.orig	2018-05-09 07:25:33.351057000 +0200
+++ Makefile	2018-05-11 08:19:06.931350000 +0200
@@ -16,7 +16,7 @@
 LICENSE=	GPLv2+ LGPL20+
 LICENSE_COMB=	multi
 
-LIB_DEPENDS=	libopencv_legacy.so:graphics/opencv
+LIB_DEPENDS=	libopencv_ml.so:graphics/opencv
 
 USES=		cmake:outsource kde:4 pathfix pkgconfig tar:xz
 USE_KDE=	kdelibs automoc4 marble



graphics/libkface is deprecated and will be removed in some weeks from the ports tree:

DEPRECATED=     No longer maintained upstream
EXPIRATION_DATE=        2018-06-07

In real world installations, it should be sufficient, to deinstall graphics/libkface and then rebuild formerly depending programs like graphics/digikam-kde4.