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, 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.


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.


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


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):


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.


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.



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.



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 :



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 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.


Compiling PCL 1.6 for android - patch

~/pcl-superbuild/build/CMakeExternals/Source/pcl$ git diff diff --git a/features/src/narf.cpp b/fea...

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

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

Cross compiling wxDFB-2.8.11 for ARM-Linux

Without GUI, cross compilation of wxWidgets is pretty easy. However it does not provide wxImage. Wit...

cross-compiling for iPhone dev Update: Proof-of-concept d...
  • phiger
  • phiger
  • 2011年08月28日 15:33
  • 801

Cross Compiling Python for Embedded Linux

Cross Compiling Python for Embedded Linux Posted by Paul Gibson on 16 November 2011, 2:48 pm Th...
  • gxp
  • gxp
  • 2012年04月17日 09:54
  • 755

Cross-compiling for ARM

In order to do program in ARM board [9TDMI], I cross-compiled using the Linux 'C' compiler for ARM a...
  • wzwind
  • wzwind
  • 2011年08月08日 21:53
  • 721

compiling ffmpeg for iFrameExtractor

转自: ...

windows下成功编译Cairo,Compiling Cairo for Windows

Cairo is a cross-platform 2D graphics software library. It is designed to produce consistent output ...

How to Install Dev-C++ and the GLUT Libraries for Compiling OpenGL Programs with ANSI C

How to Install Dev-C++ and the GLUT Libraries for Compiling OpenGL Programs with ANSI C (versio...

compiling-tool android反编译工具

  • 2016年10月16日 16:51
  • 15.71MB
  • 下载
您举报文章:Compiling PCL for android