Hello,
I’m currently trying to manually cross compile VTK for the arm64-v8a android ABI but the compilation process fails to find backend librairies (OpenGL for rendering). I tried many VTK versions (v8.2.0, v9.0.0, v7.1.0, …) in combination with multiples NDK versions (16.1.4, 21.1.6) and API levels (21 → 29) installed via Android Studio, it still struggling with message like:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
OPENGL_egl_LIBRARY
linked by target "vtkRenderingOpenGL2" in directory /home/charles/libs/vtk/Rendering/OpenGL2
I found that OPENGL_egl_LIBRARY is a cache variable usually set by find_package(OpenGL) of CMake (CMake find OpenGL). I suppose that it should normally by resolved as “ndk-root-platform-root-dir/arch-arm64/usr/lib/libEGL.so” but it never found it despite setting manually this variable.
I also test to compile vtk library directly with the termux application of my phone (Armor 3W, Android 9.0) from my desktop with an ssh session. I installed required compilation tools and it fails with the same message, again librairies seems to be at the right place in the file system (/system/lib64/libEGL.so).
I also noticed that CMake seems to find OpenGL but maybe in the wrong place (OPENGL_INCLUDE_DIR=/usr/include in the cmake cache file instead of prebuild headers of NDK?).
The Makefile producing the above error was obtained by setting the CMake variables with VTK 8.2.0:
ANDROID_ARCH_ABI=arm64-v8a
ANDROID_NATIVE_API_LEVEL=21
ANDROID_NDK=path-to-ndk-root-dir/21.1.6352462
Can someone tell me where am i wrong ?
Also is it possible to cross compile VTK with standart cmake parameters for cross compilation for Android as it is described in Cross compile for android with the ndk. It works well with OpenCV for example.
Charles.