title: Configuring qemu build results in an "Error: configure test passed without -Werror but failed with -Werror."
body: <p>I'm trying to build qemu from sources, I use <code>./configure --enable-capstone --enable-tcg-plugin --target-list=x86_64-linux-user</code> to configure it before building using make.</p>
  <p>This results in the following error:</p>
  <pre><code>ERROR: configure test passed without -Werror but failed with -Werror.
         This is probably a bug in the configure script. The failing command
         will be at the bottom of config.log.
         You can run configure with --disable-werror to bypass this check.
  </code></pre>
  <p>This is the bottom of the <code>config.log</code> file:</p>
  <pre><code>config-temp/qemu-conf.c: In function ‘main’:
  config-temp/qemu-conf.c:2:25: warning: null argument where non-null required (argument 1) [-Wnonnull]
      2 | int main(void) { return sem_timedwait(0, 0); }
        |                         ^~~~~~~~~~~~~
  config-temp/qemu-conf.c:2:25: warning: null argument where non-null required (argument 2) [-Wnonnull]
  cc -Werror -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wno-error=address-of-packed-member -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/include/capstone -o config-temp/qemu-conf.exe config-temp/qemu-conf.c -Wl,-z,relro -Wl,-z,now -pie -m64 -g
  config-temp/qemu-conf.c: In function ‘main’:
  config-temp/qemu-conf.c:2:25: error: null argument where non-null required (argument 1) [-Werror=nonnull]
      2 | int main(void) { return sem_timedwait(0, 0); }
        |                         ^~~~~~~~~~~~~
  config-temp/qemu-conf.c:2:25: error: null argument where non-null required (argument 2) [-Werror=nonnull]
  cc1: all warnings being treated as errors
  ~                                                                                                                                                                                                                  
  ~                                      
  </code></pre>
  <p>I also tried to <code>--disable-werror</code>, this <code>configure</code>s well, but does not build. it gives the following errors while building:</p>
  <pre><code>/home/p/Desktop/qemu-plugins-tutorial/qemu/linux-user/syscall.c:256:16: error: static declaration of ‘gettid’ follows non-static declaration
    256 | _syscall0(int, gettid)
        |                ^~~~~~
  /home/p/Desktop/qemu-plugins-tutorial/qemu/linux-user/syscall.c:187:13: note: in definition of macro ‘_syscall0’
    187 | static type name (void)   \
        |             ^~~~
  In file included from /usr/include/unistd.h:1170,
                   from /home/p/Desktop/qemu-plugins-tutorial/qemu/include/qemu/osdep.h:90,
                   from /home/p/Desktop/qemu-plugins-tutorial/qemu/linux-user/syscall.c:20:
  /usr/include/x86_64-linux-gnu/bits/unistd_ext.h:34:16: note: previous declaration of ‘gettid’ was here
     34 | extern __pid_t gettid (void) __THROW;
        |                ^~~~~~
  /home/p/Desktop/qemu-plugins-tutorial/qemu/linux-user/ioctls.h:224:9: error: ‘SIOCGSTAMP’ undeclared here (not in a function); did you mean ‘SIOCSRARP’?
    224 |   IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval)))
        |         ^~~~~~~~~~
  /home/p/Desktop/qemu-plugins-tutorial/qemu/linux-user/syscall.c:4756:23: note: in definition of macro ‘IOCTL’
   4756 |     { TARGET_ ## cmd, cmd, #cmd, access, 0, {  __VA_ARGS__ } },
        |                       ^~~
  /home/p/Desktop/qemu-plugins-tutorial/qemu/linux-user/ioctls.h:225:9: error: ‘SIOCGSTAMPNS’ undeclared here (not in a function); did you mean ‘SIOCGSTAMP_OLD’?
    225 |   IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec)))
        |         ^~~~~~~~~~~~
  /home/p/Desktop/qemu-plugins-tutorial/qemu/linux-user/syscall.c:4756:23: note: in definition of macro ‘IOCTL’
   4756 |     { TARGET_ ## cmd, cmd, #cmd, access, 0, {  __VA_ARGS__ } },
        |                       ^~~
    CC      x86_64-linux-user/linux-user/strace.o
  make[1]: *** [/home/p/Desktop/qemu-plugins-tutorial/qemu/rules.mak:69: linux-user/syscall.o] Error 1
  make[1]: *** Waiting for unfinished jobs....
    LINK    qemu-img
  make: *** [Makefile:484: subdir-x86_64-linux-user] Error 2
  </code></pre>
  <p>What would be a possible fix for this?</p>