conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
960 stars 1.77k forks source link

[libtorrent] libtorrent/1.2.3: build fails on android #5666

Open chgans opened 3 years ago

chgans commented 3 years ago

Package and Environment Details (include every applicable attribute)

Conan profile (output of conan profile show default or conan profile show <profile> if custom profile is in use)

[settings]
os=Android
os_build=Linux
arch=armv8
arch_build=x86_64
compiler=clang
compiler.version=8
compiler.libcxx=libc++
build_type=Release
os.api_level=21
[options]
[build_requires]
[env]

Steps to reproduce (Include if Applicable)

cat conanfile.txt
conan@c832a96ac876:/home/chgans/Projects/neon/conan-get-started$ cat conanfile.txt
[requires]
libtorrent/1.2.3
conan@c832a96ac876:/home/chgans/Projects/neon/conan-get-started$ conan install . --build missing
Configuration:
[settings]
arch=armv8
arch_build=x86_64
build_type=Release
compiler=clang
compiler.libcxx=libc++
compiler.version=8
os=Android
os.api_level=21
os_build=Linux
[options]
[build_requires]
[env]

libtorrent/1.2.3: WARN: Package binary is corrupted, removing: d652447eaba38d5a6b88c1b761ceee79882b86ef
conanfile.txt: Installing package
Requirements
    boost/1.74.0 from 'conan-center' - Cache
    bzip2/1.0.8 from 'conan-center' - Cache
    libbacktrace/cci.20210118 from 'conan-center' - Cache
    libiconv/1.16 from 'conan-center' - Cache
    libtorrent/1.2.3 from 'conan-center' - Cache
    openssl/1.1.1h from 'conan-center' - Cache
    zlib/1.2.11 from 'conan-center' - Cache
Packages
    boost/1.74.0:ebdf529872c49ffde272ec44458e05230d7d4ec7 - Cache
    bzip2/1.0.8:d0202e15ed2bffe00fb2ab7504e436269af6ec9f - Cache
    libbacktrace/cci.20210118:3cc1debdebdc6ad0796bb6699c1ec121d98add89 - Cache
    libiconv/1.16:3cc1debdebdc6ad0796bb6699c1ec121d98add89 - Cache
    libtorrent/1.2.3:d652447eaba38d5a6b88c1b761ceee79882b86ef - Build
    openssl/1.1.1h:3cc1debdebdc6ad0796bb6699c1ec121d98add89 - Cache
    zlib/1.2.11:3cc1debdebdc6ad0796bb6699c1ec121d98add89 - Cache

Cross-build from 'Linux:x86_64' to 'Android:armv8'
Installing (downloading, building) binaries...
bzip2/1.0.8: Already installed!
bzip2/1.0.8: Appending PATH environment variable: /home/conan/.conan/data/bzip2/1.0.8/_/_/package/d0202e15ed2bffe00fb2ab7504e436269af6ec9f/bin
libbacktrace/cci.20210118: Already installed!
libiconv/1.16: Already installed!
libiconv/1.16: Appending PATH environment var: /home/conan/.conan/data/libiconv/1.16/_/_/package/3cc1debdebdc6ad0796bb6699c1ec121d98add89/bin
openssl/1.1.1h: Already installed!
zlib/1.2.11: Already installed!
boost/1.74.0: Already installed!
libtorrent/1.2.3: WARN: Build folder is dirty, removing it: /home/conan/.conan/data/libtorrent/1.2.3/_/_/build/d652447eaba38d5a6b88c1b761ceee79882b86ef
libtorrent/1.2.3: Copying sources to build folder
libtorrent/1.2.3: Building your package in /home/conan/.conan/data/libtorrent/1.2.3/_/_/build/d652447eaba38d5a6b88c1b761ceee79882b86ef
libtorrent/1.2.3: Generator cmake created conanbuildinfo.cmake
libtorrent/1.2.3: Calling build()
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: called by CMake conan helper
-- Conan: called inside local cache
-- Conan: Adjusting output directories
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Conan: Adjusting fPIC flag (ON)
-- Conan: Compiler Clang>=8, checking major version 8
-- Conan: Checking correct version: 8
-- Conan: C++ stdlib: libc++
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Compiler default is C++14
-- Building in C++14 mode
-- Found OpenSSL: /home/conan/.conan/data/openssl/1.1.1h/_/_/package/3cc1debdebdc6ad0796bb6699c1ec121d98add89/lib/libcrypto.a (found version "1.1.1h")  
-- Found Boost: /home/conan/.conan/data/boost/1.74.0/_/_/package/ebdf529872c49ffde272ec44458e05230d7d4ec7/include (found version "1.74.0")  
-- The following features have been enabled:

 * dht, enable support for Mainline DHT
 * deprecated-functions, enable deprecated functions for backwards compatibility
 * encryption, Enables encryption in libtorrent
 * exceptions, build with exception support
 * extensions, Enables protocol extensions
 * i2p, build with I2P support
 * logging, build with logging
 * mutable-torrents, Enables mutable torrent support

