Re: Bug in CMake for Android NDK tools

Cosmin Truta <[email protected]> Sun, 20 Jan 2019 23:03:06 -0500
Newsgroups gmane.comp.graphics.png.devel
Message-ID <CAAoVtZwXAgE3Xj50LPxdmurXy_8Px5TMzzuHb+wMqx=JydXs6A@mail.gmail.com>
I'm not familiar with Allegro, and from what I can see, it has a
custom CMake toolchain file (Toolchain-android.cmake).

libpng requires both the zlib library and the math library. Since you
are cross-compiling, you cannot use what you have in your Arch Linux
system.

A CMake cross-compilation toolchain file should allow CMake to find
both zlib and math, without requiring custom settings.
See "find_package(ZLIB REQUIRED)" and "find_library(M_LIBRARY m)"
inside libpng's CMakeLists.txt.

But I see that you are supplying a custom path to the zlib library via
-DZLIB_LIBRARY. If that is necessary, then you should probably do the
same for math, via -DM_LIBRARY.

I hope this helps.

Sincerely,
Cosmin

On Wed, 9 Jan 2019 at 01:00, Rm Beer <[email protected]> wrote:
>
> Main SO: Archlinux
> Android NDK: r19
> toolchain: API 21
>
> $ cmake -DCMAKE_TOOLCHAIN_FILE=${ALLEGRO5}/Allegro5/cmake/Toolchain-android.cmake
> -DANDROID_TARGET=android-15 -DARM_TARGETS=armeabi-v7a ..
> -DCMAKE_BUILD_TYPE=debug -DCMAKE_INSTALL_PREFIX=${ALLEGRO5}/libpng
> -DZLIB_LIBRARY=/opt/MV3/Android/android-toolchain-arm/user/armeabi-v7a/lib/libz.so
> -DZLIB_INCLUDE_DIR=/opt/MV3/Android/android-toolchain-arm/user/armeabi-v7a/include/
> -Wno-dev
>
> -- Selected Android NDK toolchain: /opt/MV3/Android/android-toolchain-arm
> -- Selected Android NDK toolchain: /opt/MV3/Android/android-toolchain-arm
> -- The C compiler identification is Clang 8.0.2
> -- The ASM compiler identification is Clang
> -- Found assembler:
> /opt/MV3/Android/android-toolchain-arm/bin/arm-linux-androideabi-clang
> -- Check for working C compiler:
> /opt/MV3/Android/android-toolchain-arm/bin/arm-linux-androideabi-clang
> -- Check for working C compiler:
> /opt/MV3/Android/android-toolchain-arm/bin/arm-linux-androideabi-clang
> -- works
> -- Detecting C compiler ABI info
> -- Detecting C compiler ABI info - done
> -- Detecting C compile features
> -- Detecting C compile features - done
> -- Found ZLIB: /opt/MV3/Android/android-toolchain-arm/user/armeabi-v7a/lib/libz.so
> (found version "1.2.11")
> -- Performing Test HAVE_LD_VERSION_SCRIPT
> -- Performing Test HAVE_LD_VERSION_SCRIPT - Success
> clang80: warning: argument unused during compilation: '-stdlib=libc++'
> [-Wunused-command-line-argument]
> -- Symbol prefix:
> 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:
> M_LIBRARY
>     linked by target "png_static" in directory ${ALLEGRO5}/libpng-1.6.36
>     linked by target "png-fix-itxt" in directory ${ALLEGRO5}/libpng-1.6.36
>     linked by target "png" in directory ${ALLEGRO5}/libpng-1.6.36
>
> -- Configuring incomplete, errors occurred!
> See also "${ALLEGRO5}/libpng-1.6.36/Build/CMakeFiles/CMakeOutput.log".
> See also "${ALLEGRO5}/libpng-1.6.36/Build/CMakeFiles/CMakeError.log".
>
>
> _______________________________________________
> png-mng-implement mailing list
> png-mng-implement-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/png-mng-implement