Skip to content

How to cross build md5 exsample for android? #93

Open
@zuowanbushiwo

Description

@zuowanbushiwo

After reading some documents ,I try cross-compile packages for Android platform: Using toolchain from Android NDK

I used my own /opt/toolchains/android-aarch64.cmake :

set(ANDROID_ABI arm64-v8a)
set(CMAKE_SIZEOF_VOID_P 8)

set(CMAKE_LIBRARY_ARCHITECTURE "aarch64-linux-android")
set(CMAKE_C_LIBRARY_ARCHITECTURE ${CMAKE_LIBRARY_ARCHITECTURE})
set(CMAKE_CXX_LIBRARY_ARCHITECTURE ${CMAKE_LIBRARY_ARCHITECTURE})

if(NOT DEFINED ANDROID_NDK)
    set(ANDROID_NDK "$ENV{ANDROID_NDK_ROOT}")
endif()
if(NOT DEFINED ANDROID_NATIVE_API_LEVEL)
    set(ANDROID_NATIVE_API_LEVEL $ENV{ANDROID_PLATFORM})
endif()
if(NOT DEFINED ANDROID_STL)
    set(ANDROID_STL "c++_shared")
endif()
if(NOT DEFINED ANDROID_LD)
    set(ANDROID_LD lld)
endif()

include(${ANDROID_NDK}/build/cmake/android.toolchain.cmake)

And wirte a conan profile local_android-ndk-arm64-v8a.txt :

[settings]
arch=armv8
build_type=Release
compiler=clang
compiler.libcxx=c++_static
compiler.version=11
os=Android
os.api_level=25
[build_requires]
[options]
[env]
CONAN_CMAKE_TOOLCHAIN_FILE=/opt/toolchains/android-aarch64.cmake

then
first mkdir build && cd build
second, conan install --profile:host local_android-ndk-arm64-v8a.txt --build outdated --profile:build default ..
the step it seems is successful ,as:
image

third: cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=/opt/toolchains/android-aarch64.cmake

this step have a  error output:
-- Conan: Adjusting output directories
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Current conanbuildinfo.cmake directory: /home/packager/examples/libraries/poco/md5/build
CMake Error at build/conanbuildinfo.cmake:1369 (message):
  Incorrect 'clang', is not the one detected by CMake: 'GNU'
Call Stack (most recent call first):
  build/conanbuildinfo.cmake:930 (conan_check_compiler)
  CMakeLists.txt:19 (conan_basic_setup)

Which step I did wrong?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions