Several problems have been solved (with minimal change to existing source code) to make sure that PCL can be successfully build.
However, there is NO GUARANTEE that the built binaries will actually run on Android.
1.1 Add 32-bit support for your system
The pcl-superbuild script is old. It requires legacy toolchains which does not have a 64-bit binary release.
Newer Linux distros (e.g. Ubuntu 18.04) do not include 32-bit support by default, thus you have to enable it manually.
sudo dpkg --add-architecture i386 sudo apt update sudo apt install multiarch-support libc6:i386 libstdc++6:i386 zlib1g:i386
1.2 Download build tools
Building PCL requires Android NDK and cmake.
1.3 Build PCL
Run the pcl-superbuild script to build PCL.
mkdir build && cd build /path/to/cmake-220.127.116.11/bin/cmake -DBUILD_IOS_DEVICE:BOOL="OFF" ../ export ANDROID_NDK=/path/to/ndk-r8d make
Note that you will encounter errors when running this script. Read the following solutions.
1.4 Manually download dependencies
The script may complain about a file hash mismatch after downloading eigen. That is because our cmake does not have openssl support, and unfortunately, the download link is redirected to HTTPS.
The quickest way to solve this is to download manually using
wget, and run
wget http://www.vtk.org/files/support/eigen-3.1.0-alpha1.tar.gz -O /path/to/pcl-superbuild/build/CMakeExternals/Download/eigen/eigen-3.1.0-alpha1.tar.gz
1.5 Compile errors
- When compiling PCL, you will encounter GCC internal compiler error. The reason is not yet clear, but by replace
std::pow()will prevent this error.
- Before compiling VTK, you will encounter errors concerning its cmake script. Modify
_gcc_versionwill make it work.
- When compiling VTK, GCC will complain about
std::ostream&as argument of its overloaded operator
See this blog post for (1.) and (2.) patch details.
- In "build/CMakeExternals/Source/vtk/Common/Core/vtkOStreamWrapper.h":
vtkOStreamWrapper& operator << (ostream&);
- In "build/CMakeExternals/Source/vtk/Common/Core/vtkOStreamWrapper.cxx":
- In "build/CMakeExternals/Source/vtk/Rendering/Core/vtkGenericVertexAttributeMapping.cxx":
vtkWarningMacro("Replacing existsing mapping for attribute " << attributeName);
Now you may successfully compile PCL and its dependencies.