https://bugs.gentoo.org/831339
https://bugs.gentoo.org/846938
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -1,5 +1,5 @@
 
-LIBBPF_CFLAGS:=$(if $(CFLAGS),$(CFLAGS),-g -O2 -Werror -Wall) -fPIC
+LIBBPF_CFLAGS:=$(if $(CFLAGS),$(CFLAGS),-g -O2 -Wall) -fPIC
 
 LIB_DIR = .
 include defines.mk
--- a/lib/common.mk
+++ b/lib/common.mk
@@ -113,7 +113,6 @@ $(XDP_OBJ): %.o: %.c $(KERN_USER_H) $(EXTRA_DEPS) $(BPF_HEADERS) $(LIBMK)
 	    -Wno-unused-value \
 	    -Wno-pointer-sign \
 	    -Wno-compare-distinct-pointer-types \
-	    -Werror \
 	    -O2 -emit-llvm -c -g -o ${@:.o=.ll} $<
 	$(QUIET_LLC)$(LLC) -march=$(BPF_TARGET) -filetype=obj -o $@ ${@:.o=.ll}
 
--- a/lib/defines.mk
+++ b/lib/defines.mk
@@ -39,7 +39,7 @@ endif
 
 DEFINES += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
 
-CFLAGS += -std=gnu11 -Wextra -Werror $(DEFINES)
+CFLAGS += -std=gnu11 -Wextra $(DEFINES)
 BPF_CFLAGS += $(DEFINES)
 
 CONFIGMK := $(LIB_DIR)/../config.mk
--- a/lib/libxdp/Makefile
+++ b/lib/libxdp/Makefile
@@ -19,7 +19,7 @@ MAN_OBJ := ${MAN_PAGE:.3=.man}
 MAN_FILES := $(MAN_PAGE)
 TEST_DIR := tests
 TEST_FILE := $(TEST_DIR)/test-libxdp.sh
-TEST_CFLAGS := $(CFLAGS) -I$(realpath $(HEADER_DIR)) -L$(realpath $(OBJDIR)) -Wall -Werror $(LDFLAGS)
+TEST_CFLAGS := $(CFLAGS) -I$(realpath $(HEADER_DIR)) -L$(realpath $(OBJDIR)) -Wall $(LDFLAGS)
 TEST_LDLIBS := $(LDLIBS)
 
 SHARED_CFLAGS += -fPIC -DSHARED
@@ -144,7 +144,6 @@ $(XDP_OBJS): %.o: %.c $(BPF_HEADERS) $(LIBMK)
 	    -Wno-unused-value \
 	    -Wno-pointer-sign \
 	    -Wno-compare-distinct-pointer-types \
-	    -Werror \
 	    -O2 -emit-llvm -c -g -o ${@:.o=.ll} $<
 	$(QUIET_LLC)$(LLC) -march=$(BPF_TARGET) -filetype=obj -o $@ ${@:.o=.ll}
 
diff --git a/configure b/configure
index 0a17eae..fd251b7 100755
--- a/configure
+++ b/configure
@@ -186,7 +186,7 @@ int main(int argc, char **argv) {
     return 0;
 }
 EOF
-    libbpf_err=$($CC -o $TMPDIR/libbpftest $TMPDIR/libbpftest.c -Werror $LIBBPF_CFLAGS $LIBBPF_LDLIBS 2>&1)
+    libbpf_err=$($CC -o $TMPDIR/libbpftest $TMPDIR/libbpftest.c $LIBBPF_CFLAGS $LIBBPF_LDLIBS 2>&1)
     if [ "$?" -eq "0" ]; then
         echo "HAVE_FEATURES+=${config_var}" >>"$CONFIG"
         echo "yes"
@@ -254,7 +254,7 @@ int main(int argc, char **argv) {
 }
 EOF
 
-        libbpf_err=$($CC -o $TMPDIR/libbpftest $TMPDIR/libbpftest.c -Werror $LIBBPF_CFLAGS $LIBBPF_LDLIBS 2>&1)
+        libbpf_err=$($CC -o $TMPDIR/libbpftest $TMPDIR/libbpftest.c $LIBBPF_CFLAGS $LIBBPF_LDLIBS 2>&1)
         if [ "$?" -eq "0" ]; then
             echo "SYSTEM_LIBBPF:=y" >>$CONFIG
             echo "LIBBPF_VERSION=$LIBBPF_VERSION" >>$CONFIG
