Re: Compiling git with -Werror

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 27, 2012 at 11:45:20AM +0200, Michael Haggerty wrote:

> I like to develop with errors and warnings turned up as strict as
> possible.  For example, I would like to use
> 
>     CFLAGS="-g -O2 -Wall -Werror -Wdeclaration-after-statement"

That's more or less how I compile git.

> I thought this would be as simple as
> 
>     git clean -fdx
>     make configure
>     ./configure CFLAGS="-g -O2 -Wall -Werror -Wdeclaration-after-statement"

I don't use our autoconf at all, though. I put settings like that into
config.mak, which gets sourced by the Makefile (right after
config.mak.autogen, which is what configure produces).

> The cause of the problem is that the CFLAGS variable is used by
> ./configure when it is running its tests, and some of the tests don't
> work correctly (they produce results that are not correct for the
> platform) when run with the strict CFLAGS.
> [...]
> Is there some other mechanism to set strict CFLAGS parameters for the
> build without confusing ./configure?

Try putting "CFLAGS += -Werror" in config.mak.

> Is this a bug in how the git project is using autoconf?
> 
> Is it a bug in autoconf itself?

I think autoconf. Our configure input is just using
AC_CHECK_FUNC(strtok_r) to generate the test.  Which would mean that
it's a bad interaction of autoconf's code and your CFLAGS. So I would be
surprised if other packages didn't have similar problems.

And indeed, googling for 'autoconf cflags "-Werror"' turns up:

  http://lists.gnu.org/archive/html/bug-autoconf/2012-03/msg00070.html

Summary: don't do that. We could add a special option to turn on
warnings, but given how easy the config.mak trick above is, I don't know
that it's necessary.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]