Preventing the build from adding options like '-pipe' et al

Ralph Seichter abbot at monksofcool.net
Mon Oct 28 18:55:40 UTC 2019


* 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.

> Our build scripts honor user's defined CFLAGS and give them the
> preference as they come after all other flags.

Your build does however add flags like '-pipe' or '-g' which the user
has not set. That's what I need to address.

> Note, that setting --cc-opt="${CFLAGS}" is a bad idea.  Because this
> way all CFLAGS will be duplicated.

Yeah, that's what I figured. My hope was that if I explicitly pass
--cc-opt, the build would not add any other options.

> 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.

> 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.

> Could you raise a question, what's special with Unit that additional
> flags aren't allowed, while they are ok for other mature ebuilds?

I can notify the Gentoo QA team of this thread. Perhaps a member is
willing to elaborate why Gentoo policies are the way they are, and
why/when exceptions are made.

-Ralph


More information about the unit mailing list