PointCloudLibrary / pcl

Point Cloud Library (PCL)
https://pointclouds.org/
Other
10.04k stars 4.62k forks source link

PCL cmake fails when cross-compiling for Android #6151

Open jackjansen opened 1 month ago

jackjansen commented 1 month ago

When cross-compiling for arm64-android (and possibly also for other platforms) the cmake phase fails. The problem is that pcl_find_sse.cmake uses check_cxx_source_runs() to determine whether HAVE_MM_MALLOC and HAVE_POSIX_MEMALIGN should be set.

But these obviously fail when cross-compiling.

Also, specifically for ARM64 and Android these defines aren't needed: the only preprocessor code that uses them has a branch specifically for android too (which has yet another aligned allocator). The simplest solution would be for the cmake code not to try and determine these preprocessor values when cross-compiling for Android (or possibly when cross-compiling for anything).

This issue was found while using vcpkg to build pcl, and also reported there, with the workaround to pre-set these variables in the cmake cache. But it would be a better solution if the issue was fixed here in pcl, obviously.

The vcpkg issue is here: https://github.com/microsoft/vcpkg/issues/41505

larshg commented 1 month ago

You can disable the check for SSE with -DPCL_ENABLE_SSE=FALSE - and similiar with AVX, if that fails too. Not sure if this "feature" is available in VCPKG though.

jackjansen commented 1 month ago

@larshg But then shouldn't PCL_ENABLE_SSE be set to false automatically when building for the arm64, which doesn't have an SSE instruction set? It seems like all of the code in pcl_find_sse.cmake is only for Intel processors....

larshg commented 1 month ago

It might only work on x86 platforms - i dont know the internal workings/support from cmake on this. But manually you can make it skip those test. You dont post any concrete error, so its difficult to guide on that - and unfortunately I havent had the need to compile on Arm/android, so I dont have any experience with it.