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

RFC: Proposal to rework c_args and friends #4963

Closed
Akaricchi opened this issue Feb 22, 2019 · 9 comments · Fixed by #5263
Closed

RFC: Proposal to rework c_args and friends #4963

Akaricchi opened this issue Feb 22, 2019 · 9 comments · Fixed by #5263

Comments

@Akaricchi
Copy link
Contributor

The behavior of *_args is currently inconsistent between native and cross builds. In native builds, it affects both the intermediate "native" tools that we want to run at build time, and the actual end-goal build targets. In a cross build, the later become "cross" targets and thus are not affected by *_args (except those added in a cross file).

There are a couple of problems with this:

What I'm suggesting is the same concept outlined in #4933: think in terms of build and host, not native and cross. So instead of c_args etc., we could have something like this:

  • build_<lang>_args, build_<lang>_link_args: used for "native" targets only (native is explicitly true).
  • host_<lang>_args, host_<lang>_link_args: used for other targets (native is either false or unspecified).
  • <lang>_args set in the cross files may map to host_<lang>_args.
  • In the future, maybe also deprecate the native kwarg and replace it with machine, accepting one of the global machine objects.
@jpakkane
Copy link
Member

Putting cross arguments in an option called cross_LANG_args so they are visible and editable was the original design plan. I'm even fairly sure I implemented it that way but either that is not the case or that was accidentally lost in a refactoring.

@Akaricchi
Copy link
Contributor Author

Putting cross arguments in an option called cross_LANG_args so they are visible and editable was the original design plan. I'm even fairly sure I implemented it that way but either that is not the case or that was accidentally lost in a refactoring.

I have seen this mentioned a few times, but I'm pretty sure these cross_* options never existed. I'm doing cross builds on a regular basis and I've never seen them show up in the configure output. Even if they did exist, which would've been a massive improvement, I still believe that it's not an ideal design. What you really want is an option that means "compile my project with these args"; whether it's a cross build or not is not a useful distinction here.

@dcbaker
Copy link
Member

dcbaker commented Feb 27, 2019

I wasn't originally convinced by the build/host/target vs native/cross thing, but I've become convinced that thinking in build/host/target terms is correct. The fact is that generally people don't care too much about the build flags, but they do care a lot about changing the host flags, whether that's in a cross compile or not.

@Ericson2314
Copy link
Member

#5110 reserved cross_, but per this proposal we might want to reserve host_ and build_ too.

@Ericson2314
Copy link
Member

#4931 made a cross_ builtin option as a stop-gap.

@Ericson2314
Copy link
Member

Ericson2314 commented Apr 15, 2019

I implemented this in #5263, replacing the cross_ stuff from #4931 (So definitely let me know what you think, @dcbaker!). We should make a decision on which approach for 0.51.

@Ericson2314
Copy link
Member

Ericson2314 commented Apr 29, 2019

Fingers crossed, but I think #5263 should pass tests on Windows now. As I say in #5263 (comment), hopefully this means it's finally worth discussing this and related issues about native-cross vs build-host so we can reach a common understanding.

edit it does.

@Ericson2314
Copy link
Member

Ericson2314 commented May 1, 2019

https://gitlab.freedesktop.org/wayland/weston/merge_requests/157/diffs Here is an example of code in the wild using is_cross_build() to implement something that should be unconditional. The ideal incantation is:

prog_scanner = find_program(
  dep_scanner.get_pkgconfig_variable('wayland_scanner', native: true))

i.e. always lookup on the build machine package config path.

This isn't options, but the idea of native: true is what's trying to be emulated here. native: true is good because it works in native and cross and builds alike, because it just means "build machine". cross: true isn't so useful because it means "skip" on native and "host machine" on cross, rather than "host machine" everywhere. cross_* in options has the exact same problem.

@marc-h38
Copy link
Contributor

The behavior of *_args is currently inconsistent between native and cross builds

I just shared some prototype test code in #6362 if you're interested.

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 a pull request may close this issue.

5 participants