-
Notifications
You must be signed in to change notification settings - Fork 521
Open
Labels
Description
JFYI:
In ALT we compiling with CFLAGS='-pipe -frecord-gcc-switches -Wall -g -O2 '
by default (but no -Werror
). With this libelf tests always negative even when libelf-devel is installed.
With this patch
diff --git a/check-deps/Makefile b/check-deps/Makefile
index 22e33f34..7887b436 100644
--- a/check-deps/Makefile
+++ b/check-deps/Makefile
@@ -58,7 +58,7 @@ LDFLAGS_have_libtraceevent = $(shell pkg-config --libs libtraceevent 2> /dev/nu
check-build: $(CHECK_LIST)
$(CHECK_LIST): %: __%.c $(CHKDIR)/check-tstamp
- @$(CC) $(CHECK_CFLAGS) -o $(CHKDIR)/$@ $< $(CHECK_LDFLAGS) > /dev/null 2>&1
+ set -x; $(CC) $(CHECK_CFLAGS) -o $(CHKDIR)/$@ $< $(CHECK_LDFLAGS)
$(CHKDIR)/check-tstamp: PHONY
@mkdir -p $(dir $@)
we see
+ gcc -pipe -frecord-gcc-switches -Wall -g -O2 -Werror -o /usr/src/RPM/BUILD/uftrace-0.14/check-deps/have_libelf __have_libelf.c -lelf
__have_libelf.c: In function 'main':
__have_libelf.c:6:19: error: unused variable 'ehdr' [-Werror=unused-variable]
6 | GElf_Ehdr ehdr;
| ^~~~
cc1: all warnings being treated as errors
In gcc 13.2.1 -Wunused-variable
is included in -Wall
:
$ gcc --help=warning -Q | grep unused-var
-Wunused-variable [disabled]
$ gcc -Wall --help=warning -Q | grep unused-var
-Wunused-variable [enabled]
I easily (except the time to find this) workaround this by adding -Wno-error=unused-variable
to CFLAGS
.