conan: [bug] Conan mixing up setting variables of profiles when doing cross compilation

I cross compile zlib from x86_64 to armv8 like this:

conan create cci/recipes/zlib/all 1.2.11@ -pr:h gcc-9.0-qemu-armv8-release-toolchain -pr:b gcc-9.0-linux-x86_x64-release

I have created a conan tool chain recipe, which I reference in my profile gcc-9.0-qemu-armv8-release-toolchain

However, when executing the create cmd. I get following output:

Cross-build from 'Linux:x86_64' to 'Linux:armv8'
Installing (downloading, building) binaries...
ERROR: There are invalid packages (packages that cannot exist for this configuration):
yocto-toolchain/1.0.0@company/stable: Invalid ID: os=Linux, distro=None is not supported by yocto-toolchain (no binaries are available)
yocto-toolchain/1.0.0@company/stable: Invalid ID: os=Linux, distro=None is not supported by yocto-toolchain (no binaries are available)

My toolchain recipe has a validate step:

def _settings_distro_supported(self):
        return self.conan_data["sources"][self.version]["os"][str(self.settings.os)].get(str(self.settings.os.distro)) is not None
def validate(self):
        if not self._settings_distro_supported():
            raise ConanInvalidConfiguration(f"os={self.settings.os}, distro={self.settings.os.distro} is not supported by {self.name} (no binaries are available)")

I created a new sub setting in settings.yml called distro. For unknown reason this setting is None during cross compilation, although it shouldn’t be.

See here my profiles used:

with following profiles: gcc-9.0-qemu-armv8-release

[settings]
os=Linux
os.distro=custom_distro ## here custom sub settings!!!
arch=armv8
compiler=gcc
compiler.version=9
compiler.libcxx=libstdc++11
build_type=Release
[options]
[build_requires]
[env]

gcc-9.0-qemu-armv8-release-toolchain

include(gcc-9.0-qemu-armv8-release)
[options]
yocto-toolchain:target=armv8
[tool_requires]
yocto-toolchain/1.0.0@company/stable

Build profile: gcc-9.0-linux-x86_x64-release

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

Remark here, I do not have the os.distro setting. Not needed IMHO.

So I think conan i using the gcc-9.0-mbient-armv8-release-toolchain with the settings.os from the build profile. Which is wrong, I think. Why is it done like this?

Environment Details (include every applicable attribute)

  • Operating System+version: ubuntu 18.04
  • Compiler+version: h:gcc9+armv8 b:gcc9+x86_64
  • Conan version:1.46.0
  • Python version:3.6.9

Conan log from profiles during build

Configuration (profile_host):
[settings]
arch=armv8
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=9
os=Linux
os.distro=custom_distro
[options]
yocto-toolchain:target=armv8
[build_requires]
*: yocto-toolchain/1.0.0@company/stable
[env]

Configuration (profile_build):
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=9
os=Linux
os_build=Linux
[options]
[build_requires]
[env]

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

I updated the test case, too simplify it more. Should now work also under windows I hope. And I renamed the profiles to host and build toolchain_test_case_update_2.zip