-- The following RECOMMENDED packages have been found:

 * OpenSSL, Full-strength general purpose cryptography library, <https://www.openssl.org/>
   Provides HTTPS support to libtorrent

-- The following REQUIRED packages have been found:

 * Threads
 * Boost

-- The following features have been disabled:

 * BUILD_SHARED_LIBS, build libtorrent as a shared library
 * static_runtime, build libtorrent with static runtime
 * build_tests, build tests
 * build_examples, build examples
 * build_tools, build tools
 * python-bindings, build python bindings

-- Configuring done
CMake Error at source_subfolder/cmake/Modules/GeneratePkgConfig.cmake:168 (file):
  Error evaluating generator expression:

    $<COMPILE_LANG_AND_ID:CUDA,NVIDIA>

  $<COMPILE_LANG_AND_ID:lang,id> may only be used with binary targets to
  specify include directories, compile definitions, and compile options.  It
  may not be used with the add_custom_command, add_custom_target, or
  file(GENERATE) commands.
Call Stack (most recent call first):
  source_subfolder/CMakeLists.txt:743 (generate_and_install_pkg_config_file)

CMake Error at source_subfolder/cmake/Modules/GeneratePkgConfig.cmake:168 (file):
  Error evaluating generator expression:

    $<COMPILE_LANG_AND_ID:CUDA,NVIDIA>

  $<COMPILE_LANG_AND_ID:lang,id> may only be used with binary targets to
  specify include directories, compile definitions, and compile options.  It
  may not be used with the add_custom_command, add_custom_target, or
  file(GENERATE) commands.
Call Stack (most recent call first):
  source_subfolder/CMakeLists.txt:743 (generate_and_install_pkg_config_file)

-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_EXPORT_NO_PACKAGE_REGISTRY

CMake Generate step failed.  Build files cannot be regenerated correctly.
libtorrent/1.2.3: 
libtorrent/1.2.3: ERROR: Package 'd652447eaba38d5a6b88c1b761ceee79882b86ef' build failed
libtorrent/1.2.3: WARN: Build folder /home/conan/.conan/data/libtorrent/1.2.3/_/_/build/d652447eaba38d5a6b88c1b761ceee79882b86ef
ERROR: libtorrent/1.2.3: Error in build() method, line 144
        cmake = self._configure_cmake()
