Preventing the build from adding options like '-pipe' et al
Valentin V. Bartenev
vbart at nginx.com
Tue Oct 29 15:10:50 UTC 2019
On Monday 28 October 2019 19:55:40 Ralph Seichter wrote:
> * Valentin V. Bartenev:
> > Unit build scripts don't override user's CFLAGS. In fact, it's
> > constructed out of three variables:
> > CFLAGS = $NXT_CFLAGS $NXT_CC_OPT $CFLAGS
> Actually, having CFLAGS on the left hand side of this assignment *does*
> override the existing environment-provided CFLAGS. Even if you used
> something like
> $(CC) $(CFLAGS) $(NXT_CFLAGS) $(NXT_CC_OPT)
> it would still be overriding, or call it extending, the existing
> compiler flags as set by the environment.
By overriding I ment that user's flags get priority, and environment
CFLAGS can negate most of the flags set before, e.g. -g0 negates -g
The example by the link demonstrates different case, when CFLAGS are
replaced completely without picking up environment flags.
BTW, "Basic guide to write Gentoo Ebuilds" for an example application
uses Makefile that overrides all flags, and they are: -g -O0 -pipe.
> > nginx ebuild is maintained more than 14 years and the rhetorical
> > question is why it's not a problem for it, but a problem for Unit.
> I cannot give you the reasoning behind the NGINX build, because I don't
> maintain it. I introduced the NGINX Unit build to Gentoo, and that's the
> build I am responsible for. The QA bugs have not been filed by myself,
> but I cannot ignore them.
Well, searching over Gentoo Bugzilla shows about 100 tickets related to CFLAGS.
Some of them are similar and 5+ years old, e.g:
- https://bugs.gentoo.org/385995 (note the reporter).
And sometimes users ask quite the opposite, respect for the upstream CFLAGS:
> > If we won't force "-g", we will have more meaningless bug reports with
> > all the negative consequences.
> I understand your reasoning as much as that of our QA team, and I am
> caught in the middle. I like Unit a lot and personally would not mind
> '-g', but my opinion does not count for much when I submit merge
> requests and they get rejected because of Gentoo's house rules.
> Note also that I don't intend to pressure you into anything. If you
> don't feel like modifying your working build because of "the world
> according to Gentoo", I can understand that.
If there will be users who suffering somehow and those flags cause problems
for them, then we will look for a solution. Right now it very much looks like
nit-picking. I see no real problem with adding "-g -pipe" on systems where
they are supported. Moreover, nginx has been doing it since 2004 and there
were no reports about any issues with that.
It seems that someone sees his mission in checking various software for -g
and -pipe flags added. Sorry, but it doesn't really a valuable reason to
If you will end up with decision to patch sources, then patch this script:
wbr, Valentin V. Bartenev
More information about the unit