Hi, We've run into a problem trying to compile openvswitch with CFLAGS=-Werror.
I don't think it's an openvswitch problem. It appears to be a autoconf/gcc issue. openvswitch has a test to detect the library that implements __atomic_load_8 which boils down to "AC_SEARCH_LIBS([__atomic_load_8], [atomic])". The problem is when configure is invoked with "CFLAGS=-Werror ./configure" conftest.c fails to compile because the dummy prototype used doesn't match the builtin definition. This in turn causes openvswitch to fail to link because -latomic isn't included in LIBS. Here is a small patch that illustrates the problem --- 8< --- diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..e69de29 diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..0607b5b --- /dev/null +++ b/configure.ac @@ -0,0 +1,10 @@ +AC_INIT([test], [0.1]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign]) +AC_CONFIG_HEADERS([config.h]) +AC_PROG_CC +AC_SEARCH_LIBS([__atomic_load_8], [atomic]) +AC_CONFIG_FILES([ + Makefile +]) +AC_OUTPUT + --- 8< --- When invoked without specifying CFLAGS I get the following $ autoreconf -fvi $ ./configure | grep atomic_load checking for library containing __atomic_load_8... -latomic When specifing -Werror I get $ autoreconf -fvi $ CFLAGS=-Werror ./configure | grep atomic_load checking for library containing __atomic_load_8... no Looking at config.log we can see the following generated by GNU Autoconf 2.69. ... configure:2742: checking for C compiler version configure:2751: gcc --version >&5 gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4 ... configure:3478: checking for library containing __atomic_load_8 configure:3509: gcc -o conftest -Werror conftest.c >&5 conftest.c:18:6: error: conflicting types for built-in function '__atomic_load_8' [-Werror] char __atomic_load_8 (); ^ cc1: all warnings being treated as errors Any thoughts on how we can get -latomic detected and -Werror passed through to the build?