From nobody@FreeBSD.org  Fri Sep 27 12:47:55 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTP id 48941408
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 27 Sep 2013 12:47:55 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id 36BDC2A10
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 27 Sep 2013 12:47:55 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r8RClt1W011749
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 27 Sep 2013 12:47:55 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r8RClt97011746;
	Fri, 27 Sep 2013 12:47:55 GMT
	(envelope-from nobody)
Message-Id: <201309271247.r8RClt97011746@oldred.freebsd.org>
Date: Fri, 27 Sep 2013 12:47:55 GMT
From: "O. Hartmann" <ohartman@zedat.fu-berlin.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: graphics/opencv: 
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         182443
>Category:       ports
>Synopsis:       graphics/opencv: fix build on -10
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    jhale
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 27 12:50:00 UTC 2013
>Closed-Date:    Tue Oct 22 22:04:05 UTC 2013
>Last-Modified:  Tue Oct 22 22:10:01 UTC 2013
>Originator:     O. Hartmann
>Release:        FreeBSD 10.0-CURRENT amd64
>Organization:
FU Berlin
>Environment:
FreeBSD 10.0-ALPHA2 #0 r255817: Mon Sep 23 18:35:39 CEST 2013 amd64
>Description:
The port graphics/opencv fails on CURRENT with the following error message:

