There is a bug with linking to vtkpng after compiling for arm64-v8a with Android NDK 18b. I’m linking against vtk-8.2.0 arm64-v8a with another project that uses NEON and has flags specifying that. The linking error is:
undefined reference to `png_init_filter_functions_neon'
I suggest looking at how OpenCV is handling their 3rd party lib png: requirements:
if(ENABLE_NEON)
list(APPEND lib_srcs arm/arm_init.c arm/filter_neon.S arm/filter_neon_intrinsics.c)
add_definitions(-DPNG_ARM_NEON_OPT=2)
elseif(AARCH64)
add_definitions(-DPNG_ARM_NEON_OPT=0) # NEON assembler is not supported
endif()
Not sure the VTK way to go about changing vtkpng to adopt some of these Android specific NEON changes. @ken-martin thoughts?
Just to get my problems sorted out I put add_definitions(-DPNG_ARM_NEON_OPT=0) at the top vtkpng/CMakeLists.txt. After doing that and recompiling VTK my linker error with the other project goes away.
We patch our PNG import to disable all optimization bits (our copies tend to be bare-bones and minimal for ease of porting the build system). We have ThirdParty/png/vtkpng/pngpriv.h:#define PNG_ARM_NEON_OPT 0. Is there a reason this isn’t working for you? It does work on our Android dashboard AFAICT: https://open.cdash.org/buildSummary.php?buildid=5996639
It’s also not a build problem, it builds just fine on my machine as well. It only presents itself when being linked against by another Android project.