3

Does anyone have instructions for building the Point Cloud Library (PCL) for Android? I found a few superbuilds of PCL that claim to be able to build PCL and its dependencies. I tried the superbuild from http://www.hirotakaster.com/weblog/how-to-build-pcl-for-android-memo/. I'm using Ubuntu 14.10, Android 19, NDK r10d, and PCL 1.6.0, but I'm willing to use any versions. I'm also using the terminal for compiling. For Android hardware, I'm using a Project Tango.

I tried using android-cmake (http://code.google.com/p/android-cmake/), but I'm not sure how to build the proper toolchain. I continually receive the error "Could not find any working toolchain in the NDK. Probably your Android NDK is broken." I get this error with plain cmake and ccmake, too.

Does anyone have any detailed instructions for building PCL for Android (e.g., a bash script or terminal instructions)? Or, does anyone have a link to pre-built libraries?

quepas
  • 956
  • 1
  • 13
  • 30
marduk
  • 31
  • 1
  • 2

4 Answers4

5

(Caveat Emptor: This is not a long term solution)

I was able to get past the CMAKE error by editing the cmake file

pcl-superbuild/toolchains/toolchain-android.cmake 

These two changes should get past the errors mentioned above:

set( ANDROID_NDK_HOST_SYSTEM_NAME "linux-x86" ) # Line 468

Should be

set( ANDROID_NDK_HOST_SYSTEM_NAME "linux-x86_64" )

This will generate another error, unless you change the following line (Line 1023)

if( ANDROID_NDK_RELEASE STRGREATER "r8" ) # r8b

Should be

if( ANDROID_NDK_RELEASE STRGREATER "r10" ) # r8b

The first change adds _64 to x86_64. The second adds compatibility for r10d.

This doesn't fix all of the errors though, because BOOST threads don't place nicely with GCC 4.6+. Implement the patch shown at this link (https://svn.boost.org/trac/boost/ticket/6165).

Again, that still doesn't fix all of the errors. (I haven't figured out why this is needed yet, math.h shouldn't need std::). In the file,

pcl-superbuild/CMakeExternals/Source/pcl/common/include/pcl/pcl_macros.h

Edit lines 99-102:

# define pcl_isnan(x)    isnan(x)
# define pcl_isfinite(x) isfinite(x)
# define pcl_isinf(x)    isinf(x)

They should be:

# define pcl_isnan(x)    std::isnan(x)
# define pcl_isfinite(x) std::isfinite(x)
# define pcl_isinf(x)    std::isinf(x)

PCL still generates many warnings, but at least it compiles (so far)

**EDIT: **

This doesn't get you all the way (unfortunately) because the boost libraries don't play well with C++11.

To fix this, download boost 1.55 from http://sourceforge.net/projects/boost/files/boost/1.55.0/, and overwrite the boost directory

pcl-superbuild/CMakeExternals/Source/boost/boost_1_45_0

(This directory gets created when you run make for the first time).

Next, modify

pcl-superbuild/CMakeExternals/Source/boost/CMakeLists.txt

and find the line:

file(GLOB lib_srcs ${boost_root}/libs/filesystem/v2/src/*.cpp)

replace it with

file(GLOB lib_srcs ${boost_root}/libs/filesystem/src/*.cpp)

That's as far as I've gotten

watertavi
  • 81
  • 7
2

this link helps a lot, you can take a look. I also left some comments there..

http://www.hirotakaster.com/weblog/how-to-build-pcl-for-android-memo/

for compile pcl 1.6 with ndk r10d, you need to replace toolchain-android.cmake with the toolchain from opencv library

Izik
  • 43
  • 4
  • this link also useful: https://hcteq.wordpress.com/2014/07/14/compiling-pcl-for-android-in-windows-cmake-gui/ – Izik Nov 25 '15 at 01:39
0

I built PCL and its dependencies using Ubuntu 14.10, 32-bit. I also had to use NDK r8c, 32-bit. The key to building Hirotakaster's superbuild was using a 32-bit os.

marduk
  • 31
  • 1
  • 2
0

I managed to compile your super build with Ubuntu 15.10 64-bit and NDK r10e. I changed the toolchain-android.cmake with the one from OpenCV. Then in common.hpp(found in /Source/pcl/common/include/pcl/common/impl) I had to add the following lines:

# include < math.h >

# define pcl_isnan(x) std::isnan(x)

# define pcl_isfinite(x) std::isfinite(x)

# define pcl_isinf(x) std::isinf(x)

Ronald
  • 584
  • 4
  • 7