conan: [bug] during crossbuild, build requirements are buit for host profile instead of build profile

When cross building a package and rebuilding all its dependencies, all its dependencies, including build requirements, are built using the host profile. It should use the build profile for the build requirements.

Environment Details (include every applicable attribute)

  • Operating System+version: Fedora Linux 30
  • Compiler+version: gcc 9
  • Conan version: conan 1.28.1
  • Python version: 3.7.7

Steps to reproduce (Include if Applicable)

  • use autoconf recipe at https://github.com/conan-io/conan-center-index/pull/2617
  • host profile, default32:
    [settings]
    os=Linux
    arch=x86
    compiler=gcc
    compiler.version=9
    compiler.libcxx=libstdc++11
    build_type=Release
    [options]
    [build_requires]
    [env]
    CC=gcc
    CXX=g++
    CFLAGS=-m32
    CXXFLAGS=-m32
    LDFLAGS=-m32
    
  • build profile, default64:
    [settings]
    os=Linux
    arch=x86_64
    compiler=gcc
    compiler.version=9
    compiler.libcxx=libstdc++11
    build_type=Release
    [options]
    [build_requires]
    [env]
    CC=gcc
    CXX=g++
    CFLAGS=-m64
    CXXFLAGS=-m64
    LDFLAGS=-m64
    
  • cd conan-center-index/recipes/libcurl/all
  • Build everything: conan create . libcurl/7.71.1@ -pr:h default32 -pr:b default64 --build "*"

Logs (Executed commands with output) (Include/Attach if Applicable)

While rebuilding m4, the log contains:

m4/1.4.18: Calling:
 > source_subfolder/configure '--prefix=/home/maarten/.conan/data/m4/1.4.18/_/_/package/abd3ca9581f5ec3d6672fa2ee8818b1f09dbb082' '--bindir=${prefix}/bin' '--sbindir=${prefix}/bin' '--libexecdir=${prefix}/bin' '--libdir=${prefix}/lib' '--includedir=${prefix}/include' '--oldincludedir=${prefix}/include' '--datarootdir=${prefix}/share' --target=x86-linux-gnu

which means m4 is rebuilt for x86 (=host) instead of x86_64 (=build profile)

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 19 (11 by maintainers)

Most upvoted comments

@madebr Many thanks for digging into this!

So yes, libtool needs m4 as a build requirement.

I agree. But my understanding is that requirements are also available at the time of building, so there is no benefit to making something a build requirement if it is already a requirement. The only exception to this is if you need to change self.settings_target of that dependency, but I’m fuzzy on when that would be desired. Perhaps it is desired in this case?

You’ve proven this is not the fix, but I’m trying to solidify my understanding. 😃

@TedSmithNXC Looks like @madebr is on to something over at https://github.com/conan-io/conan-center-index/issues/6673#issuecomment-892579356.