-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Fix subprojects logic in cross build scenarios #12822
Conversation
e78f5c5
to
464f9b3
Compare
028230b
to
c32fb7b
Compare
cc @dcbaker |
c1d8a8f
to
9762441
Compare
Tried this on a more comprehensive subproject (GLib) today, and found some issues. Will revise this PR as soon as I've got the rough edges sorted. Moving back to Draft state for now. |
fdac3a7
to
3fd9e08
Compare
This should now be ready for review. The CI failures look like the same as on latest master, so I've disregarded them for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry I didn't see this when Tristian pinged me in February, I get way too many GitHub notifications :(
First, does this allow a subproject to be built for both the host and build machine simultaneously? If not that's a full stop issue for me, I need both, I need that right now, and having an error subproject A configures for the build machine and then tries to also configure for the host machine is worse than the status quo, since it's race to see which one configures first. This comes up a lot with Rust because of proc-macros.
As an overall note, please stop using "native" and "cross", that terminology is confusing and not commonly used, and we're trying to move to "build machine" and "host machine" instead.
I'm going to need more time to look at this and think all of the potential corner cases involved
@@ -292,7 +309,7 @@ def __init__( | |||
self.processed_buildfiles: T.Set[str] = set() | |||
self.project_args_frozen = False | |||
self.global_args_frozen = False # implies self.project_args_frozen | |||
self.subprojects: T.Dict[str, SubprojectHolder] = {} | |||
self.subprojects: T.Dict[T.Tuple[str, MachineChoice], SubprojectHolder] = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have PerMachine
for storing things that are per-machine, we should use that here instead of storing it in the dict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Will make this change on my next iteration through, ran out of time this evening.
No worries! I know the feeling all too well 😅
Yes, that's my exact use-case.
Same!
I believe I retained that logic.
Ah yes, not happy about that. I was struggling to come up with a term to describe
Much appreciated! 🙏 |
To be used for the subproject per machine logic.
We need this information later to build both a build and a host subproject separately. It's a lot of boilerplate and has been split out to try to simplify review of the difficult pieces.
When a subproject is built for both machines, we need to ensure that the outputs don't clash. To do this we'll put the outputs of build only subprojects in a separate root folder (build.subprojects/). We need special methods for this. Currently, this patch changes nothing in the output, but as more boilerplate kind of code it's been split out.
3fd9e08
to
755b128
Compare
Where we cannot use the same subproject state for both machines. We may not even need to use a subproject for both machines, for example if the build machine has a dependency installed, and we only need to fall back to a subproject for the host machine. Fixes: mesonbuild#10947
755b128
to
eea60e5
Compare
Looks like there were some timeouts: https://github.com/mesonbuild/meson/actions/runs/8288958897/job/22684490962?pr=12822#step:4:1104. If you have access to linux, you might try running this test in your local environment, just in case. |
Where we cannot use the same subproject state for both machines. For example, the subproject built for
native: true
in such a case should not be cross-compiling. Files written to the build directory also should not clash.We may not even need to use a subproject for both machines, for example if the build machine has a dependency installed, and we only need to fall back to a subproject for the host machine. This was also not working previously.
Fixes: #10947