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
[2/n] [xbuild] Add CLI arguments to support new crossbuilding model #5594
Conversation
I'm trying this pr out on the
Running
This can be fixed in the |
When configuring But when running So some way to access |
When I add a private require in requirements, it is not available in So let's say in requirements, we do With these first 3 remarks fixed, or worked around, I was able to build and package binutils. |
Hi! Thanks a lot for the feedback. The plan is to start with simple use-cases and add complexity step by step. But we have some a priori during this journey:
I'll have a look to the environment variables from the profiles that are available during
🤔 Maybe talk about this feature like cross-building is the worst naming we've ever done... |
About the environment variables defined in the profiles: right now this is the behavior: profile_host [env]
PROFILE=PROFILE_HOST profile_build [env]
PROFILE=PROFILE_BUILD app/conanfile.py (this recipe should be compiled using host_profile) def build(self):
# Check build_requires (build) are available
self.output.write(">>>> cmake | cmake_exe")
self.run("echo %PROFILE%")
self.run("cmake_exe.exe", run_environment=True) The output contains:
And I think it is correct, because in the context of the For your use case, @madebr , you should be using env vars |
I don't want to set it, but get it 😄 . Is that still possible?
Roger. I only used
Hehe, in true cross building we have build, host and target (2 steps). In this pr, you're only addressing build and host. So baby steps 😄
If I read correctly, only the environment of the host profile will be included. If I have to add |
Hi, there was a typo in my previous message, it should read: "you should NOT be using env vars CPP_FOR_BUILD and CC_FOR_BUILD" In this approach you would have a recipe for your cross-compiler: class MyCustomCompiler(ConanFile):
def package(self):
self.copy("gcc", dst="bin")
self.copy("cpp", dst="bin")
def package_info(self):
self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) And your library: class MyLib(Conanfile):
def build_requirements(self):
self.build_requires("mycustomcompiler/....")
def build(self):
self.run("gcc <all-my-things>", run_environment=True)
self.run("cpp <all-my-things>", run_environment=True) and run Before entering the
Right now, besides the environment that is being applied, recipes know nothing but the profile applied to them (which is the host_profile for themselves) so nothing realted to build-helpers or tools might need to be modified. Once we start thinking about cross-compiling, we need to provide the recipes with the target_machine profile in case they are cross-compilers, so build-helpers, tools take it into account to generated the triplets or populate the command line (but this is another episode) |
The configure script of
While cross building |
I think this is working quite well, I have been trying this, works pretty well, behavior seems a big improvement. |
Changelog: Feature: Add the needed command-line arguments to existing commands to provide information about host and build profiles.
Docs: conan-io/docs#1629
A quick getting started can be found here: conan-io/docs#1586
Close #5594
Close #5202
Close #5238
Close #5030
Close #5851
Close #6040
This PR adds the needed command-line arguments to existing commands to provide information about host and build profiles.
Command-line interface:
host
:h
or:host
suffixes to arguments:--profile:host
,-pr:h
,--env:host
,...:b
or:build suffixes
:--options:build
,-s:b
,...This PR should be complemented with #5592 and a minor change in the
get_graph_info
function to pass both profiles to the GraphInfo ctor.It also adds a helper class
ProfileData
(just anamedtuple
with a function) to gather the information for each context and avoid having so many arguments through the ConanAPI interface. This is against the commitment of accepting only raw arguments, but I think it is raw enough:with this tuple:
without it: