conan-center-index: [package] xmlsec/1.2.30: Android build failed

Package and Environment Details (include every applicable attribute)

  • Package Name/Version: xmlsec/1.2.30
  • Operating System+version: macOS Catalina (Android cross-build)
  • Compiler+version: clang 9
  • Conan version: conan 1.31.3
  • Python version: Python 3.7.4

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

[settings]
os_build=Macos
arch_build=x86_64

compiler=clang
compiler.version=9
compiler.libcxx=libc++

os=Android
os.api_level=21
arch=armv7
build_type=Release

[build_requires]
android_ndk_installer/r21d@bincrafters/stable
cmake_installer/3.15.5@conan/stable

Steps to reproduce (Include if Applicable)

Logs (Include/Attach if Applicable)

Click to expand log
ERROR: m4/1.4.18: Error in build() method, line 90
        autotools.make()
        ConanException: Error 2 while executing make -j12


In file included from ../source_subfolder/lib/freading.c:22:
../source_subfolder/lib/stdio-impl.h:72:22: error: field has incomplete type 'struct __sbuf'
      struct  __sbuf _ub; /* ungetc buffer */
                     ^
../source_subfolder/lib/stdio-impl.h:72:15: note: forward declaration of 'struct __sbuf'
      struct  __sbuf _ub; /* ungetc buffer */
              ^
../source_subfolder/lib/freading.c:41:16: error: no member named '_flags' in 'struct __sFILE'
  return (fp_->_flags & __SRD) != 0;
          ~~~  ^
../source_subfolder/lib/freading.c:41:25: error: use of undeclared identifier '__SRD'
  return (fp_->_flags & __SRD) != 0;
                        ^
3 errors generated.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (18 by maintainers)

Most upvoted comments

if the bincrafters/stable has not been changed since I looked at it the last time, I doubt you can use it with 2 profiles, since is uses os_build os_arch

this one https://github.com/conan-io/conan-center-index/pull/3004 works.

I would not waste time to the old approach with os_build and os_arch since the 2 profile way of handing xcompile is more natural and better, and you do not run into problems that build requirements wants to be build in debug modes, and sich things…

here an example how some of the profiles I use look like, in the 2 profile way, for an OSX to Android Armv8 build

Configuration (profile_host):
[settings]
arch=armv8
build_type=Release
compiler=clang
compiler.libcxx=libc++
compiler.version=9
os=Android
os.api_level=21
[options]
libcurl:with_ssl=openssl
lua:compile_as_cpp=True
ms-gsl:on_contract_violation=throw
nlohmann_json:multiple_headers=True
paho-mqtt-c:asynchronous=True
paho-mqtt-c:shared=False
paho-mqtt-c:ssl=True
paho-mqtt-cpp:ssl=True
[build_requires]
*: android-ndk/r21d
[env]

Configuration (profile_build):
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=12.0
os=Macos
os_build=Macos
[options]
[build_requires]
[env]

Hi! Using the two profiles approach is the way to go and Conan will deprecate os_build arch_build settings in Conan v2 (we cannot do it before). The android-ndk recipe in bincrafters will stop to work as it is implemented now. There are other efforts you can have a look to, like https://github.com/conan-io/conan-center-index/pull/3004 by @a4z (I haven’t had time to have a look at it, and I should 😞 , but time constraints…).

In Conan we are also working in a new paradigm to supersede some limitations of the current build. We are working on toolchains (experimental yet) and if we manage to provide everything we want, it will be the default way (and only way) in Conan 2.0. Not ready yet.

@dmn-star the profiles shared by @madebr should work using a new implementation of the android-ndk recipe (the one in the PR I shared with you before or here you can find a POC by myself). It is important to realize that you need to choose between old approach (one profile and os/arch_build settings) or the new approach (two profiles), they are not going to play well together. Choose one and use it.

In your latest log you are using two profiles, but there is something wrong:

  • your host profile, it says the binaries you are generating, this one looks like ok:

    Configuration (profile_host):
    [settings]
    arch=armv8
    build_type=Release
    compiler=clang
    compiler.libcxx=libc++
    compiler.version=9
    os=Android
    os.api_level=21
    [options]
    [build_requires]
    [env]
    
  • but your build profile is wrong. The build profile tell Conan the binaries to use in the build-machine, the binaries that are going to run where you are compiling your sources, these are typically Win/Linux/Macos binaries.

    Configuration (profile_build):
    [settings]
    arch=x86_64
    os=Macos
    [options]
    [build_requires]
    *: android_ndk_installer/r21d@bincrafters/stable, cmake/3.19.0, m4/1.4.18, autoconf/2.69, automake/1.16.2, ninja/1.10.1
    [env]
    

    The [settings] section is right, you are using Macos/x86_64, but you are telling Conan to generate these binaries using android_ndk_installer… are you going to generate binaries for Macos using Android-NDK? I don’t think so.

You should use the profiles suggested by @madebr (https://github.com/conan-io/conan-center-index/issues/3627#issuecomment-731198329), the build-requires to android-ndk appears in the host profile, you are telling Conan to build the binaries for your host architecture (Android) using Android-NDK. 👍

Keep in mind:

  • build_requires tells Conan the tools to use to generate the binaries that match that profile.
  • host profile: describes the binaries to be generated, the library/project you want to build.
    • if this profile contains any build_requires, these packages listed under [build_requires] will be built (only if needed) using the settings in the build-profile because the are to be run in the build-machine.
  • build profile: describes the binaries you will be using to generate the packages in the host profile.
    • if this profile contains any build_requires, these packages listed here will only be retrieved if Conan needs to build some of the packages in the build-context (packages that are build-requires of your library).

image

I think I’m not explaining myself well enough 😓 Feel free to blame me and I’ll try to explain it better.

The error is because the xmlsec configure script does not detect libxml2 using pkg-config. It just uses -lxml2. Try removing the line self._autotools.libs = [].

build profile (save as e.g. build_profile)

[settings]
os=Linux
arch=x86_64
compiler=gcc
compiler.version=9
compiler.libcxx=libstdc++11
build_type=Release
[options]
[build_requires]

host profile (save as android_profile):

[settings]
compiler=clang
compiler.version=9
compiler.libcxx=libc++

os=Android
os.api_level=21
arch=armv7
build_type=Release

[build_requires]
android_ndk_installer/r21d@bincrafters/stable
cmake/3.19.0

And build using (untested):

`conan create . xmlsec/1.2.30@ -pr:h ./android_profile -pr:b ./build_profile