From 7bbeb8bd694a1bc3f71484880f664325488816ae Mon Sep 17 00:00:00 2001 From: jolavillette Date: Mon, 17 Aug 2026 09:39:38 +0200 Subject: [PATCH] Android: tell libtiff where libm is tiff cmake/FindCMath.cmake probes pow(3) twice, first with no extra library then with the result of find_library(NAMES m). On Android pow is in libm, and the NDK keeps libm.so under the API level directory of the sysroot, sysroot/usr/lib///, which andro_cmake does not add to CMAKE_LIBRARY_PATH. find_library returns NOTFOUND, the second probe links exactly like the first one and both fail with ld.lld: error: undefined symbol: pow so configure aborts on Could NOT find CMath (missing: CMath_pow) taking build_cimg and build_phash down with it. Pass CMath_LIBRARY explicitly rather than adding the API level directory to the search path of every dependency, which would change how the other ten already working ones resolve their libraries. Co-Authored-By: Claude Opus 5 (1M context) --- misc/Android/prepare-toolchain-clang.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/misc/Android/prepare-toolchain-clang.sh b/misc/Android/prepare-toolchain-clang.sh index 43f2103de..9e3d0f559 100755 --- a/misc/Android/prepare-toolchain-clang.sh +++ b/misc/Android/prepare-toolchain-clang.sh @@ -749,11 +749,21 @@ build_tiff() pushd $B_dir #TODO: build dependecies to support more formats + # tiff cmake/FindCMath.cmake looks for pow(3) first without any library + # then with whatever find_library(NAMES m) returned. On Android pow lives + # in libm, and libm is under the API level directory of the NDK sysroot, + # which andro_cmake does not put in CMAKE_LIBRARY_PATH, so find_library + # comes back empty, the second check links without -lm just like the first + # one and configure aborts with + # Could NOT find CMath (missing: CMath_pow) + # Give it the library explicitly instead of widening the search path for + # every dependency. andro_cmake \ -DBUILD_SHARED_LIBS=OFF \ -Dlibdeflate=OFF -Djbig=OFF -Dlzma=OFF -Dzstd=OFF -Dwebp=OFF \ -Djpeg12=OFF \ -Dcxx=OFF \ + -DCMath_LIBRARY="${SYSROOT}/usr/lib/${compilerTriple}/${ANDROID_PLATFORM_VER}/libm.so" \ -B. -S../$S_dir || return $? make -j${HOST_NUM_CPU} || return $? make install || return $?