From d152e222a2b6718d4a08a3dc5741ea2f5ecf492b Mon Sep 17 00:00:00 2001 From: Martin Jansa Date: Fri, 17 May 2019 14:12:56 +0000 Subject: [PATCH] pcl: upgrade to 1.9.1 * resolves issues with newer CMake -- Performing Test HAVE_MM_MALLOC CMake Error: TRY_RUN() invoked in cross-compiling mode, please set the following cache variables appropriately: HAVE_MM_MALLOC_EXITCODE (advanced) HAVE_MM_MALLOC_EXITCODE__TRYRUN_OUTPUT (advanced) For details see pcl/1.8.0-r0/build/TryRunResults.cmake -- Performing Test HAVE_MM_MALLOC - Success * should resolve the issues with memory usage during the build: https://github.com/PointCloudLibrary/pcl/issues/2284#issuecomment-437584571 but it still triggers OOMK with -j8 on 32GB RAM builder, use at least -j4 to improve the build time a bit * use git fetcher for sources, github archives can be regenerated from time to time with different checksums: https://github.com/bmwcarit/meta-ros/issues/609 * 0001-make-the-pcl-library-compile-with-gcc6.patch is needed only with thud and older, with warrior it builds OK without this patch as well Signed-off-by: Martin Jansa --- ...-Dereference-shared_ptr-fix-for-GCC8.patch | 46 ------ ...ke-the-pcl-library-compile-with-gcc6.patch | 136 ++++++++++++++++++ .../recipes-extended/pcl/pcl_1.8.1.bb | 76 ---------- .../recipes-extended/pcl/pcl_git.bb | 46 ++++++ 4 files changed, 182 insertions(+), 122 deletions(-) delete mode 100644 meta-ros-common/recipes-extended/pcl/pcl/0001-Dereference-shared_ptr-fix-for-GCC8.patch create mode 100644 meta-ros-common/recipes-extended/pcl/pcl/0001-make-the-pcl-library-compile-with-gcc6.patch delete mode 100644 meta-ros-common/recipes-extended/pcl/pcl_1.8.1.bb create mode 100644 meta-ros-common/recipes-extended/pcl/pcl_git.bb diff --git a/meta-ros-common/recipes-extended/pcl/pcl/0001-Dereference-shared_ptr-fix-for-GCC8.patch b/meta-ros-common/recipes-extended/pcl/pcl/0001-Dereference-shared_ptr-fix-for-GCC8.patch deleted file mode 100644 index 78675f0784a..00000000000 --- a/meta-ros-common/recipes-extended/pcl/pcl/0001-Dereference-shared_ptr-fix-for-GCC8.patch +++ /dev/null @@ -1,46 +0,0 @@ -From a0b3ce9ca5c69a945695c1c83dab7937a3d99b83 Mon Sep 17 00:00:00 2001 -From: Jochen Sprickerhof -Date: Sat, 5 May 2018 23:58:13 +0200 -Subject: [PATCH] Dereference shared_ptr, fix for GCC8 - -Upstream-Status: Accepted [https://github.com/PointCloudLibrary/pcl/commit/a0b3ce9ca5c69a945695c1c83dab7937a3d99b83] - -This patch has been generated with: - `git format-patch -1 a0b3ce9ca5c69a945695c1c83dab7937a3d99b83` -in the pcl repository. - -Signed-off-by: Lukas Bulwahn ---- - segmentation/include/pcl/segmentation/ground_plane_comparator.h | 2 +- - segmentation/include/pcl/segmentation/plane_coefficient_comparator.h | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/segmentation/include/pcl/segmentation/ground_plane_comparator.h b/segmentation/include/pcl/segmentation/ground_plane_comparator.h -index e39354d..f96f38b 100644 ---- a/segmentation/include/pcl/segmentation/ground_plane_comparator.h -+++ b/segmentation/include/pcl/segmentation/ground_plane_comparator.h -@@ -147,7 +147,7 @@ namespace pcl - const std::vector& - getPlaneCoeffD () const - { -- return (plane_coeff_d_); -+ return (*plane_coeff_d_); - } - - /** \brief Set the tolerance in radians for difference in normal direction between neighboring points, to be considered part of the same plane. -diff --git a/segmentation/include/pcl/segmentation/plane_coefficient_comparator.h b/segmentation/include/pcl/segmentation/plane_coefficient_comparator.h -index 9c94813..a21725a 100644 ---- a/segmentation/include/pcl/segmentation/plane_coefficient_comparator.h -+++ b/segmentation/include/pcl/segmentation/plane_coefficient_comparator.h -@@ -141,7 +141,7 @@ namespace pcl - const std::vector& - getPlaneCoeffD () const - { -- return (plane_coeff_d_); -+ return (*plane_coeff_d_); - } - - /** \brief Set the tolerance in radians for difference in normal direction between neighboring points, to be considered part of the same plane. --- -2.7.4 - diff --git a/meta-ros-common/recipes-extended/pcl/pcl/0001-make-the-pcl-library-compile-with-gcc6.patch b/meta-ros-common/recipes-extended/pcl/pcl/0001-make-the-pcl-library-compile-with-gcc6.patch new file mode 100644 index 00000000000..cb1e38b2de4 --- /dev/null +++ b/meta-ros-common/recipes-extended/pcl/pcl/0001-make-the-pcl-library-compile-with-gcc6.patch @@ -0,0 +1,136 @@ +From 31f72094a309ef6845e5c6b0b989237b4b59973f Mon Sep 17 00:00:00 2001 +From: Lukas Bulwahn +Date: Tue, 27 Sep 2016 14:05:22 +0200 +Subject: [PATCH] make the pcl library compile with gcc6 + +With gcc6, compiling fails with `stdlib.h: No such file or directory`, +as including '-isystem /usr/include' breaks with gcc6, cf., +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129. + +As far as I can judge from the history, all uses of `SYSTEM` were +added to avoid to show warnings from external libraries or were +added without any further argumentation for the use of `SYSTEM` in +the commit message. The detailed inspection of the git history is shown +below. + +There are other better solutions to avoid to show warnings from +external libraries without modifying the SYSTEM default directories. +Hence, this commit replaces all occurrences of +`include_directory(SYSTEM ...)` with `include_directory(...)`. After +this change, the point cloud library compiles with gcc6 (in my setup). + +The inspection of the git history pointed the following relevant +git commits: + +In commit 636c49a6 [1], Eigen, FLANN, and MPI include directories +`are set as system to avoid warnings in those files`. The SYSTEM attribute +in the Eigen include directory remained until now; the other two occurrences +of the SYSTEM attribute have been dropped in commit 9003e42b [2] for FLANN +during work on `fixing the USE_ROS flag` without further explanation, +and in commit 582a1cff [3], which completely removed the whole MPI setup +in the CMakeLists.txt. + +The commit ef3e489b [4] `set[ted] Boost libraries as system libraries`, +probably with the same rationale as in commit 636c49a6, i.e., to avoid +warnings in those files. + +The commit 55deacd7 [5] provided a generic cmake script for grabbers +based on already pre-existing patterns in the CMakeLists.txt file. + +[1] https://github.com/PointCloudLibrary/pcl/commit/636c49a6ffe7ec8c5409803b137b9d77081b9f9b +[2] https://github.com/PointCloudLibrary/pcl/commit/9003e42b7f648cd94ed817473c566cc97517ae08 +[3] https://github.com/PointCloudLibrary/pcl/commit/582a1cffd5f074135937bfdaeab01b4e6048ce32 +[4] https://github.com/PointCloudLibrary/pcl/commit/ef3e489ba7ef6fe3ef0319b15f5dc4b64b21ea32 +[5] https://github.com/PointCloudLibrary/pcl/commit/55deacd7b1bb3cc63ad19bef971b97f0777864d6 + +Signed-off-by: Lukas Bulwahn + +Upstream-Status: Inappropriate [openembedded specific] + +Signed-off-by: Lukas Bulwahn +--- + CMakeLists.txt | 2 +- + cmake/Modules/FindOpenNI.cmake | 2 +- + cmake/Modules/FindOpenNI2.cmake | 2 +- + cmake/pcl_find_boost.cmake | 2 +- + cmake/pcl_targets.cmake | 2 +- + test/CMakeLists.txt | 2 +- + 6 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0b4c1a33d..95e1d31e8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -277,7 +277,7 @@ endif() + + # Eigen (required) + find_package(Eigen REQUIRED) +-include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS}) ++include_directories(${EIGEN_INCLUDE_DIRS}) + + # FLANN (required) + if(NOT PCL_SHARED_LIBS OR ((WIN32 AND NOT MINGW) AND NOT PCL_BUILD_WITH_FLANN_DYNAMIC_LINKING_WIN32)) +diff --git a/cmake/Modules/FindOpenNI.cmake b/cmake/Modules/FindOpenNI.cmake +index 2c7b26eea..1e62c359b 100644 +--- a/cmake/Modules/FindOpenNI.cmake ++++ b/cmake/Modules/FindOpenNI.cmake +@@ -31,7 +31,7 @@ if(NOT WIN32) + message(STATUS "OpenNI disabled because libusb-1.0 not found.") + return() + else() +- include_directories(SYSTEM ${USB_10_INCLUDE_DIR}) ++ include_directories(${USB_10_INCLUDE_DIR}) + endif() + endif(NOT WIN32) + +diff --git a/cmake/Modules/FindOpenNI2.cmake b/cmake/Modules/FindOpenNI2.cmake +index 037a9a399..cc1855e0f 100644 +--- a/cmake/Modules/FindOpenNI2.cmake ++++ b/cmake/Modules/FindOpenNI2.cmake +@@ -31,7 +31,7 @@ if(NOT WIN32) + message(STATUS "OpenNI 2 disabled because libusb-1.0 not found.") + return() + else() +- include_directories(SYSTEM ${USB_10_INCLUDE_DIR}) ++ include_directories(${USB_10_INCLUDE_DIR}) + endif() + endif(NOT WIN32) + +diff --git a/cmake/pcl_find_boost.cmake b/cmake/pcl_find_boost.cmake +index 6489f3954..0c170116d 100644 +--- a/cmake/pcl_find_boost.cmake ++++ b/cmake/pcl_find_boost.cmake +@@ -49,6 +49,6 @@ if(Boost_FOUND) + # Obtain diagnostic information about Boost's automatic linking outputted + # during compilation time. + add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) +- include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) ++ include_directories(${Boost_INCLUDE_DIRS}) + link_directories(${Boost_LIBRARY_DIRS}) + endif(Boost_FOUND) +diff --git a/cmake/pcl_targets.cmake b/cmake/pcl_targets.cmake +index 30696346f..bede67ffa 100644 +--- a/cmake/pcl_targets.cmake ++++ b/cmake/pcl_targets.cmake +@@ -864,7 +864,7 @@ macro(PCL_ADD_GRABBER_DEPENDENCY _name _description) + message(STATUS "${_description}: not building because ${_name} not found") + else() + set(HAVE_${_name_capitalized} TRUE) +- include_directories(SYSTEM "${${_name_capitalized}_INCLUDE_DIRS}") ++ include_directories("${${_name_capitalized}_INCLUDE_DIRS}") + endif() + endif() + endmacro(PCL_ADD_GRABBER_DEPENDENCY) +diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt +index 6a1d55d96..543c279ef 100644 +--- a/test/CMakeLists.txt ++++ b/test/CMakeLists.txt +@@ -9,7 +9,7 @@ PCL_SUBSYS_DEPEND(build "${SUBSYS_NAME}" DEPS ${SUBSYS_DEPS} OPT_DEPS ${OPT_DEPS + if(build) + + find_package(Gtest REQUIRED) +- include_directories(SYSTEM ${GTEST_INCLUDE_DIRS} ${GTEST_SRC_DIR}) ++ include_directories(${GTEST_INCLUDE_DIRS} ${GTEST_SRC_DIR}) + + add_library(pcl_gtest STATIC ${GTEST_SRC_DIR}/src/gtest-all.cc) + diff --git a/meta-ros-common/recipes-extended/pcl/pcl_1.8.1.bb b/meta-ros-common/recipes-extended/pcl/pcl_1.8.1.bb deleted file mode 100644 index d646feea4a9..00000000000 --- a/meta-ros-common/recipes-extended/pcl/pcl_1.8.1.bb +++ /dev/null @@ -1,76 +0,0 @@ -DESCRIPTION = "The Point Cloud Library (or PCL) for point cloud processing." -SECTION = "devel" -LICENSE = "BSD" -LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=5b8a2a1aa14e6de44b4273134946a34c" - -DEPENDS = "boost libflann libeigen qhull" - -SRCREV = "39732f5a7c8455ed51fd0f6278d8b25322a68dd9" -# pcl-1.8.1 tag isn't in any branch -ROS_BRANCH ?= "nobranch=1" -SRC_URI = "git://github.com/PointCloudLibrary/pcl;${ROS_BRANCH};protocol=https" - -S = "${WORKDIR}/git" - -SRC_URI += "file://0001-Dereference-shared_ptr-fix-for-GCC8.patch" - -EXTRA_OECMAKE += "\ - -DCMAKE_SKIP_RPATH=ON \ - -DHAVE_MM_MALLOC_EXITCODE=0 -DHAVE_MM_MALLOC_EXITCODE__TRYRUN_OUTPUT=0 \ - -DHAVE_POSIX_MEMALIGN_EXITCODE=0 -DHAVE_POSIX_MEMALIGN_EXITCODE__TRYRUN_OUTPUT=0 \ - ${@bb.utils.contains("TARGET_CC_ARCH", "-msse4.2", "-DHAVE_SSE4_2_EXTENSIONS_EXITCODE=0 -DHAVE_SSE4_2_EXTENSIONS_EXITCODE__TRYRUN_OUTPUT=0", "-DHAVE_SSE4_2_EXTENSIONS_EXITCODE=1 -DHAVE_SSE4_2_EXTENSIONS_EXITCODE__TRYRUN_OUTPUT=1", d)} \ - ${@bb.utils.contains("TARGET_CC_ARCH", "-msse4.1", "-DHAVE_SSE4_1_EXTENSIONS_EXITCODE=0 -DHAVE_SSE4_1_EXTENSIONS_EXITCODE__TRYRUN_OUTPUT=0", "-DHAVE_SSE4_1_EXTENSIONS_EXITCODE=1 -DHAVE_SSE4_1_EXTENSIONS_EXITCODE__TRYRUN_OUTPUT=1", d)} \ - -DHAVE_SSSE3_EXTENSIONS_EXITCODE=0 -DHAVE_SSSE3_EXTENSIONS_EXITCODE__TRYRUN_OUTPUT=0 \ - ${@bb.utils.contains("TARGET_CC_ARCH", "-msse3", "-DHAVE_SSE3_EXTENSIONS_EXITCODE=0 -DHAVE_SSE3_EXTENSIONS_EXITCODE__TRYRUN_OUTPUT=0", "-DHAVE_SSE3_EXTENSIONS_EXITCODE=1 -DHAVE_SSE3_EXTENSIONS_EXITCODE__TRYRUN_OUTPUT=1", d)} \ - ${@bb.utils.contains("TARGET_CC_ARCH", "-msse2", "-DHAVE_SSE2_EXTENSIONS_EXITCODE=0 -DHAVE_SSE2_EXTENSIONS_EXITCODE__TRYRUN_OUTPUT=0", "-DHAVE_SSE2_EXTENSIONS_EXITCODE=1 -DHAVE_SSE2_EXTENSIONS_EXITCODE__TRYRUN_OUTPUT=1", d)} \ - ${@bb.utils.contains("TARGET_CC_ARCH", "-msse", "-DHAVE_SSE_EXTENSIONS_EXITCODE=0 -DHAVE_SSE_EXTENSIONS_EXITCODE__TRYRUN_OUTPUT=0", "-DHAVE_SSE_EXTENSIONS_EXITCODE=1 -DHAVE_SSE_EXTENSIONS_EXITCODE__TRYRUN_OUTPUT=1", d)} \ - -DWITH_LIBUSB=FALSE \ - -DWITH_PNG=FALSE \ - -DWITH_QHULL=TRUE \ - -DWITH_CUDA=FALSE \ - -DWITH_QT=FALSE \ - -DWITH_VTK=FALSE \ - -DWITH_PCAP=FALSE \ - -DWITH_OPENGL=FALSE \ -" - -#Setting -ffloat-store to alleviate 32bit vs 64bit discrepancies on non-SSE platforms. -CXXFLAGS += "${@bb.utils.contains("TARGET_CC_ARCH", "-mfpmath=sse", "", "-ffloat-store", d)}" - -inherit cmake - -FILES_${PN}-dev += "${datadir}/${PN}-1.8/*.cmake" - -# The build is really memory hungry (at least with gcc8), even with just -j 8 it triggers OOMK on system with 32GB ram -# High memory needs mentioned in: https://github.com/PointCloudLibrary/pcl/issues/2284 -# Setting just empty doesn't work, ninja will by default use number of cores available -# However, quick experiments have shown that it's possible to use up to CEIL(/5) as the argument to -j without running -# out of memory as long as the machine has a few GB of swap space. If this fails, override it by setting -# PARALLEL_MAKE_pn-pcl = "-j " in conf/local.conf . - -# Tried this, but psutil fails to import: -# inherit python3native -# DEPENDS += "python3-psutil-native" -# PARALLEL_MAKE = "-j ${@from psutil import virtual_memory; import math; int(math.ceil(virtual_memory().total / float(1024*1024*1024*5)))}" - -def pcl_parallel_make_n(): - import math - with open('/proc/meminfo', 'r') as f: - # First line of /proc/meminfo is: - # MemTotal: 65879500 kB - _, phys_mem_kb, _ = f.readline().split() - return int(math.ceil(float(phys_mem_kb)/float(1024*1024*5))) - -PARALLEL_MAKE = "-j ${@pcl_parallel_make_n()}" - - -# Fixes this: -# | fatal error: stdlib.h: No such file or directory -# | #include_next -do_configure_append() { - if [ -e ${B}/build.ninja ]; then - sed -i -e 's/-isystem /-I/g' ${B}/build.ninja - else - grep -rl -- '-isystem ' ${B} | xargs sed -i -e 's/-isystem /-I/g' - fi -} diff --git a/meta-ros-common/recipes-extended/pcl/pcl_git.bb b/meta-ros-common/recipes-extended/pcl/pcl_git.bb new file mode 100644 index 00000000000..0e2ace4613d --- /dev/null +++ b/meta-ros-common/recipes-extended/pcl/pcl_git.bb @@ -0,0 +1,46 @@ +DESCRIPTION = "The Point Cloud Library (or PCL) for point cloud processing." +SECTION = "devel" +LICENSE = "BSD" +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=5b8a2a1aa14e6de44b4273134946a34c" + +DEPENDS = "boost libflann libeigen qhull" + +PV = "1.9.1+git${SRCPV}" +SRCREV = "72f41b60a539cd1da67d1329b57222290122a0bb" +SRC_URI = "git://github.com/PointCloudLibrary/pcl.git \ + file://0001-make-the-pcl-library-compile-with-gcc6.patch \ +" + +S = "${WORKDIR}/git" + +EXTRA_OECMAKE += "\ + -DCMAKE_SKIP_RPATH=ON \ + -DHAVE_MM_MALLOC_EXITCODE=0 \ + -DHAVE_POSIX_MEMALIGN_EXITCODE=0 \ + ${@bb.utils.contains("TARGET_CC_ARCH", "-msse4.2", "-DHAVE_SSE4_2_EXTENSIONS_EXITCODE=0", "-DHAVE_SSE4_2_EXTENSIONS_EXITCODE=1", d)} \ + ${@bb.utils.contains("TARGET_CC_ARCH", "-msse4.1", "-DHAVE_SSE4_1_EXTENSIONS_EXITCODE=0", "-DHAVE_SSE4_1_EXTENSIONS_EXITCODE=1", d)} \ + -DHAVE_SSSE3_EXTENSIONS_EXITCODE=0 \ + ${@bb.utils.contains("TARGET_CC_ARCH", "-msse3", "-DHAVE_SSE3_EXTENSIONS_EXITCODE=0", "-DHAVE_SSE3_EXTENSIONS_EXITCODE=1", d)} \ + ${@bb.utils.contains("TARGET_CC_ARCH", "-msse2", "-DHAVE_SSE2_EXTENSIONS_EXITCODE=0", "-DHAVE_SSE2_EXTENSIONS_EXITCODE=1", d)} \ + ${@bb.utils.contains("TARGET_CC_ARCH", "-msse", "-DHAVE_SSE_EXTENSIONS_EXITCODE=0", "-DHAVE_SSE_EXTENSIONS_EXITCODE=1", d)} \ + -DWITH_LIBUSB=FALSE \ + -DWITH_PNG=FALSE \ + -DWITH_QHULL=TRUE \ + -DWITH_CUDA=FALSE \ + -DWITH_QT=FALSE \ + -DWITH_VTK=FALSE \ + -DWITH_PCAP=FALSE \ + -DWITH_OPENGL=FALSE \ +" + +#Setting -ffloat-store to alleviate 32bit vs 64bit discrepancies on non-SSE platforms. +CXXFLAGS += "${@bb.utils.contains("TARGET_CC_ARCH", "-mfpmath=sse", "", "-ffloat-store", d)}" + +inherit cmake + +FILES_${PN}-dev += "${datadir}/${PN}-1.9/*.cmake ${datadir}/${PN}-1.9/Modules/*.cmake" + +# The build is really memory hungry (at least with gcc8), even with just -j 8 it triggers OOMK on system with 32GB ram +# High memory needs mentioned in: https://github.com/PointCloudLibrary/pcl/issues/2284 +# Setting just empty doesn't work, ninja will by default use number of cores available +PARALLEL_MAKE = "-j4"