In an environment where CFLAGS is set by default to include `-fstack-protector-strong`, a build of Valgrind 3.25.1 will fail because the memcheck configure-generated build places $(CFLAGS) after $(memcheck_amd64_linux_CFLAGS), causing stack protector to be enabled; for example this excerpt from the generated Makefile in memcheck: ``` memcheck_amd64_linux-mc_main_asm.obj: mc_main_asm.c $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(memcheck_amd64_linux_CPPFLAGS) $(CPPFLAGS) $(memcheck_amd64_linux_CFLAGS) $(CFLAGS) -MT memcheck_amd64_linux-mc_main_asm.obj -MD -MP -MF $(DEPDIR)/memcheck_amd64_linux-mc_main_asm.Tpo -c -o memcheck_amd64_linux-mc_main_asm.obj `if test -f 'mc_main_asm.c'; then $(CYGPATH_W) 'mc_main_asm.c'; else $(CYGPATH_W) '$(srcdir)/mc_main_asm.c'; fi` $(AM_V_at)$(am__mv) $(DEPDIR)/memcheck_amd64_linux-mc_main_asm.Tpo $(DEPDIR)/memcheck_amd64_linux-mc_main_asm.Po ```
This is how automake works https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html in particular "The reason ‘$(CPPFLAGS)’ appears after ‘$(AM_CPPFLAGS)’ or ‘$(mumble_CPPFLAGS)’ in the compile command is that users should have the last say. In the example above, the desire is for the ‘CXXFLAGS=-O0’ to supersede any other switch from AM_CXXFLAGS or mumble_CXXFLAGS. " This also applies to CFLAGS. Realistically I can't see what we can do. clang --help outputs over 1000 lines that start with spaces then a '-', a rough indication of the number of supported flags. How could we filter out all of the ones that we don't like?