while calling '_configure_cmake', line 112
        self._cmake.configure()
        ConanException: Error 1 while executing cd '/home/conan/.conan/data/libtorrent/1.2.3/_/_/build/d652447eaba38d5a6b88c1b761ceee79882b86ef' && /cmake-wrapper -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_TOOLCHAIN_FILE="/android-ndk-r19c/build/cmake/android.toolchain.cmake" -DCONAN_IN_LOCAL_CACHE="ON" -DCONAN_COMPILER="clang" -DCONAN_COMPILER_VERSION="8" -DCONAN_LIBCXX="libc++" -DBUILD_SHARED_LIBS="OFF" -DCMAKE_INSTALL_PREFIX="/home/conan/.conan/data/libtorrent/1.2.3/_/_/package/d652447eaba38d5a6b88c1b761ceee79882b86ef" -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_SBINDIR="bin" -DCMAKE_INSTALL_LIBEXECDIR="bin" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" -DCMAKE_INSTALL_OLDINCLUDEDIR="include" -DCMAKE_INSTALL_DATAROOTDIR="share" -DCONAN_CMAKE_POSITION_INDEPENDENT_CODE="ON" -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY="ON" -DCONAN_EXPORTED="1" -DBoost_USE_STATIC_LIBS="True" -Ddeprecated-functions="True" -Ddht="True" -Dencryption="True" -Dexceptions="True" -Di2p="True" -Dlogging="True" -Dmutable-torrents="True" -Dbuild_tests="False" -Dbuild_examples="False" -Dbuild_tools="False" -Dpython-bindings="False" -Wno-dev '/home/conan/.conan/data/libtorrent/1.2.3/_/_/build/d652447eaba38d5a6b88c1b761ceee79882b86ef'

SpaceIm commented 3 years ago

Use 2 profiles for cross compilation.

chgans commented 3 years ago

How? The documentation for building/using android is not clear at all. Any point out appreciated

chgans commented 3 years ago

Finally managed to use the host/build profiles trick with conan Android docker images. I can install and build quite a few packages, but libtorrent still fails with the same error:

conan@c832a96ac876:/home/chgans/Projects/neon/conan-get-started$ conan install . --build missing --profile:host=default --profile:build=build
Configuration (profile_host):
[settings]
arch=armv8
arch_build=x86_64
build_type=Release
compiler=clang
compiler.libcxx=libc++
compiler.version=8
os=Android
os.api_level=21
os_build=Linux
[options]
[build_requires]
[env]

Configuration (profile_build):
[settings]
arch=x86_64
compiler=clang
compiler.libcxx=libc++
compiler.version=8
os=Linux
[options]
[build_requires]
[env]

WARN: mosquitto/1.6.12: requirement openssl/1.1.1i overridden by your conanfile to openssl/1.1.1k 
WARN: libtorrent/1.2.3: requirement openssl/1.1.1h overridden by your conanfile to openssl/1.1.1k 
libtorrent/1.2.3: WARN: Package binary is corrupted, removing: 7534727942c11aa42712864ffff10e5649531758
conanfile.txt: Installing package
Requirements
    benchmark/1.5.3 from 'conan-center' - Cache
    boost/1.74.0 from 'conan-center' - Cache
    bzip2/1.0.8 from 'conan-center' - Cache
    gtest/1.10.0 from 'conan-center' - Cache
    libbacktrace/cci.20210118 from 'conan-center' - Cache
    libtorrent/1.2.3 from 'conan-center' - Cache
    libwebsockets/4.1.6 from 'conan-center' - Cache
    mosquitto/1.6.12 from 'conan-center' - Cache
    openssl/1.1.1k from 'conan-center' - Cache
    rapidjson/1.1.0 from 'conan-center' - Cache
    sqlite3/3.35.5 from 'conan-center' - Cache
    zlib/1.2.11 from 'conan-center' - Cache
