From c255bc3dc83d6d594c47602f35d4cc71315fb570 Mon Sep 17 00:00:00 2001 From: Dmitry Rozhkov Date: Mon, 26 Jun 2017 17:17:11 +0300 Subject: [PATCH] amcl: fix compilation with gcc7 Signed-off-by: Dmitry Rozhkov --- ...001-amcl-fix-compilation-with-gcc-v7.patch | 48 +++++++++++++++++++ recipes-ros/navigation/navigation.inc | 3 +- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 recipes-ros/navigation/files/0001-amcl-fix-compilation-with-gcc-v7.patch diff --git a/recipes-ros/navigation/files/0001-amcl-fix-compilation-with-gcc-v7.patch b/recipes-ros/navigation/files/0001-amcl-fix-compilation-with-gcc-v7.patch new file mode 100644 index 0000000..54c6768 --- /dev/null +++ b/recipes-ros/navigation/files/0001-amcl-fix-compilation-with-gcc-v7.patch @@ -0,0 +1,48 @@ +From bd789fc1fc201c3d180e9570af5065bd27e50338 Mon Sep 17 00:00:00 2001 +From: Dmitry Rozhkov +Date: Fri, 16 Jun 2017 14:50:52 +0300 +Subject: [PATCH] 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&, 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. + +Upstream-Status: Submitted [https://github.com/ros-planning/navigation/pull/587] +--- + amcl/src/amcl/map/map_cspace.cpp | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +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& 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_) +-- +2.9.3 + diff --git a/recipes-ros/navigation/navigation.inc b/recipes-ros/navigation/navigation.inc index d856f20..6a88f53 100644 --- a/recipes-ros/navigation/navigation.inc +++ b/recipes-ros/navigation/navigation.inc @@ -2,7 +2,8 @@ SRC_URI = "https://github.com/ros-planning/${ROS_SPN}/archive/${PV}.tar.gz;downl SRC_URI[md5sum] = "d7a392da183b3c2a5fce063e90cbf1f2" SRC_URI[sha256sum] = "169f89a4a3a94437ffbf80a9b06b65471c17529169d1940a217e92d85481f18f" -SRC_URI += "file://0001-address-gcc6-build-error.patch;patchdir=.." +SRC_URI += "file://0001-address-gcc6-build-error.patch;patchdir=.. \ + file://0001-amcl-fix-compilation-with-gcc-v7.patch;patchdir=.." S = "${WORKDIR}/${ROS_SP}/${ROS_BPN}"