[...]
12 warnings generated.
[  1%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/loadsave.o
[  2%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/precomp.o
[  2%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/utils.o
[  2%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/window.o
[  2%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_QT.o
/usr/ports/graphics/opencv/work/OpenCV-2.3.1/modules/highgui/src/window_QT.cpp:316:5: error: use of undeclared identifier 'usleep'
                                usleep(1000);

>How-To-Repeat:
Install graphics/opencv on 10.0-CURRENT.
>Fix:
After patching and after the error occurs, patch manually the file

modules/highgui/CMakeFiles/opencv_highgui.dir/src/window_QT.cpp

via

--- work/OpenCV-2.3.1/modules/highgui/src/window_QT.cpp.orig    2013-09-27 14:38:36.000000000 +0200
+++ work/OpenCV-2.3.1/modules/highgui/src/window_QT.cpp 2013-09-27 14:39:21.000000000 +0200
@@ -46,6 +46,8 @@
 #ifdef _WIN32
 #include <windows.h>
 #define usleep Sleep
+#else
+#include <unistd.h>
 #endif
 
 #ifndef M_PI


This patch was suggested by T. Nackos via eMail. I tried to patch via a patchfile, but since the C++ sourcefile is obviously created dynamically, it fails.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->jhale 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Fri Sep 27 12:50:08 UTC 2013 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=182443 
State-Changed-From-To: open->closed 
State-Changed-By: jhale 
State-Changed-When: Tue Oct 22 22:04:04 UTC 2013 
State-Changed-Why:  
Committed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=182443 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/182443: commit references a PR
Date: Tue, 22 Oct 2013 22:03:43 +0000 (UTC)

 Author: jhale
 Date: Tue Oct 22 22:03:28 2013
 New Revision: 331331
 URL: http://svnweb.freebsd.org/changeset/ports/331331
 
 Log:
   - Fix typos in EIGEN option
   - Fix build with modern compilers in the contrib module [1]
   - Fix build of opencv-core with clang in the ts module [2]
   - Fix build with QT option [3]
   - Fix build of py-opencv with clang [4]
   
   Reported by:	avg [1], Robert Huff <roberthuff@rcn.com> [2]
   PR:		ports/182443 [3], ports/182837 [4]
   Submitted by:	O. Hartmann <ohartman@zedat.fu-berlin.de> [3], pawel [4]
 
 Added:
   head/graphics/opencv/files/patch-modules__contrib__src__spinimages.cpp   (contents, props changed)
   head/graphics/opencv/files/patch-modules__highgui__src__window_QT.cpp   (contents, props changed)
   head/graphics/opencv/files/patch-modules__python__src2__cv2.cv.hpp   (contents, props changed)
 Modified:
   head/graphics/opencv/Makefile
 
 Modified: head/graphics/opencv/Makefile
 ==============================================================================
 --- head/graphics/opencv/Makefile	Tue Oct 22 22:00:04 2013	(r331330)
 +++ head/graphics/opencv/Makefile	Tue Oct 22 22:03:28 2013	(r331331)
 @@ -17,7 +17,8 @@ LICENSE_FILE=	${WRKSRC}/doc/license.txt
  WANT_GSTREAMER=	yes
  MAKE_JOBS_UNSAFE=	yes
  USE_BZIP2=	yes
 -USES=		cmake pkgconfig
 +USES=		compiler:features cmake pkgconfig
 +USE_DOS2UNIX=	yes
  USE_LDCONFIG=	yes
  
  WRKSRC=		${WRKDIR}/OpenCV-${DISTVERSION}
 @@ -28,12 +29,6 @@ NOT_FOR_ARCHS_REASON_sparc64=	does not c
  DATADIR=	${PREFIX}/share/OpenCV
  PLIST_SUB+=	VERSION=${DISTVERSION}
  
 -_COMPVERSION!=	${CC} --version
 -.if ${_COMPVERSION:Mclang}
 -USE_CXXSTD=	gnu++11
 -CXXFLAGS+=	-Wno-error -Wno-c++11-narrowing
 -.endif
 -
  .if !defined(_BUILDING_OPENCV_CORE) && !defined(_BUILDING_OPENCV_PYTHON)
  EXTRA_PATCHES+=	${FILESDIR}/extra-patch-opencv
  LIB_DEPENDS+=	libopencv_core.so.2:${PORTSDIR}/graphics/opencv-core
 @@ -41,14 +36,14 @@ LDFLAGS+=	-L${LOCALBASE}/lib -lopencv_co
  
  PORTDOCS=	*
  
 -OPTIONS_DEFINE=		EIGEN2 FFMPEG GSTREAMER GTK2 JASPER JPEG OPENEXR PNG \
 +OPTIONS_DEFINE=		EIGEN3 FFMPEG GSTREAMER GTK2 JASPER JPEG OPENEXR PNG \
  			QT4 TBB TIFF V4L XINE EXAMPLES
  OPTIONS_DEFAULT=	EIGEN3 JASPER JPEG PNG TIFF V4L
  
  EIGEN3_DESC=		Eigen 3 support
  EIGEN3_BUILD_DEPENDS=	${LOCALBASE}/include/eigen3/Eigen/Eigen:${PORTSDIR}/math/eigen3
  EIGEN3_CMAKE_ON=	-DWITH_EIGEN:BOOL=On
 -EIGEN3_CMAKE_OFF=	-DDWITH_EIGEN:BOOL=Off
 +EIGEN3_CMAKE_OFF=	-DWITH_EIGEN:BOOL=Off
  
  FFMPEG_LIB_DEPENDS=	libavcodec0.so:${PORTSDIR}/multimedia/ffmpeg0
  FFMPEG_CMAKE_ON=	-DWITH_FFMPEG:BOOL=On
 @@ -143,7 +138,7 @@ RUN_DEPENDS+=	${PYNUMPY}
  CMAKE_ARGS+=	-DBUILD_EXAMPLES:BOOL=Off \
  		-DINSTALL_PYTHON_EXAMPLES:BOOL=Off \
  		-DBUILD_TESTS:BOOL=Off \
 -		-DDWITH_EIGEN2:BOOL=Off \
 +		-DWITH_EIGEN:BOOL=Off \
  		-DWITH_FFMPEG:BOOL=Off \
  		-DWITH_GSTREAMER:BOOL=Off \
  		-DWITH_GTK:BOOL=Off \
 @@ -169,6 +164,11 @@ CMAKE_ARGS+=	-DBUILD_NEW_PYTHON_SUPPORT:
  
  .include <bsd.port.pre.mk>
  
 +.if ${COMPILER_TYPE}=="clang"
 +USE_CXXSTD=	c++11
 +CXXFLAGS+=	-stdlib=libc++ -Wno-error -Wno-c++11-narrowing
 +.endif
 +
  post-patch:
  	@${MKDIR} ${CONFIGURE_WRKSRC}
  	@${REINPLACE_CMD} -e 's:set(OPENCV_SOVERSION.*:set(OPENCV_SOVERSION "$${OPENCV_VERSION_MAJOR}"):' \
 
 Added: head/graphics/opencv/files/patch-modules__contrib__src__spinimages.cpp
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/graphics/opencv/files/patch-modules__contrib__src__spinimages.cpp	Tue Oct 22 22:03:28 2013	(r331331)
 @@ -0,0 +1,37 @@
 +--- ./modules/contrib/src/spinimages.cpp.orig	2013-10-22 07:55:31.000000000 -0400
 ++++ ./modules/contrib/src/spinimages.cpp	2013-10-22 07:55:51.000000000 -0400
 +@@ -85,7 +85,7 @@
 +     };
 +     size_t colors_mum = sizeof(colors)/sizeof(colors[0]);
 + 
 +-template<class FwIt, class T> void iota(FwIt first, FwIt last, T value) { while(first != last) *first++ = value++; }
 ++template<class FwIt, class T> void _iota(FwIt first, FwIt last, T value) { while(first != last) *first++ = value++; }
 + 
 + void computeNormals( const Octree& Octree, const vector<Point3f>& centers, vector<Point3f>& normals, 
 +                     vector<uchar>& mask, float normalRadius, int minNeighbors = 20)
 +@@ -790,14 +790,14 @@
 +     else if (setSize == vtxSize)
 +     {
 +         subset.resize(vtxSize);
 +-        iota(subset.begin(), subset.end(), 0);
 ++        _iota(subset.begin(), subset.end(), 0);
 +     }
 +     else
 +     {
 +         RNG& rnd = theRNG();
 + 
 +         vector<size_t> left(vtxSize);
 +-        iota(left.begin(), left.end(), (size_t)0);
 ++        _iota(left.begin(), left.end(), (size_t)0);
 + 
 +         subset.resize(setSize);
 +         for(size_t i = 0; i < setSize; ++i)
 +@@ -870,7 +870,7 @@
 +     {
 +         mesh.computeNormals(normalRadius, minNeighbors);
 +         subset.resize(mesh.vtx.size());
 +-        iota(subset.begin(), subset.end(), 0);
 ++        _iota(subset.begin(), subset.end(), 0);
 +     }
 +     else
 +         mesh.computeNormals(subset, normalRadius, minNeighbors);
 
 Added: head/graphics/opencv/files/patch-modules__highgui__src__window_QT.cpp
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/graphics/opencv/files/patch-modules__highgui__src__window_QT.cpp	Tue Oct 22 22:03:28 2013	(r331331)
 @@ -0,0 +1,11 @@
 +--- ./modules/highgui/src/window_QT.cpp.orig	2013-10-22 11:01:57.000000000 -0400
 ++++ ./modules/highgui/src/window_QT.cpp	2013-10-22 11:03:10.000000000 -0400
 +@@ -46,6 +46,8 @@
 + #ifdef _WIN32
 + #include <windows.h>
 + #define usleep Sleep
 ++#else
 ++#include <unistd.h>
 + #endif
 + 
 + #ifndef M_PI
 
 Added: head/graphics/opencv/files/patch-modules__python__src2__cv2.cv.hpp
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/graphics/opencv/files/patch-modules__python__src2__cv2.cv.hpp	Tue Oct 22 22:03:28 2013	(r331331)
 @@ -0,0 +1,11 @@
 +--- ./modules/python/src2/cv2.cv.hpp.orig	2013-10-22 17:54:10.000000000 -0400
 ++++ ./modules/python/src2/cv2.cv.hpp	2013-10-22 17:55:03.000000000 -0400
 +@@ -2169,7 +2169,7 @@
 + static int convert_to_CvNextEdgeType(PyObject *o, CvNextEdgeType *dst, const char *name = "no_name")
 + {
 +   if (!PyInt_Check(o)) {
 +-    *dst = (CvNextEdgeType)NULL;
 ++    *dst = (CvNextEdgeType)0;
 +     return failmsg("Expected number for CvNextEdgeType argument '%s'", name);
 +   } else {
 +     *dst = (CvNextEdgeType)PyInt_AsLong(o);
 _______________________________________________
 svn-ports-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-ports-all
 To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
 
>Unformatted:
