Android: tell libtiff where libm is - #377
Open
jolavillette wants to merge 1 commit into
Open
Conversation
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/<triple>/<api>/, 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) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
build_tifffails at configure time, and takesbuild_cimgandbuild_phashdown with it:
tiff's
cmake/FindCMath.cmakeprobespow(3)twice — once with no extralibrary, then again with whatever
find_library(NAMES m)returned:On Android
powis in libm, and the NDK keepslibm.sounder the API leveldirectory of the sysroot —
sysroot/usr/lib/<triple>/<api>/— whichandro_cmakedoes not add toCMAKE_LIBRARY_PATH; it sets it to${PREFIX}/libonly. So
find_libraryreturns NOTFOUND,CMAKE_REQUIRED_LIBRARIESgainsnothing, the second probe links exactly like the first one, and both fail with
undefined symbol: pow. Note the two identicalLooking for pow - not foundlines in the output above: that pair is the signature of this bug.
Passing
CMath_LIBRARYexplicitly fixes it. The alternative — adding the APIlevel directory to the library search path in
andro_cmake— would change howthe ten dependencies that already build resolve their libraries, for one
consumer.
Verified
build_tiff,build_cimgandbuild_phashall return 0, and the whole AAR nowbuilds: 42 MB,
jni/arm64-v8a/libretroshare.soexportingJNI_OnLoad, the fourorg.retroshare.serviceclasses inclasses.jar. Ubuntu 24.04, NDK29.0.14206865, API level 24,arm64-v8a.