Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add build_triplet on conf #15965

Merged

Conversation

ErniGH
Copy link
Contributor

@ErniGH ErniGH commented Mar 27, 2024

Changelog: Feature: Add tools.gnu:build_triplet to conf.
Docs: Omit

Close: #14962

@ErniGH ErniGH added this to the 2.3.0 milestone Mar 27, 2024
@ErniGH ErniGH requested a review from juansblanco March 27, 2024 14:12
Copy link
Contributor

@juansblanco juansblanco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Copy link
Contributor

@jcar87 jcar87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@franramirez688 franramirez688 merged commit e5994f9 into conan-io:develop2 Mar 27, 2024
2 checks passed
@jcar87
Copy link
Contributor

jcar87 commented Mar 27, 2024

For context:
for #14962 and #14947

From the documentation:
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/html_node/Specifying-Target-Triplets.html#Specifying-Names

  • When os and arch are both the same - Conan does not pass neither --host nor --build in Autotools toolchain
  • When cross building (os/arch are different for build and host), Conan will autoguess some values for both --host and --build, but these are based on the most "default" cases and may not cover specifics. I can't think of a specific where one may only one to override the guessed build triple - so long as it differs from the host one, autotools will be in cross-compilation mode anyway - but it's good to give the option in case Conan's guess is not the most accurate.
  • There can be cases where we have "incompatible" Linux flavour were os and arch are the same. This could be modelled by a separate setting (e.g. a subsetting in os) or not modelled at all (not recommended!).

@franramirez688, for the third case - I think there may be a case for replicating what we did in https://github.com/conan-io/conan/pull/15616/files here - in case anyone wants to "force" autotools into cross-building mode (this is telling autotools: do not try to run the executables you are building for the host platform) - that is, force Conan to pass --build and --host even when os and arch are the same. It would be around this line https://github.com/ErniGH/conan/blob/35b9792a257c5b4701038d6600ea9fb66d39bc4d/conan/tools/gnu/autotoolstoolchain.py#L71

Arguably the same goes for CMake - CMake assumes cross-compilation (or at least, CMAKE_CROSSCOMPILING evaluates to true) when CMAKE_SYSTEM_NAME is manually defined. We already have this as a conf, so technically it's already possible without touching recipes - but we may want to listen to tools.build.cross_building:cross_build and "force" it as well (I saw a case recently in an issue :D ) Just a thought!

@franramirez688
Copy link
Contributor

@franramirez688, for the third case - I think there may be a case for replicating what we did in https://github.com/conan-io/conan/pull/15616/files here - in case anyone wants to "force" autotools into cross-building mode (this is telling autotools: do not try to run the executables you are building for the host platform) - that is, force Conan to pass --build and --host even when os and arch are the same. It would be around this line https://github.com/ErniGH/conan/blob/35b9792a257c5b4701038d6600ea9fb66d39bc4d/conan/tools/gnu/autotoolstoolchain.py#L71

@jcar87 I don't understand this comment correctly. That PR introduced a new conf in the conan.tools.build.cross_building function, i.e., available for all the toolchains, so they could use it right now. Did you mean to perform new tests using that conf through those toolchains?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature] Add tools.gnu:build_triplet to conf
4 participants