Packages
    benchmark/1.5.3:72ab679033a329c0f68e6cd624d445c19d713dce - Cache
    boost/1.74.0:241bac5035abaca8665ab161855d2ca10c92fe33 - Cache
    bzip2/1.0.8:d0202e15ed2bffe00fb2ab7504e436269af6ec9f - Cache
    gtest/1.10.0:d4e378825634b788948e2da65fd48f826f0e9217 - Cache
    libbacktrace/cci.20210118:3cc1debdebdc6ad0796bb6699c1ec121d98add89 - Cache
    libtorrent/1.2.3:7534727942c11aa42712864ffff10e5649531758 - Build
    libwebsockets/4.1.6:da5b6e4c7d7b2dff06cea4cd5b1f712fdeee40f4 - Cache
    mosquitto/1.6.12:37548fe1a31a7359676bb8c906099a2ba8286b0e - Cache
    openssl/1.1.1k:3cc1debdebdc6ad0796bb6699c1ec121d98add89 - Cache
    rapidjson/1.1.0:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
    sqlite3/3.35.5:862f737f064c5b3ea0e1b3af1c034f9f46496926 - Cache
    zlib/1.2.11:3cc1debdebdc6ad0796bb6699c1ec121d98add89 - Cache

Cross-build from 'Linux:x86_64' to 'Android:armv8'
Installing (downloading, building) binaries...
benchmark/1.5.3: Already installed!
bzip2/1.0.8: Already installed!
bzip2/1.0.8: Appending PATH environment variable: /home/conan/.conan/data/bzip2/1.0.8/_/_/package/d0202e15ed2bffe00fb2ab7504e436269af6ec9f/bin
gtest/1.10.0: Already installed!
libbacktrace/cci.20210118: Already installed!
openssl/1.1.1k: Already installed!
rapidjson/1.1.0: Already installed!
sqlite3/3.35.5: Already installed!
sqlite3/3.35.5: Appending PATH env var with : /home/conan/.conan/data/sqlite3/3.35.5/_/_/package/862f737f064c5b3ea0e1b3af1c034f9f46496926/bin
zlib/1.2.11: Already installed!
boost/1.74.0: Already installed!
libwebsockets/4.1.6: Already installed!
libtorrent/1.2.3: WARN: Build folder is dirty, removing it: /home/conan/.conan/data/libtorrent/1.2.3/_/_/build/7534727942c11aa42712864ffff10e5649531758
libtorrent/1.2.3: Copying sources to build folder
libtorrent/1.2.3: Building your package in /home/conan/.conan/data/libtorrent/1.2.3/_/_/build/7534727942c11aa42712864ffff10e5649531758
libtorrent/1.2.3: Generator cmake created conanbuildinfo.cmake
libtorrent/1.2.3: Calling build()
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: called by CMake conan helper
-- Conan: called inside local cache
-- Conan: Adjusting output directories
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Conan: Adjusting fPIC flag (ON)
-- Conan: Compiler Clang>=8, checking major version 8
-- Conan: Checking correct version: 8
-- Conan: C++ stdlib: libc++
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Compiler default is C++14
-- Building in C++14 mode
-- Found OpenSSL: /home/conan/.conan/data/openssl/1.1.1k/_/_/package/3cc1debdebdc6ad0796bb6699c1ec121d98add89/lib/libcrypto.a (found version "1.1.1k")  
-- Found Boost: /home/conan/.conan/data/boost/1.74.0/_/_/package/241bac5035abaca8665ab161855d2ca10c92fe33/include (found version "1.74.0")  
-- The following features have been enabled:

 * dht, enable support for Mainline DHT
 * deprecated-functions, enable deprecated functions for backwards compatibility
 * encryption, Enables encryption in libtorrent
 * exceptions, build with exception support
 * extensions, Enables protocol extensions
 * i2p, build with I2P support
 * logging, build with logging
 * mutable-torrents, Enables mutable torrent support

-- The following RECOMMENDED packages have been found:

 * OpenSSL, Full-strength general purpose cryptography library, <https://www.openssl.org/>
   Provides HTTPS support to libtorrent

-- The following REQUIRED packages have been found:

 * Threads
 * Boost

-- The following features have been disabled:

 * BUILD_SHARED_LIBS, build libtorrent as a shared library
 * static_runtime, build libtorrent with static runtime
 * build_tests, build tests
 * build_examples, build examples
 * build_tools, build tools
 * python-bindings, build python bindings

