commit:     1130c2704ea51e88cad20d5c63fd18266ef27f68
Author:     Alexis Ballier <aballier <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 10 01:45:37 2017 +0000
Commit:     Alexis Ballier <aballier <AT> gentoo <DOT> org>
CommitDate: Mon Jul 10 09:10:35 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1130c270

dev-ros/amcl: fix build with gcc 7.

Package-Manager: Portage-2.3.6, Repoman-2.3.2

 dev-ros/amcl/amcl-1.14.0.ebuild |  4 +++-
 dev-ros/amcl/files/gcc7.patch   | 41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/dev-ros/amcl/amcl-1.14.0.ebuild b/dev-ros/amcl/amcl-1.14.0.ebuild
index aebe91d62a7..0e1fb5f0dbd 100644
--- a/dev-ros/amcl/amcl-1.14.0.ebuild
+++ b/dev-ros/amcl/amcl-1.14.0.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2016 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=5
@@ -26,3 +26,5 @@ RDEPEND="
 DEPEND="${RDEPEND}
        test? ( dev-ros/rostest[${PYTHON_USEDEP}] )
 "
+
+PATCHES=( "${FILESDIR}/gcc7.patch" )

diff --git a/dev-ros/amcl/files/gcc7.patch b/dev-ros/amcl/files/gcc7.patch
new file mode 100644
index 00000000000..12c19bbdd67
--- /dev/null
+++ b/dev-ros/amcl/files/gcc7.patch
@@ -0,0 +1,41 @@
+commit 65261a83e7269906f726f14d7e8cc30e5f9901f0
+Author: Dmitry Rozhkov <dmitry.rozh...@linux.intel.com>
+Date:   Fri Jun 16 14:50:52 2017 +0300
+
+    amcl: fix compilation with gcc v7
+    
+    When building amcl with recent enough gcc v7 compilation fails with
+    the error
+    
+    src/amcl/map/map_cspace.cpp: In function 'void enqueue(map_t*, unsigned 
int, unsigned int, unsigned int, unsigned int, std::priority_queue<CellData>&, 
CachedDistanceMap*, unsigned char*)':
+    src/amcl/map/map_cspace.cpp:98:34: error: call of overloaded 'abs(unsigned 
int)' is ambiguous
+       unsigned int di = abs(i - src_i);
+    
+    Use `int abs(int)` flavour of the abs() function.
+
+diff --git a/amcl/src/amcl/map/map_cspace.cpp 
b/amcl/src/amcl/map/map_cspace.cpp
+index 421f718..5b4cf9c 100644
+--- a/amcl/src/amcl/map/map_cspace.cpp
++++ b/amcl/src/amcl/map/map_cspace.cpp
+@@ -86,8 +86,8 @@ get_distance_map(double scale, double max_dist)
+   return cdm;
+ }
+ 
+-void enqueue(map_t* map, unsigned int i, unsigned int j, 
+-           unsigned int src_i, unsigned int src_j,
++void enqueue(map_t* map, int i, int j,
++           int src_i, int src_j,
+            std::priority_queue<CellData>& Q,
+            CachedDistanceMap* cdm,
+            unsigned char* marked)
+@@ -95,8 +95,8 @@ void enqueue(map_t* map, unsigned int i, unsigned int j,
+   if(marked[MAP_INDEX(map, i, j)])
+     return;
+ 
+-  unsigned int di = abs(i - src_i);
+-  unsigned int dj = abs(j - src_j);
++  int di = abs(i - src_i);
++  int dj = abs(j - src_j);
+   double distance = cdm->distances_[di][dj];
+ 
+   if(distance > cdm->cell_radius_)

Reply via email to