[cmake-developers] Bug with CMAKE_ASM_COMPILER and Android NDK

Robert Dailey rcdailey.lists at gmail.com
Fri Jun 23 15:19:40 EDT 2017


Oh I'm using CMake 3.9.0 RC3

On Fri, Jun 23, 2017 at 2:18 PM, Robert Dailey <rcdailey.lists at gmail.com> wrote:
> So I have two environment variables:
>
> ANDROID_NDK = E:\android\ndk
> ANDROID_NDK_72 = E:\android\ndk_72
>
> In my toolchain file, I do this:
>
>
>
> set( CMAKE_SYSTEM_NAME Android )
> set( CMAKE_SYSTEM_VERSION 15 ) # API level
> set( CMAKE_ANDROID_ARCH_ABI armeabi-v7a )
> set( CMAKE_ANDROID_STL_TYPE c++_shared )
> set( CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION clang )
>
> # ANDROID_NDK_72 represents a separate path to the NDK for 7.2 frontend
> # builds and later. This is to make it less painful to convert between
> # Crystax (7.1.x) and official NDK, which was restored in version 7.2.
> string(REGEX REPLACE "\\\\" "/" ndk_path "$ENV{ANDROID_NDK_72}")
> if( NOT EXISTS ${ndk_path} )
>     string(REGEX REPLACE "\\\\" "/" ndk_path "$ENV{ANDROID_NDK}")
> endif()
>
> set( CMAKE_ANDROID_NDK ${ndk_path} )
> unset(ndk_path)
>
>
>
> This works fine, until you do something like this in your CMake scripts:
>
>
> enable_language(ASM)
>
>
> CMake appears to find clang.exe in the wrong place (It's using
> ANDROID_NDK directly somehow instead of using the CMAKE_ANDROID_NDK I
> set from my toolchain file). Output from CMake is at the bottom of
> this email. The repository I'm configuring is here:
>
> https://github.com/Orphis/boost-cmake
>
> Logs:
>
>
> $ cmake .. -GNinja
> -DCMAKE_TOOLCHAIN_FILE="E:\code\_external\\android_armeabi-v7a.toolchain.cmake"
>     -DCMAKE_BUILD_TYPE=Release     -DCMAKE_INSTALL_PREFIX=_install
> -DBOOST_LOCALE_ENABLE_ICU_BACKEND=OFF
> -DBOOST_LOCALE_ENABLE_ICONV_BACKEND=OFF
> -- Android: Targeting API '15' with architecture 'arm', ABI
> 'armeabi-v7a', and processor 'armv7-a'
> -- Android: Selected Clang toolchain 'arm-linux-androideabi-clang'
> with GCC toolchain 'arm-linux-androideabi-4.9'
> -- The C compiler identification is Clang 5.0.300080
> -- The CXX compiler identification is Clang 5.0.300080
> -- Check for working C compiler:
> E:/android/ndk_72/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
> -- Check for working C compiler:
> E:/android/ndk_72/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
> -- works
> -- Detecting C compiler ABI info
> -- Detecting C compiler ABI info - done
> -- Detecting C compile features
> -- Detecting C compile features - done
> -- Check for working CXX compiler:
> E:/android/ndk_72/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe
> -- Check for working CXX compiler:
> E:/android/ndk_72/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe
> -- works
> -- Detecting CXX compiler ABI info
> -- Detecting CXX compiler ABI info - done
> -- Detecting CXX compile features
> -- Detecting CXX compile features - done
> -- Boost found: 1.63.0 E:/code/_external/boost-cmake/boost/boost_1_63_0
> -- Boost found: 1.63.0 E:/code/_external/boost-cmake/boost/boost_1_63_0
> -- Standalone mode detected
> -- Looking for __linux__
> -- Looking for __linux__ - found
> -- Looking for _WIN32
> -- Looking for _WIN32 - not found
> -- Looking for __APPLE__
> -- Looking for __APPLE__ - not found
> -- Looking for __ANDROID__
> -- Looking for __ANDROID__ - found
> -- Looking for __FreeBSD__
> -- Looking for __FreeBSD__ - not found
> -- The ASM compiler identification is unknown
> -- Found assembler:
> E:/android/ndk/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
> CMake Error at libs/context.cmake:34 (enable_language):
>   The CMAKE_ASM_COMPILER:
>
>     E:/android/ndk/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
>
>   is not a full path to an existing compiler tool.
>
>   Tell CMake where to find the compiler by setting either the environment
>   variable "ASM" or the CMake cache entry CMAKE_ASM_COMPILER to the full path
>   to the compiler, or to the compiler name if it is in the PATH.
> Call Stack (most recent call first):
>   CMakeLists.txt:63 (include)
>
>
> -- Warning: Did not find file Compiler/-ASM


More information about the cmake-developers mailing list