Would it be sufficient and palatable to allow developers to globally modify cxxflags etc at their own peril via gn args?
You could then template args.gn with your own tooling and fill in values from the environment, or maybe even args.gn could support environment var expansion at generation time?
In any case, globally overriding these flags seems likely to be fragile and error-prone so it would be a bit weird to make the behavior implicit.
Would it be sufficient and palatable to allow developers to globally modify cxxflags etc at their own peril via gn args?
You can read the bug for why this is a bad idea.The thing we worked out with the CrOS folks is that the script that wraps the Chrome build parses the environment variables and converts known ones to the corresponding GN variables. Unknown ones can go into a new GN build variable for "additional" flags. I'm not sure they actually implemented this yet, though.
What would it take to make GN build use CXXFLAGS and related variables from environment?
On Wed, Jun 29, 2016 at 08:57:00 -0400, Nico Weber wrote:
> FWIW, I think this has caused more harm than good in gyp land from my point
> of view (people didn't realize they had these set, and then their chrome
> builds broke).
Just an FYI, Linux distributions building software which uses gn will
expect that CXXFLAGS and such are applied (e.g., Fedora hardens builds
this way). I expect that reproducible build efforts also utilize these
environment variables.
On Wed, Jun 29, 2016 at 09:31:16 -0700, Dirk Pranke wrote:
> I'm not sure what you mean by "Fedora hardens builds this way" or
> "reproducible
> build efforts also utilize these environment variables". Can you point me
> to more
> info here?
Fedora uses CFLAGS and CXX flags to enforce policies such as this one:
https://fedoraproject.org/wiki/Changes/Harden_All_Packages#Detailed_Harden_Flags_Description
> Generally speaking, I see env vars as the opposite of reproducible,
> but of course that's not necessarily true in the context of a larger build
> file
> generation process.
It's reproducible within a given context, which may include a set of
specific compiler flags. Within the larger context, reproducible builds,
I believe, also usually scrub the external environment of state before
starting, but *within* the buildenv, there may be other settings which
are expected to be obeyed.
For example, the SOURCE_DATE_EPOCH environment varible is set within a
reproducible build (generally to the date of the release):
https://wiki.debian.org/ReproducibleBuilds/TimestampsProposal
On Wed, Jun 29, 2016 at 17:03:58 -0700, Dirk Pranke wrote:
> I grant the idea, although I don't think this particular example is
> applicable to a
> chromium build, which I think is already reproducible without it.
So I think that there's two different ways this discussion is being
viewed which may be confusing things here:
- gn as a standalone build tool; and
- the Chrome build.
Yes, I intended this thread to be in the Chrome context - packaging Chromium for open source distros.I really appreciate all the context and open discussion about this. GN is much more thoughtful about this than GYP, and I think that's good.I was looking at cros_toolchain.gni, and indeed having a way to pass things like cros_target_cxx and cros_target_extra_cxxflags would satisfy my use case. I believe I can convince distro packagers to use such explicit way to pass flags/settings, rather than environment being implicitly taken into account.Would you have suggestions how to accomplish that? cros_toolchain.gni seems cros-specific.
Looks like above CL hit some chromeos-specific questions.I'm wondering what can be done for the generic CFLAGS question.To clarify, this will be a major issue for Chromium packagers, and if an upstream solution can't be found they'll have to use custom patches.It's somewhat worrying it's already taking over 1.5 months to tackle this. I'm totally willing to write patches and have solutions for this - it's still unclear to me what solution you'd find acceptable, as the criteria don't seem to be so obvious to me.
We discussed this over VC.I wonder what the next steps are. While https://codereview.chromium.org/2202873002/ seems to be open and stalled, https://bugs.chromium.org/p/chromium/issues/detail?id=629593 is marked as fixed. Do you intend to make further changes to how cros toolchain is configured in GN?
I'm wondering what's blocking an attempt to add generic flag support (not just cros-specific).
Looks like that CL is now closed, and https://bugs.chromium.org/p/chromium/issues/detail?id=642016 has been filed. Thanks for the details and thoughts on that bug. Let me respond to some of them here:1. Starting with a simple scenario (host==target, no nacl) sounds good to me. What would it take to make that possible?
2. What would it take for a packager to define their own toolchain and make the build use it? We could provide a python script to generate such it (and possibly modify the build files to switch to it).
Cool. There's an updated version now which also handles cross-compiling.Do you have recommendations where could we check-in this file to chromium sources so that it could be more easily shared by different distros and possibly further improved?One of the possible places could be src/build/linux/unbundle . Other suggestions would also be welcome.