Compiling PCL for android

转载 2017年03月11日 23:55:57

Compiling PCL for android (in windows, cmake-gui)

I have been struggling with this for days.

 

According to the several tries in http://www.pcl-users.org/, there is no ‘official’ guide or package to compile it for android environment. Here is PCL wiki describing how to compile, but I think it’s outdated.

On the other hand, there is a build script called ‘pcl-superbuild‘, thanks to Pat Marion. Unfortunately, it is outdated too. However, it has been greatly helpful to understand cross compiling  and what should I need to compile PCL for compiling android successfully.

Since there seems no guide for windows environment with cmake-gui, I wrote this in simple steps for my sake. I compiled in windows x86, using cmake-gui(2.8.12).

 

 

Step 1. Run configuration with cmake-gui

Once run cmake-gui and configure, it will show a pop-up window to specify the generator. Choose compiler as MinGW Makefiles and check Specify toolchain file for cross-compiling.

cmake-gui_1

For toolchain, choose toolchain-android.cmake in ./toolchains.

Step 2. Setting correct paths / filepaths

During the configuration, errors may occur. Make sure the paths/filepaths are correct. In my case, all I had to do was setting PYTHON_EXECUTABLE and GIT_EXECUTABLE.

Step 3. Setting build target

After serveral times of fixing errors and re-configuring, you would have entries below. I checked BUILD_ANDROID only.

cmake-gui_2

When all entries are clear, then the output log would be like this:

cmake-gui_3

OK. Generate.

Step 4. Compile and troubleshooting

After this, you may want to build it. Go to where the generated makefiles are located, and run make. In my case, I run powershell and did like this (I will not explain options here):

cmake-gui_4

From here, you may have several errors depends on your environment. I’ll list what I have faced and resolved. Some can be resolved before run make; some may not, as you should clone dependencies prior to fix it.

TROUBLESHOOTING 1. PROBLEM WITH ‘ISNAN‘ OR ‘ISFINITE’

If you have a problem with these, it might be a confliction between C99 and C++11 support. Edit ./build/CMakeCache.txt and set below flags will fix it. Here’s a refer.

 

TROUBLESHOOTING 2. INTERNAL COMPILER ERROR AT ‘NARF.CPP’ AND ‘NARF_KEYPOINT.CPP’

There are several reports regard on this problem that using powf function will cause the 4.7 gcc of the Android NDK to crash. One workaround is changing powf to std::pow.

 

TROUBLESHOOTING 3. PTHREAD RELATED PROBLEM ON COMPILING BOOST LIBRARY

If there is some kind of #error “Sorry, no boost threads are available for this platform.” occurs, that probably be the conflict between boost and gcc 4.7. An old version of boost (1.45) is used here and in header file, it has no idea to proceed changed macro.

Add a flag in ./build/CMakeExternals/Source/boost/boost_1_45_0/boost/config/stdlib/libstdcpp3.hpp :

 

TROUBLESHOOTING 4. CMAKE ERROR – UNKOWN ARGUMENTS SPECIFIED

Got similar cases here, but not sure why. A variable is not matched maybe? Apparently, it relates to gcc version (in my case, gcc 4.7). The error prints like:

if given arguments:
“arm-linux-androideabi-gcc.exe (GCC) 4.7
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software”

From my experience, there were two places where this error occurs; GenerateExportHeader.cmake and vtkCompilerExtras.cmake. Both are in vtk’s cmake directory. Change those files

in GenerateExportHeader.cmake:

in vtkCompilerExtras.cmake:

Running in android

Copy Boost/Flann/Eigen/PCL static libraries in ./build/CMakeExternals/Install. I created android application with sample JNI project in Pat Marion’s PCL repository. With a little bit of modification, I could get a result below (output was pcd, I converted to ply to see in MeshLab):

PCL Point Cloud

 

Just one more thing. I was able to run it smoothly by changing Application.mk a bit, such as:

APP_PLATFORM := gnustl_static    (stlport_static won’t work)

C_FLAGS := -fpermissive -rtti            (these may fix Boost problem)

 

That’s it. As a future work, I need to find out how to compile with recent PCL library (1.7.1 now) and make a demo running in android device.


https://hcteq.wordpress.com/2014/07/14/compiling-pcl-for-android-in-windows-cmake-gui/

【SLAM】之Point Cloud Library(PCL)简介与安装

PCL(Point Cloud Library)是在吸收了前人点云相关研究基础上建立起来的大型跨平台开源C++编程库,它实现了大量点云相关的通用算法和高效数据结构,涉及到点云获取、滤波、分割、配准、检...
  • littlethunder
  • littlethunder
  • 2016年07月14日 19:25
  • 8014

Compiling PCL 1.6 for android - patch

~/pcl-superbuild/build/CMakeExternals/Source/pcl$ git diff diff --git a/features/src/narf.cpp b/fea...
  • LongZh_CN
  • LongZh_CN
  • 2017年03月12日 00:00
  • 292

PCL的学习必要性、重要性、意义及最初——持续修改中

点云是无压缩三维位图。点云库是一个大规模,开放工程的2D,3D处理库。骨架包括......(更多信息请参考中文网站.....) 点云库是机器人学领域一个重要的基础库,定义了新的数据格式,并发展为成熟的...
  • wishchin
  • wishchin
  • 2013年07月25日 13:22
  • 1656

PCL点云库学习(1)

PCL概述
  • lewis_hacker
  • lewis_hacker
  • 2015年05月05日 16:42
  • 1158

PCL点云库(Point Cloud Library)介绍

PCL(Point Cloud Library)是在吸收了前人点云相关研究基础上建立起来的大型跨平台开源C++编程库,它实现了大量点云相关的通用算法和高效数据结构,涉及到点云获取、滤波、分割、配准、检...
  • tanmengwen
  • tanmengwen
  • 2013年01月27日 15:29
  • 3587

ubuntu 14.04 PCL 源码 编译 安装

啊~~~折腾了一中午,总算折腾完了,纪念一下,就当是记录博文的开始。 环境:Ubuntu 14.04LTS,全新的虚拟机,基本没有安装任何东西。(连G++都没安)   PCL 1.7.2 首先,...
  • qing101hua
  • qing101hua
  • 2016年12月07日 20:11
  • 1292

pcl-master的编译

PCL可以与CUDA和GPU结合使用。但包含CUDA和GPU的源码还不是很稳定,所以现有的所有release版本中都不含有CUDA和GPU模块。如果想使用含有CUDA和GPU模块的PCL版本,可以从点...
  • wangrongbuaa
  • wangrongbuaa
  • 2014年12月01日 19:57
  • 1654

Windows下PCL及其第三方库的安装编译过程

Windows下PCL及其第三方库的安装编译过程   PCL库介绍: Point Cloud Library (PCL)  是一个进行2D/3D图像处理和点云处理工程库。   ...
  • business122
  • business122
  • 2017年02月06日 09:13
  • 564

Compiling PCL for android

Compiling PCL for android (in windows, cmake-gui) JULY 14, 2014 INS7ITIA3 COMMENTS I hav...
  • LongZh_CN
  • LongZh_CN
  • 2017年03月11日 23:55
  • 739

Android NDK Tools 下载链接大全

NDK Download Links: ndk_r13b (Oct 2016) Windows 32-bit : https://dl.google.com/android/reposit...
  • xuezhisdc
  • xuezhisdc
  • 2017年03月03日 12:08
  • 956
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Compiling PCL for android
举报原因:
原因补充:

(最多只允许输入30个字)