-- Configuring done
CMake Error at source_subfolder/cmake/Modules/GeneratePkgConfig.cmake:168 (file):
  Error evaluating generator expression:

    $<COMPILE_LANG_AND_ID:CUDA,NVIDIA>

  $<COMPILE_LANG_AND_ID:lang,id> may only be used with binary targets to
  specify include directories, compile definitions, and compile options.  It
  may not be used with the add_custom_command, add_custom_target, or
  file(GENERATE) commands.
Call Stack (most recent call first):
  source_subfolder/CMakeLists.txt:743 (generate_and_install_pkg_config_file)

CMake Error at source_subfolder/cmake/Modules/GeneratePkgConfig.cmake:168 (file):
  Error evaluating generator expression:

    $<COMPILE_LANG_AND_ID:CUDA,NVIDIA>

  $<COMPILE_LANG_AND_ID:lang,id> may only be used with binary targets to
  specify include directories, compile definitions, and compile options.  It
  may not be used with the add_custom_command, add_custom_target, or
  file(GENERATE) commands.
Call Stack (most recent call first):
  source_subfolder/CMakeLists.txt:743 (generate_and_install_pkg_config_file)

-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_EXPORT_NO_PACKAGE_REGISTRY

CMake Generate step failed.  Build files cannot be regenerated correctly.
libtorrent/1.2.3: 
libtorrent/1.2.3: ERROR: Package '7534727942c11aa42712864ffff10e5649531758' build failed
libtorrent/1.2.3: WARN: Build folder /home/conan/.conan/data/libtorrent/1.2.3/_/_/build/7534727942c11aa42712864ffff10e5649531758
ERROR: libtorrent/1.2.3: Error in build() method, line 144
        cmake = self._configure_cmake()
while calling '_configure_cmake', line 112
        self._cmake.configure()
        ConanException: Error 1 while executing cd '/home/conan/.conan/data/libtorrent/1.2.3/_/_/build/7534727942c11aa42712864ffff10e5649531758' && /cmake-wrapper -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_TOOLCHAIN_FILE="/android-ndk-r19c/build/cmake/android.toolchain.cmake" -DCONAN_IN_LOCAL_CACHE="ON" -DCONAN_COMPILER="clang" -DCONAN_COMPILER_VERSION="8" -DCONAN_LIBCXX="libc++" -DBUILD_SHARED_LIBS="OFF" -DCMAKE_INSTALL_PREFIX="/home/conan/.conan/data/libtorrent/1.2.3/_/_/package/7534727942c11aa42712864ffff10e5649531758" -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_SBINDIR="bin" -DCMAKE_INSTALL_LIBEXECDIR="bin" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" -DCMAKE_INSTALL_OLDINCLUDEDIR="include" -DCMAKE_INSTALL_DATAROOTDIR="share" -DCONAN_CMAKE_POSITION_INDEPENDENT_CODE="ON" -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY="ON" -DCONAN_EXPORTED="1" -DBoost_USE_STATIC_LIBS="True" -Ddeprecated-functions="True" -Ddht="True" -Dencryption="True" -Dexceptions="True" -Di2p="True" -Dlogging="True" -Dmutable-torrents="True" -Dbuild_tests="False" -Dbuild_examples="False" -Dbuild_tools="False" -Dpython-bindings="False" -Wno-dev '/home/conan/.conan/data/libtorrent/1.2.3/_/_/build/7534727942c11aa42712864ffff10e5649531758'

It looks like a problem with cmake (version)

conan@c832a96ac876:/home/chgans/Projects/neon/conan-get-started$ cmake --version
cmake version 3.18.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).

That's the cmake that comes with the container

perseoGI commented 1 month ago

Hi @chgans, I was reviewing old issues and I have come across this one.

That docker image conanio/android-clang8-armv8 is deprecated nowadays. Have you tried to compile libtorrent recently using conan v2? Thank you!