Fix FTBFS with GCC 6 (#1307821)

Now the correct patches.
epel9
Sérgio M. Basto 9 years ago
parent 8ce3dc6e27
commit ca7da00ea6

@ -1,128 +0,0 @@
From 3a4653aeecd7804ba0064c7877e41cbeb55abb54 Mon Sep 17 00:00:00 2001
From: Yaakov Selkowitz <yselkowi@redhat.com>
Date: Tue, 1 Mar 2016 00:33:53 -0600
Subject: [PATCH] Fix FTBFS with GCC 6 (#1307821)
---
opencv-2.4.12.3-gcc6.patch | 68 ++++++++++++++++++++++++++++++++++++++++++++++
opencv.spec | 9 +++++-
2 files changed, 76 insertions(+), 1 deletion(-)
create mode 100644 opencv-2.4.12.3-gcc6.patch
diff --git a/opencv-2.4.12.3-gcc6.patch b/opencv-2.4.12.3-gcc6.patch
new file mode 100644
index 0000000..71f7b5b
--- /dev/null
+++ b/opencv-2.4.12.3-gcc6.patch
@@ -0,0 +1,68 @@
+diff --git a/modules/contrib/src/chamfermatching.cpp b/modules/contrib/src/chamfermatching.cpp
+--- a/modules/contrib/src/chamfermatching.cpp
++++ b/modules/contrib/src/chamfermatching.cpp
+@@ -966,10 +966,8 @@ void ChamferMatcher::Matching::computeDistanceTransform(Mat& edges_img, Mat& dis
+ for (int y=0;y<h;++y) {
+ for (int x=0;x<w;++x) {
+ // initialize
+- if (&annotate_img!=NULL) {
+- annotate_img.at<Vec2i>(y,x)[0]=x;
+- annotate_img.at<Vec2i>(y,x)[1]=y;
+- }
++ annotate_img.at<Vec2i>(y,x)[0]=x;
++ annotate_img.at<Vec2i>(y,x)[1]=y;
+
+ uchar edge_val = edges_img.at<uchar>(y,x);
+ if( (edge_val!=0) ) {
+@@ -1013,10 +1011,8 @@ void ChamferMatcher::Matching::computeDistanceTransform(Mat& edges_img, Mat& dis
+ dist_img.at<float>(ny,nx) = dist;
+ q.push(std::make_pair(nx,ny));
+
+- if (&annotate_img!=NULL) {
+- annotate_img.at<Vec2i>(ny,nx)[0]=annotate_img.at<Vec2i>(y,x)[0];
+- annotate_img.at<Vec2i>(ny,nx)[1]=annotate_img.at<Vec2i>(y,x)[1];
+- }
++ annotate_img.at<Vec2i>(ny,nx)[0]=annotate_img.at<Vec2i>(y,x)[0];
++ annotate_img.at<Vec2i>(ny,nx)[1]=annotate_img.at<Vec2i>(y,x)[1];
+ }
+ }
+ }
+@@ -1107,26 +1103,22 @@ ChamferMatcher::Match* ChamferMatcher::Matching::localChamferDistance(Point offs
+
+ float cost = (sum_distance/truncate_)/addr.size();
+
++ float* optr = orientation_img.ptr<float>(y)+x;
++ float sum_orientation = 0;
++ int cnt_orientation = 0;
+
+- if (&orientation_img!=NULL) {
+- float* optr = orientation_img.ptr<float>(y)+x;
+- float sum_orientation = 0;
+- int cnt_orientation = 0;
++ for (size_t i=0;i<addr.size();++i) {
+
+- for (size_t i=0;i<addr.size();++i) {
+-
+- if(addr[i] < (orientation_img.cols*orientation_img.rows) - (offset.y*orientation_img.cols + offset.x)){
+- if (tpl->orientations[i]>=-CV_PI && (*(optr+addr[i]))>=-CV_PI) {
+- sum_orientation += orientation_diff(tpl->orientations[i], (*(optr+addr[i])));
+- cnt_orientation++;
+- }
++ if(addr[i] < (orientation_img.cols*orientation_img.rows) - (offset.y*orientation_img.cols + offset.x)){
++ if (tpl->orientations[i]>=-CV_PI && (*(optr+addr[i]))>=-CV_PI) {
++ sum_orientation += orientation_diff(tpl->orientations[i], (*(optr+addr[i])));
++ cnt_orientation++;
+ }
+ }
++ }
+
+- if (cnt_orientation>0) {
+- cost = (float)(beta*cost+alpha*(sum_orientation/(2*CV_PI))/cnt_orientation);
+- }
+-
++ if (cnt_orientation>0) {
++ cost = (float)(beta*cost+alpha*(sum_orientation/(2*CV_PI))/cnt_orientation);
+ }
+
+ if(cost > 0){
+
diff --git a/opencv.spec b/opencv.spec
index 8749958..9853d30 100644
--- a/opencv.spec
+++ b/opencv.spec
@@ -12,7 +12,7 @@
Name: opencv
Version: 2.4.12.3
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: Collection of algorithms for computer vision
Group: Development/Libraries
# This is normal three clause BSD.
@@ -37,6 +37,9 @@ Patch4: opencv-2.4.7-cmake_paths.patch
# Fix macro usage of "list_filterout"
# https://github.com/pld-linux/opencv/commit/dadee4672641272b129410bc097f5c199bb4fb43
Patch5: opencv-2.4.11-listfilterout.patch
+# fix build with gcc6
+# https://github.com/Itseez/opencv/commit/eebd4cad665f4f1270ca58bb13e9708e130f9b30
+Patch6: opencv-2.4.12.3-gcc6.patch
BuildRequires: libtool
BuildRequires: cmake >= 2.6.3
@@ -137,6 +140,7 @@ This package contains Python bindings for the OpenCV library.
%patch3 -p1 -b .ts_static
%patch4 -p1 -b .cmake_paths
%patch5 -p1 -b .listfilterout
+%patch6 -p1 -b .gcc6
# fix dos end of lines
sed -i 's|\r||g' samples/c/adaptiveskindetector.cpp
@@ -272,6 +276,9 @@ popd
%{python2_sitearch}/cv2.so
%changelog
+* Tue Mar 01 2016 Yaakov Selkowitz <yselkowi@redhat.com> - 2.4.12.3-3
+- Fix FTBFS with GCC 6 (#1307821)
+
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.12.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
--
2.5.0

@ -0,0 +1,68 @@
diff --git a/modules/contrib/src/chamfermatching.cpp b/modules/contrib/src/chamfermatching.cpp
--- a/modules/contrib/src/chamfermatching.cpp
+++ b/modules/contrib/src/chamfermatching.cpp
@@ -966,10 +966,8 @@ void ChamferMatcher::Matching::computeDistanceTransform(Mat& edges_img, Mat& dis
for (int y=0;y<h;++y) {
for (int x=0;x<w;++x) {
// initialize
- if (&annotate_img!=NULL) {
- annotate_img.at<Vec2i>(y,x)[0]=x;
- annotate_img.at<Vec2i>(y,x)[1]=y;
- }
+ annotate_img.at<Vec2i>(y,x)[0]=x;
+ annotate_img.at<Vec2i>(y,x)[1]=y;
uchar edge_val = edges_img.at<uchar>(y,x);
if( (edge_val!=0) ) {
@@ -1013,10 +1011,8 @@ void ChamferMatcher::Matching::computeDistanceTransform(Mat& edges_img, Mat& dis
dist_img.at<float>(ny,nx) = dist;
q.push(std::make_pair(nx,ny));
- if (&annotate_img!=NULL) {
- annotate_img.at<Vec2i>(ny,nx)[0]=annotate_img.at<Vec2i>(y,x)[0];
- annotate_img.at<Vec2i>(ny,nx)[1]=annotate_img.at<Vec2i>(y,x)[1];
- }
+ annotate_img.at<Vec2i>(ny,nx)[0]=annotate_img.at<Vec2i>(y,x)[0];
+ annotate_img.at<Vec2i>(ny,nx)[1]=annotate_img.at<Vec2i>(y,x)[1];
}
}
}
@@ -1107,26 +1103,22 @@ ChamferMatcher::Match* ChamferMatcher::Matching::localChamferDistance(Point offs
float cost = (sum_distance/truncate_)/addr.size();
+ float* optr = orientation_img.ptr<float>(y)+x;
+ float sum_orientation = 0;
+ int cnt_orientation = 0;
- if (&orientation_img!=NULL) {
- float* optr = orientation_img.ptr<float>(y)+x;
- float sum_orientation = 0;
- int cnt_orientation = 0;
+ for (size_t i=0;i<addr.size();++i) {
- for (size_t i=0;i<addr.size();++i) {
-
- if(addr[i] < (orientation_img.cols*orientation_img.rows) - (offset.y*orientation_img.cols + offset.x)){
- if (tpl->orientations[i]>=-CV_PI && (*(optr+addr[i]))>=-CV_PI) {
- sum_orientation += orientation_diff(tpl->orientations[i], (*(optr+addr[i])));
- cnt_orientation++;
- }
+ if(addr[i] < (orientation_img.cols*orientation_img.rows) - (offset.y*orientation_img.cols + offset.x)){
+ if (tpl->orientations[i]>=-CV_PI && (*(optr+addr[i]))>=-CV_PI) {
+ sum_orientation += orientation_diff(tpl->orientations[i], (*(optr+addr[i])));
+ cnt_orientation++;
}
}
+ }
- if (cnt_orientation>0) {
- cost = (float)(beta*cost+alpha*(sum_orientation/(2*CV_PI))/cnt_orientation);
- }
-
+ if (cnt_orientation>0) {
+ cost = (float)(beta*cost+alpha*(sum_orientation/(2*CV_PI))/cnt_orientation);
}
if(cost > 0){

@ -37,7 +37,9 @@ Patch4: opencv-2.4.7-cmake_paths.patch
# Fix macro usage of "list_filterout"
# https://github.com/pld-linux/opencv/commit/dadee4672641272b129410bc097f5c199bb4fb43
Patch5: opencv-2.4.11-listfilterout.patch
Patch6: Fix-FTBFS-with-GCC-6-1307821.patch
# fix build with gcc6
# https://github.com/Itseez/opencv/commit/eebd4cad665f4f1270ca58bb13e9708e130f9b30
Patch6: opencv-2.4.12.3-gcc6.patch
BuildRequires: libtool
BuildRequires: cmake >= 2.6.3
@ -274,8 +276,8 @@ popd
%{python2_sitearch}/cv2.so
%changelog
* Wed Mar 02 2016 Sérgio Basto <sergio@serjux.com> - 2.4.12.3-3
- Fix FTBFS with GCC 6 (#1307821), patch made by Yaakov Selkowitz.
* Tue Mar 01 2016 Yaakov Selkowitz <yselkowi@redhat.com> - 2.4.12.3-3
- Fix FTBFS with GCC 6 (#1307821)
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.12.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

Loading…
Cancel
Save