opengisch / OSGeo4A

OSGeo4A is a build environment to cross-compile opensource GIS software for android devices
MIT License
30 stars 22 forks source link

Unable to build with ndk r19b #41

Closed PeterPetrik closed 5 years ago

PeterPetrik commented 5 years ago

This change made a policy a bit more strict, so now host paths are ignored for finding QT modules: https://github.com/android-ndk/ndk/issues/890

workaround is to use r19 for now or set -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH \ in Qt-CMAKE based recipes

I think best solution would be to set CMAKE_FIND_ROOT_PATH to Android_NDK, Qt and OSGEO4A/build folders , but it has to be fixed upstream https://github.com/android-ndk/ndk/issues/919

part of offending ndk/android-toolchain.cmake

# https://github.com/android-ndk/ndk/issues/890
#
# ONLY doesn’t do anything when CMAKE_FIND_ROOT_PATH is not set. Without this,
# CMake will wrongly search host sysroots for headers/libraries. The actual path
# used here is fairly meaningless since CMake doesn’t handle the NDK sysroot
# layout (per-arch and per-verion subdirectories for libraries), so find_library
# is handled separately by CMAKE_SYSTEM_LIBRARY_PATH.
set(CMAKE_FIND_ROOT_PATH “${ANDROID_NDK}“)

# Allow users to override these values in case they want more strict behaviors.
# For example, they may want to prevent the NDK’s libz from being picked up so
# they can use their own.
# https://github.com/android-ndk/ndk/issues/517
if(NOT CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
endif()

if(NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
endif()

if(NOT CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
endif()

if(NOT CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
 set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
endif()
m-kuhn commented 5 years ago

Thanks for the heads up!

PeterPetrik commented 5 years ago

looks like they already fixed it for upcoming r19c (https://github.com/android-ndk/ndk/issues/912)