DEV Community

Nor
Nor

Posted on

How to compile PCL to android?

Just a guide, and a confirmation of:
using wsl2 on windows 11 can compile PCL to android, with the help of vcpkg.

export ANDROID_NDK_HOME=~/android-sdk/android-ndk-r25c

cd ~
[ ! -d "vcpkg" ] && git clone https://github.com/microsoft/vcpkg.git

cd ~/vcpkg
git checkout 2026.03.18
./bootstrap-vcpkg.sh

cd ~/vcpkg

# Remove the PCL build cache specifically
rm -rf buildtrees/pcl
rm -rf packages/pcl_arm64-android

# Optional: If you think the dependencies (Boost/Eigen) are also messed up:
rm -rf buildtrees/boost
rm -rf buildtrees/flann

# --recurse: Ensures that if a dependency (like Flann) needs an update due to the new vcpkg version, it gets updated too.
./vcpkg install pcl:arm64-android --recurse


rm -rf /root/vcpkg/buildtrees/pcl
VCPKG_MAX_CONCURRENCY=2 ./vcpkg install pcl:arm64-android --recurse --clean-after-build






fsutil.exe file setCaseSensitiveInfo "D:\usp\uhpsj\proj\pcl_android_wsp" enable

sudo cp -r /root/vcpkg/installed/arm64-android/* /mnt/d/usp/uhpsj/proj/pcl_android_wsp/


cd /root/vcpkg/installed/
sudo zip -r /mnt/d/usp/uhpsj/proj/pcl_android_sdk.zip arm64-android/


cd /root/vcpkg
sudo zip -r /mnt/d/usp/uhpsj/proj/vcpkg_scripts.zip scripts/

Enter fullscreen mode Exit fullscreen mode

The PCL version I got is:

root@Azih:~/vcpkg# ./vcpkg list arm64-android
boost-algorithm:arm64-android                     1.90.0#1            Boost algorithm module
boost-align:arm64-android                         1.90.0#1            Boost align module
boost-any:arm64-android                           1.90.0#1            Boost any module
boost-array:arm64-android                         1.90.0#1            Boost array module
boost-asio:arm64-android                          1.90.0#1            Boost asio module
boost-asio[deadline-timer]:arm64-android                              Build with deadline_timer support
boost-asio[spawn]:arm64-android                                       Build with spawn (stackful coroutines) support
boost-assert:arm64-android                        1.90.0#1            Boost assert module
...
boost-variant2:arm64-android                      1.90.0#1            Boost variant2 module
boost-variant:arm64-android                       1.90.0#1            Boost variant module
boost-winapi:arm64-android                        1.90.0#1            Boost winapi module
boost-xpressive:arm64-android                     1.90.0#1            Boost xpressive module
bzip2:arm64-android                               1.0.8#6             bzip2 is a freely available, patent free, high-q...
bzip2[tool]:arm64-android                                             Builds bzip2 executable
eigen3:arm64-android                              5.0.1               C++ template library for linear algebra: matrice...
flann:arm64-android                               2022-10-28          Fast Library for Approximate Nearest Neighbors
liblzma:arm64-android                             5.8.2#1             Compression library with an API similar to that ...
libpng:arm64-android                              1.6.55              libpng is a library implementing an interface fo...
lz4:arm64-android                                 1.10.0              Lossless compression algorithm, providing compre...
nanoflann:arm64-android                           1.9.0               nanoflann is a C++11 header-only library for bui...
pcl:arm64-android                                 1.15.1#1            Point Cloud Library (PCL) is open source library...
qhull:arm64-android                               8.0.2#6             computes the convex hull, Delaunay triangulation...
zlib:arm64-android                                1.3.1               A compression library
zstd:arm64-android                                1.5.7               Zstandard - Fast real-time compression algorithm
root@Azih:~/vcpkg#
Enter fullscreen mode Exit fullscreen mode

Note:

disclaimer: this answer received help from AI, and is tested to be working in my situation.

DEV.to markdown...

Top comments (0)