Discussion:
[Bug general/23914] New: Add --disable-werror to ./configure support (example trigger: CFLAGS=-Og
slyfox at inbox dot ru
2018-11-23 16:29:08 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23914

Bug ID: 23914
Summary: Add --disable-werror to ./configure support (example
trigger: CFLAGS=-Og
Product: elfutils
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: general
Assignee: unassigned at sourceware dot org
Reporter: slyfox at inbox dot ru
CC: elfutils-devel at sourceware dot org
Target Milestone: ---

Initially I attempted to reproduce https://bugs.gentoo.org/671650 on vanilla
master on elfutils as:

$ autoreconf -i -f && ./configure --disable-maintainer-mode CFLAGS=-Og &&
make && make check

The problem is in unconditional -Werror addition in
config/eu.am: $(if $($(*F)_no_Werror),,-Werror) \

May I ask to add --disable-werror support to ./configure? That way elfutils
will be less dependent on exact toolchain version and compiler flags
(specifically warning flags).

Example failure:

dwarf_child.c: In function '__libdw_find_attr':
dwarf_child.c:99:10: error: 'readp' may be used uninitialized in this
function [-Werror=maybe-uninitialized]
readp += len;
^~

Today Gentoo crudely works it around by sed'ing out -Werror at build time:

https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-libs/elfutils/elfutils-0.175.ebuild#n34
sed -i 's:-Werror::' */Makefile.in || die

Thanks!
--
You are receiving this mail because:
You are on the CC list for the bug.
mark at klomp dot org
2018-11-23 14:55:27 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23914

Mark Wielaard <mark at klomp dot org> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |mark at klomp dot org

--- Comment #1 from Mark Wielaard <mark at klomp dot org> ---
I rather have that people report such issues and we fix them.

In this case it really was just that one gcc warning (plus an almost identical
one in dwarf_getattrs):
https://sourceware.org/ml/elfutils-devel/2018-q4/msg00174.html

And that build flag actually showed a very interesting nasty bug that we might
not have found otherwise:
https://sourceware.org/ml/elfutils-devel/2018-q4/msg00175.html

Does Gentoo show any other compile errors?

BTW for make check to work correctly you do of course need debuginfo, so you
really need CLAGS="-g -Og".
--
You are receiving this mail because:
You are on the CC list for the bug.
slyfox at inbox dot ru
2018-11-23 23:42:42 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23914

--- Comment #2 from Sergei Trofimovich <slyfox at inbox dot ru> ---
(In reply to Mark Wielaard from comment #1)
Post by mark at klomp dot org
I rather have that people report such issues and we fix them.
Totally understandable. My intent is to only still be able to build old
releases with new toolchains or against exotic yet safe CFLAGS without resort
to manual patching of build system.

I would suggest having --enable-werror enabled by default. That way we would be
able to disable it downstream for older packages on first offense.
Post by mark at klomp dot org
In this case it really was just that one gcc warning (plus an almost
https://sourceware.org/ml/elfutils-devel/2018-q4/msg00174.html
And that build flag actually showed a very interesting nasty bug that we
https://sourceware.org/ml/elfutils-devel/2018-q4/msg00175.html
Does Gentoo show any other compile errors?
Yes. I can trigger a lot of them passing various warning flags (I'll post those
below).

Gentoo allows users to control CC and CFLAGS and thus the space for getting a
warning is wide. People frequently use things like -Wcast-qual or other high
signal-to-noise flags for their purposes.

My favourite example is
./configure CFLAGS="-g -Wall" # works today without failures
or even ./configure CC=clang CFLAGS="-g -Weverything" but elfutils does not
seem to support clang.

Real-world examples used by people:

1. CFLAGS="-g -Wall -Wcast-qual"

In file included from gelf_xlate.c:166:
version_xlate.h: In function 'elf_cvt_Verdef':
version_xlate.h:74:31: error: cast discards 'const' qualifier from pointer
target type [-Werror=cast-qual]
dsrc = (GElf_Verdef *) ((char *) src + def_offset);
^

2. CFLAGS="-g -O2 -Wstack-protector"

CC readelf.o
readelf.c: In function 'open_input_section':
readelf.c:581:1: error: stack protector not protecting local variables:
variable length buffer [-Werror=stack-protector]
open_input_section (int fd)
^~~~~~~~~~~~~~~~~~
Post by mark at klomp dot org
BTW for make check to work correctly you do of course need debuginfo, so you
really need CLAGS="-g -Og".
Yes, sorry. Forgot about the unconditional -g passing (we do it all the time).
--
You are receiving this mail because:
You are on the CC list for the bug.
Loading...