Hello.
I have a problem while building on windows to android according to this guide: https://docs.conan.io/en/latest/systems_cross_building/cross_building.html#cross-building-android
Here is the powershell command i execute and output:
PS C:\Users\u.zakreuskis\dev\sand\conan-zlib> conan create . conan/testing --profile=android_clang
zlib/1.2.11@conan/testing: Exporting package recipe
zlib/1.2.11@conan/testing export: Copied 1 '.txt' file: CMakeLists.txt
zlib/1.2.11@conan/testing: The stored package has not changed
zlib/1.2.11@conan/testing: WARN: Forced build from source
zlib/1.2.11@conan/testing (test package): Installing C:\Users\u.zakreuskis\dev\sand\conan-zlib\test_package\conanfile.py
Requirements
zlib/1.2.11@conan/testing from local cache - Cache
Packages
zlib/1.2.11@conan/testing:ac3074355f26454bf1bf625a82cddf2bc24f70e7 - Build
Cross-build from 'Windows:x86_64' to 'Android:armv7'
zlib/1.2.11@conan/testing: Building your package in C:\Users\u.zakreuskis\.conan\data\zlib\1.2.11\conan\testing\build\ac3074355f26454bf1bf625a82cddf2bc24f70e7
zlib/1.2.11@conan/testing: Copying sources to build folder
zlib/1.2.11@conan/testing: Generator cmake created conanbuildinfo.cmake
zlib/1.2.11@conan/testing: Calling build()
-- Android: Targeting API '21' with architecture 'arm', ABI 'armeabi-v7a', and processor 'armv7-a'
-- The C compiler identification is GNU 4.9.0
-- The CXX compiler identification is GNU 4.9.0
-- Check for working C compiler: C:/toolchains/arm_21_toolchain/bin/arm-linux-androideabi-gcc.exe
-- Check for working C compiler: C:/toolchains/arm_21_toolchain/bin/arm-linux-androideabi-gcc.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: C:/toolchains/arm_21_toolchain/bin/arm-linux-androideabi-g++.exe
-- Check for working CXX compiler: C:/toolchains/arm_21_toolchain/bin/arm-linux-androideabi-g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: called by CMake conan helper
CMake Error at conanbuildinfo.cmake:412 (message):
Incorrect 'clang', is not the one detected by CMake: 'GNU'
Call Stack (most recent call first):
conanbuildinfo.cmake:58 (conan_check_compiler)
CMakeLists.txt:8 (CONAN_BASIC_SETUP)
-- Configuring incomplete, errors occurred!
See also "C:/Users/u.zakreuskis/.conan/data/zlib/1.2.11/conan/testing/build/ac3074355f26454bf1bf625a82cddf2bc24f70e7/zlib-1.2.11/_build/CMakeFiles/CMakeOutput.log".
zlib/1.2.11@conan/testing:
zlib/1.2.11@conan/testing: ERROR: Package 'ac3074355f26454bf1bf625a82cddf2bc24f70e7' build failed
zlib/1.2.11@conan/testing: WARN: Build folder C:\Users\u.zakreuskis\.conan\data\zlib\1.2.11\conan\testing\build\ac3074355f26454bf1bf625a82cddf2bc24f70e7
ERROR: zlib/1.2.11@conan/testing: Error in build() method, line 71
cmake.configure(build_dir=".")
ConanException: Error 1 while executing cd . && cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_SYSTEM_NAME="Android" -DCMAKE_SYSTEM_VERSION="21" -DCONAN_CMAKE_FIND_ROOT_PATH="C:/toolchains/arm_21_toolchain/sysroot" -DCMAKE_SYSROOT="C:/toolchains/arm_21_toolchain/sysroot" -DCMAKE_ANDROID_ARCH_ABI="armeabi-v7a" -DCONAN_EXPORTED="1" -DCONAN_COMPILER="clang" -DCONAN_COMPILER_VERSION="6.0" -DBUILD_SHARED_LIBS="OFF" -DCMAKE_INSTALL_PREFIX="C:\Users\u.zakreuskis\.conan\data\zlib\1.2.11\conan\testing\package\ac3074355f26454bf1bf625a82cddf2bc24f70e7" -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY="ON" -Wno-dev C:\Users\u.zakreuskis\.conan\data\zlib\1.2.11\conan\testing\build\ac3074355f26454bf1bf625a82cddf2bc24f70e7
It seems like cmake is trying to build with gcc, but i use profile for clang. Here is the profile file:
standalone_toolchain=C:/toolchains/arm_21_toolchain
target_host=arm-linux-androideabi
cc_compiler=clang
cxx_compiler=clang++
[settings]
compiler=clang
compiler.version=6.0
compiler.libcxx=libc++
os=Android
os.api_level=21
arch=armv7
build_type=Release
[env]
CONAN_CMAKE_FIND_ROOT_PATH=$standalone_toolchain/sysroot
PATH=[$standalone_toolchain/bin]
CHOST=$target_host
AR=$target_host-ar
AS=$target_host-as
RANLIB=$target_host-ranlib
CC=$target_host-$cc_compiler
CXX=$target_host-$cxx_compiler
LD=$target_host-ld
STRIP=$target_host-strip
CFLAGS= -fPIE -fPIC -I$standalone_toolchain/include/c++/4.9.x
CXXFLAGS= -fPIE -fPIC -I$standalone_toolchain/include/c++/4.9.x
LDFLAGS= -pie
I have installed on my PC:
Conan version 1.6.1 (installed via pip)
cmake version 3.12.0
clang version 6.0.2
(MinGW.org GCC-6.3.0-1) 6.3.0
Also i tried to build boost according to this article:
https://blog.conan.io/2018/01/30/Cross-building-Boost-Android.html
and i see the same error.
I investigated similar issues like:
https://github.com/conan-io/conan/issues/199 https://github.com/conan-io/conan/issues/1211
but nothing helped.
Thank you for help.
Hi, sorry for the delay.
I don't know exactly what it happening but looks like CMake is doing some trick to choose a different compiler, probably doing some bad assumption. The fact is, I have no tried the Android clang support and especially in windows, but seeing CMake doing wrong things with the Android NDK is very common. Let me know if you have found any fix in this time.
I don't think this is about Android at all. Now i tried to build glew on Ubuntu 18.04 and i have the same error. The problem is that i can't build with Clang. CMake always wants to build with GCC.
Command and output on Ubuntu:
['conan', 'install', '..', '--build=missing', '-scompiler=clang', '-scompiler.version=6.0', '-scompiler.libcxx=libstdc++']
PROJECT: Installing /home/pc/dev/projects/testengine/conanfile.txt
Requirements
glew/2.1.0@bincrafters/stable from 'bincraftes' - Cache
glfw/3.2.1.20180327@bincrafters/stable from 'bincraftes' - Cache
Packages
glew/2.1.0@bincrafters/stable:c78b30f867758f14db30f570224a7f03bf7ddfab - Build
glfw/3.2.1.20180327@bincrafters/stable:c78b30f867758f14db30f570224a7f03bf7ddfab - Build
Downloading conan_sources.tgz
Package: libglu1-mesa-dev
Status: install ok installed
Priority: optional
Section: libdevel
Installed-Size: 945
Maintainer: Ubuntu Developers <[email protected]>
Architecture: amd64
Multi-Arch: same
Source: libglu
Version: 9.0.0-2.1build1
Replaces: libglu-dev
Provides: libglu-dev, xlibmesa-glu-dev
Depends: libglu1-mesa (= 9.0.0-2.1build1), libgl1-mesa-dev | libgl-dev
Conflicts: mesa-glide2-dev (<< 5.0.0-1), mesag-dev (<< 5.0.0-1), mesag3+ggi-dev (<< 5.0.0-1), xlibmesa-dev
Description: Mesa OpenGL utility library -- development files
Includes headers and static libraries for compiling programs with GLU.
.
For a complete description of GLU, please look at the libglu1-mesa
package.
Original-Maintainer: Debian X Strike Force <[email protected]>
Package already installed: libglu1-mesa-dev
glew/2.1.0@bincrafters/stable: Building your package in /home/pc/.conan/data/glew/2.1.0/bincrafters/stable/build/c78b30f867758f14db30f570224a7f03bf7ddfab
glew/2.1.0@bincrafters/stable: Configuring sources in /home/pc/.conan/data/glew/2.1.0/bincrafters/stable/source
glew/2.1.0@bincrafters/stable: Copying sources to build folder
glew/2.1.0@bincrafters/stable: Generator cmake created conanbuildinfo.cmake
glew/2.1.0@bincrafters/stable: Calling build()
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- 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: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: called by CMake conan helper
CMake Error at ../../../conanbuildinfo.cmake:411 (message):
Incorrect 'clang', is not the one detected by CMake: 'GNU'
Call Stack (most recent call first):
../../../conanbuildinfo.cmake:57 (conan_check_compiler)
CMakeLists.txt:11 (conan_basic_setup)
-- Configuring incomplete, errors occurred!
See also "/home/pc/.conan/data/glew/2.1.0/bincrafters/stable/build/c78b30f867758f14db30f570224a7f03bf7ddfab/CMakeFiles/CMakeOutput.log".
glew/2.1.0@bincrafters/stable:
glew/2.1.0@bincrafters/stable: ERROR: Package 'c78b30f867758f14db30f570224a7f03bf7ddfab' build failed
glew/2.1.0@bincrafters/stable: WARN: Build folder /home/pc/.conan/data/glew/2.1.0/bincrafters/stable/build/c78b30f867758f14db30f570224a7f03bf7ddfab
ERROR: glew/2.1.0@bincrafters/stable: Error in build() method, line 58
cmake.configure(source_dir="%s/build/cmake" % self.source_subfolder, defs={"BUILD_UTILS": "OFF"})
ConanException: Error 256 while executing cd '/home/pc/.conan/data/glew/2.1.0/bincrafters/stable/build/c78b30f867758f14db30f570224a7f03bf7ddfab' && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCONAN_EXPORTED="1" -DCONAN_COMPILER="clang" -DCONAN_COMPILER_VERSION="6.0" -DCONAN_CXX_FLAGS="-m64" -DCONAN_SHARED_LINKER_FLAGS="-m64" -DCONAN_C_FLAGS="-m64" -DBUILD_SHARED_LIBS="OFF" -DCMAKE_INSTALL_PREFIX="/home/pc/.conan/data/glew/2.1.0/bincrafters/stable/package/c78b30f867758f14db30f570224a7f03bf7ddfab" -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY="ON" -Wno-dev -DBUILD_UTILS="OFF" 'source_subfolder/build/cmake'
I had the same problem. I use:
OS: Windows 10
CMake: 3.13.1
Conan: 1.10.1
Android NDK: 18.1.5063045
There is no gcc in NDK 18 any more, and it seems that CMake doesn't know that because CMake looks for *-gcc.exe in the NDK folder.
I changed c:\Program Files\CMake\share\cmake-3.13\Modules\Platform\Android\Determine-Compiler-Standalone.cmake: before file(GLOB _gcc "${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/bin/*-gcc${_ANDROID_HOST_EXT}") (8th line) I inserted set(_ANDROID_HOST_EXT ".cmd").
@lasote i think this issue can be closed. I don't see it anymore using modern conan.
Thanks @VladasZ for following up!
Most helpful comment
I don't think this is about Android at all. Now i tried to build glew on Ubuntu 18.04 and i have the same error. The problem is that i can't build with Clang. CMake always wants to build with GCC.
Command and output on Ubuntu: