Compiling PCL for android
来源:互联网 发布:淘宝的所在地怎么修改 编辑:程序博客网 时间:2024/06/05 17: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.
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.
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):
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/
- Compiling PCL for android
- Compiling PCL 1.6 for android
- Compiling Android for MIPS
- about compiling python for android
- Compiling DCMTK for Android(中文版)
- Compiling the Android source code for ARMv4T
- cross compiling in Linux for android(arm_linux) platform
- Compiling Cairo for Windows
- Cross-compiling for ARM
- compiling ffmpeg for iFrameExtractor
- gcc compiling for debugging
- Compiling FreeType for iPhone
- cross-compiling for iPhone dev
- cross-compiling for iPhone dev
- Cross compiling Libx264 for ARM
- CMakelists.txt for compiling HDF5
- android kernel source code compiling
- Compiling GStreamer for Windows using MinGW
- Linux的远程连接
- mysql
- Spring并发访问的线程安全性问题(高度总结)
- N元语言模型
- Thrift 使用以及使用动态代理透明化调用
- Compiling PCL for android
- java中,什么是封装,继承,多态和抽象,好处与用法
- SpringMVC实现局部刷新DIV
- Android进阶之路
- Student management system
- 大数据集群机房事项:
- 今天进行了cvte的一面,感觉特糟糕,对自己五星差评,以下为总结
- java实现合并排序算法
- 排序二叉树查找