qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] meson: Add most 3rd-party includes as system includes
@ 2025-06-17 20:34 Bernhard Beschow
  2025-07-03  6:25 ` Bernhard Beschow
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Bernhard Beschow @ 2025-06-17 20:34 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Daniel P. Berrangé,
	Philippe Mathieu-Daudé, Marc-André Lureau,
	Bernhard Beschow

When compiling QEMU against fuse3-3.17.1 with --enable-werror the build fails
with:

  In file included from ../src/block/export/fuse.c:33:
  /usr/include/fuse3/fuse.h:959:5: error: redundant redeclaration of ‘fuse_main_real_versioned’ [-Werror=redundant-decls]
    959 | int fuse_main_real_versioned(int argc, char *argv[],
        |     ^~~~~~~~~~~~~~~~~~~~~~~~
  /usr/include/fuse3/fuse.h:885:5: note: previous declaration of ‘fuse_main_real_versioned’ with type ‘int(int,  char **, const struct fuse_operations *, size_t,  struct libfuse_version *, void *)’ {aka ‘int(int,  char **, const struct fuse_operations *, long unsigned int,  struct libfuse_version *, void *)’}
    885 | int fuse_main_real_versioned(int argc, char *argv[],
        |     ^~~~~~~~~~~~~~~~~~~~~~~~
  cc1: all warnings being treated as errors

That is, a fuse header triggers a warning within itself. Since QEMU adds the
fuse3 include path via `-I`, the compiler thinks that the header is part of the
QEMU project, and thus raises a warning. The compiler can be told to ignore
warnings within 3rd party headers by adding these paths via `-isystem`. Fix the
above build failure by marking fuse as system dependency. While at it mark
every 3rd-party dependency as system dependency to prevent similar issues in the
future but skip glib since that results in glib include paths to be omitted from
bindgen in case of a Rust build.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 meson.build | 160 ++++++++++++++++++++++++++--------------------------
 1 file changed, 80 insertions(+), 80 deletions(-)

diff --git a/meson.build b/meson.build
index 34729c2a3d..694cf95f6f 100644
--- a/meson.build
+++ b/meson.build
@@ -826,7 +826,7 @@ endif
 #####################################
 
 libm = cc.find_library('m', required: false)
-threads = dependency('threads')
+threads = dependency('threads', include_type: 'system')
 util = cc.find_library('util', required: false)
 winmm = []
 socket = []
@@ -859,11 +859,11 @@ if host_os == 'windows'
                                       include_directories: include_directories('.'))
   host_dsosuf = '.dll'
 elif host_os == 'darwin'
-  coref = dependency('appleframeworks', modules: 'CoreFoundation')
-  iokit = dependency('appleframeworks', modules: 'IOKit', required: false)
+  coref = dependency('appleframeworks', modules: 'CoreFoundation', include_type: 'system')
+  iokit = dependency('appleframeworks', modules: 'IOKit', required: false, include_type: 'system')
   host_dsosuf = '.dylib'
   pvg = dependency('appleframeworks', modules: ['ParavirtualizedGraphics', 'Metal'],
-                   required: get_option('pvg'))
+                   required: get_option('pvg'), include_type: 'system')
 elif host_os == 'sunos'
   socket = [cc.find_library('socket'),
             cc.find_library('nsl'),
@@ -899,7 +899,7 @@ endif
 hvf = not_found
 if get_option('hvf').allowed()
   hvf = dependency('appleframeworks', modules: 'Hypervisor',
-                   required: get_option('hvf'))
+                   required: get_option('hvf'), include_type: 'system')
   if hvf.found()
     accelerators += 'CONFIG_HVF'
   endif
@@ -960,30 +960,30 @@ endif
 xen = not_found
 if get_option('xen').enabled() or (get_option('xen').auto() and have_system)
   xencontrol = dependency('xencontrol', required: false,
-                          method: 'pkg-config')
+                          method: 'pkg-config', include_type: 'system')
   if xencontrol.found()
     xen_pc = declare_dependency(version: xencontrol.version(),
       dependencies: [
         xencontrol,
         # disabler: true makes xen_pc.found() return false if any is not found
         dependency('xenstore', required: false,
-                   method: 'pkg-config',
+                   method: 'pkg-config', include_type: 'system',
                    disabler: true),
         dependency('xenforeignmemory', required: false,
-                   method: 'pkg-config',
+                   method: 'pkg-config', include_type: 'system',
                    disabler: true),
         dependency('xengnttab', required: false,
-                   method: 'pkg-config',
+                   method: 'pkg-config', include_type: 'system',
                    disabler: true),
         dependency('xenevtchn', required: false,
-                   method: 'pkg-config',
+                   method: 'pkg-config', include_type: 'system',
                    disabler: true),
         dependency('xendevicemodel', required: false,
-                   method: 'pkg-config',
+                   method: 'pkg-config', include_type: 'system',
                    disabler: true),
         # optional, no "disabler: true"
         dependency('xentoolcore', required: false,
-                   method: 'pkg-config')])
+                   method: 'pkg-config', include_type: 'system')])
     if xen_pc.found()
       xen = xen_pc
     endif
@@ -1050,10 +1050,10 @@ glib_pc = dependency('glib-2.0', version: glib_req_ver, required: true,
 glib_cflags = []
 if enable_modules
   gmodule = dependency('gmodule-export-2.0', version: glib_req_ver, required: true,
-                       method: 'pkg-config')
+                       method: 'pkg-config', include_type: 'system')
 elif get_option('plugins')
   gmodule = dependency('gmodule-no-export-2.0', version: glib_req_ver, required: true,
-                       method: 'pkg-config')
+                       method: 'pkg-config', include_type: 'system')
 else
   gmodule = not_found
 endif
@@ -1109,7 +1109,7 @@ gdbus_codegen = not_found
 gdbus_codegen_error = '@0@ requires gdbus-codegen, please install libgio'
 if not get_option('gio').auto() or have_system
   gio = dependency('gio-2.0', required: get_option('gio'),
-                   method: 'pkg-config')
+                   method: 'pkg-config', include_type: 'system')
   if gio.found() and not cc.links('''
     #include <gio/gio.h>
     int main(void)
@@ -1126,7 +1126,7 @@ if not get_option('gio').auto() or have_system
     gdbus_codegen = find_program('gdbus-codegen',
                                  required: get_option('gio'))
     gio_unix = dependency('gio-unix-2.0', required: get_option('gio'),
-                          method: 'pkg-config')
+                          method: 'pkg-config', include_type: 'system')
     gio = declare_dependency(dependencies: [gio, gio_unix],
                              version: gio.version())
   endif
@@ -1141,15 +1141,15 @@ xml_pp = find_program('scripts/xml-preprocess.py')
 lttng = not_found
 if 'ust' in get_option('trace_backends')
   lttng = dependency('lttng-ust', required: true, version: '>= 2.1',
-                     method: 'pkg-config')
+                     method: 'pkg-config', include_type: 'system')
 endif
 pixman = not_found
 if not get_option('pixman').auto() or have_system or have_tools
   pixman = dependency('pixman-1', required: get_option('pixman'), version:'>=0.21.8',
-                      method: 'pkg-config')
+                      method: 'pkg-config', include_type: 'system')
 endif
 
-zlib = dependency('zlib', required: true)
+zlib = dependency('zlib', required: true, include_type: 'system')
 
 libaio = not_found
 if not get_option('linux_aio').auto() or have_block
@@ -1167,7 +1167,7 @@ linux_io_uring = not_found
 if not get_option('linux_io_uring').auto() or have_block
   linux_io_uring = dependency('liburing', version: '>=0.3',
                               required: get_option('linux_io_uring'),
-                              method: 'pkg-config')
+                              method: 'pkg-config', include_type: 'system')
   if not cc.links(linux_io_uring_test)
     linux_io_uring = not_found
   endif
@@ -1177,7 +1177,7 @@ libnfs = not_found
 if not get_option('libnfs').auto() or have_block
   libnfs = dependency('libnfs', version: ['>=1.9.3', '<6.0.0'],
                       required: get_option('libnfs'),
-                      method: 'pkg-config')
+                      method: 'pkg-config', include_type: 'system')
 endif
 
 libattr_test = '''
@@ -1214,9 +1214,9 @@ endif
 
 cocoa = dependency('appleframeworks',
                    modules: ['Cocoa', 'CoreVideo', 'QuartzCore'],
-                   required: get_option('cocoa'))
+                   required: get_option('cocoa'), include_type: 'system')
 
-vmnet = dependency('appleframeworks', modules: 'vmnet', required: get_option('vmnet'))
+vmnet = dependency('appleframeworks', modules: 'vmnet', required: get_option('vmnet'), include_type: 'system')
 if vmnet.found() and not cc.has_header_symbol('vmnet/vmnet.h',
                                               'VMNET_BRIDGED_MODE',
                                               dependencies: vmnet)
@@ -1233,7 +1233,7 @@ seccomp_has_sysrawrc = false
 if not get_option('seccomp').auto() or have_system or have_tools
   seccomp = dependency('libseccomp', version: '>=2.3.0',
                        required: get_option('seccomp'),
-                       method: 'pkg-config')
+                       method: 'pkg-config', include_type: 'system')
   if seccomp.found()
     seccomp_has_sysrawrc = cc.has_header_symbol('seccomp.h',
                                                 'SCMP_FLTATR_API_SYSRAWRC',
@@ -1265,13 +1265,13 @@ if get_option('xkbcommon').auto() and not have_system and not have_tools
   xkbcommon = not_found
 else
   xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'),
-                         method: 'pkg-config')
+                         method: 'pkg-config', include_type: 'system')
 endif
 
 slirp = not_found
 if not get_option('slirp').auto() or have_system
   slirp = dependency('slirp', required: get_option('slirp'),
-                     method: 'pkg-config')
+                     method: 'pkg-config', include_type: 'system')
   # slirp < 4.7 is incompatible with CFI support in QEMU.  This is because
   # it passes function pointers within libslirp as callbacks for timers.
   # When using a system-wide shared libslirp, the type information for the
@@ -1313,35 +1313,35 @@ endif
 pulse = not_found
 if not get_option('pa').auto() or (host_os == 'linux' and have_system)
   pulse = dependency('libpulse', required: get_option('pa'),
-                     method: 'pkg-config')
+                     method: 'pkg-config', include_type: 'system')
 endif
 alsa = not_found
 if not get_option('alsa').auto() or (host_os == 'linux' and have_system)
   alsa = dependency('alsa', required: get_option('alsa'),
-                    method: 'pkg-config')
+                    method: 'pkg-config', include_type: 'system')
 endif
 jack = not_found
 if not get_option('jack').auto() or have_system
   jack = dependency('jack', required: get_option('jack'),
-                    method: 'pkg-config')
+                    method: 'pkg-config', include_type: 'system')
 endif
 pipewire = not_found
 if not get_option('pipewire').auto() or (host_os == 'linux' and have_system)
   pipewire = dependency('libpipewire-0.3', version: '>=0.3.60',
                     required: get_option('pipewire'),
-                    method: 'pkg-config')
+                    method: 'pkg-config', include_type: 'system')
 endif
 sndio = not_found
 if not get_option('sndio').auto() or have_system
   sndio = dependency('sndio', required: get_option('sndio'),
-                    method: 'pkg-config')
+                    method: 'pkg-config', include_type: 'system')
 endif
 
 spice_protocol = not_found
 if not get_option('spice_protocol').auto() or have_system
   spice_protocol = dependency('spice-protocol', version: '>=0.14.0',
                               required: get_option('spice_protocol'),
-                              method: 'pkg-config')
+                              method: 'pkg-config', include_type: 'system')
 endif
 spice = not_found
 if get_option('spice') \
@@ -1351,7 +1351,7 @@ if get_option('spice') \
              .allowed()
   spice = dependency('spice-server', version: '>=0.14.0',
                      required: get_option('spice'),
-                     method: 'pkg-config')
+                     method: 'pkg-config', include_type: 'system')
 endif
 spice_headers = spice.partial_dependency(compile_args: true, includes: true)
 
@@ -1361,28 +1361,28 @@ libiscsi = not_found
 if not get_option('libiscsi').auto() or have_block
   libiscsi = dependency('libiscsi', version: '>=1.9.0',
                          required: get_option('libiscsi'),
-                         method: 'pkg-config')
+                         method: 'pkg-config', include_type: 'system')
 endif
 zstd = not_found
 if not get_option('zstd').auto() or have_block
   zstd = dependency('libzstd', version: '>=1.4.0',
                     required: get_option('zstd'),
-                    method: 'pkg-config')
+                    method: 'pkg-config', include_type: 'system')
 endif
 qpl = not_found
 if not get_option('qpl').auto() or have_system
   qpl = dependency('qpl', version: '>=1.5.0',
                     required: get_option('qpl'),
-                    method: 'pkg-config')
+                    method: 'pkg-config', include_type: 'system')
 endif
 uadk = not_found
 if not get_option('uadk').auto() or have_system
   libwd = dependency('libwd', version: '>=2.6',
                       required: get_option('uadk'),
-                      method: 'pkg-config')
+                      method: 'pkg-config', include_type: 'system')
   libwd_comp = dependency('libwd_comp', version: '>=2.6',
                            required: get_option('uadk'),
-                           method: 'pkg-config')
+                           method: 'pkg-config', include_type: 'system')
   if libwd.found() and libwd_comp.found()
      uadk = declare_dependency(dependencies: [libwd, libwd_comp])
   endif
@@ -1392,7 +1392,7 @@ qatzip = not_found
 if not get_option('qatzip').auto() or have_system
   qatzip = dependency('qatzip', version: '>=1.1.2',
                       required: get_option('qatzip'),
-                      method: 'pkg-config')
+                      method: 'pkg-config', include_type: 'system')
 endif
 
 virgl = not_found
@@ -1400,31 +1400,31 @@ virgl = not_found
 have_vhost_user_gpu = have_tools and host_os == 'linux' and pixman.found()
 if not get_option('virglrenderer').auto() or have_system or have_vhost_user_gpu
   virgl = dependency('virglrenderer',
-                     method: 'pkg-config',
+                     method: 'pkg-config', include_type: 'system',
                      required: get_option('virglrenderer'))
 endif
 rutabaga = not_found
 if not get_option('rutabaga_gfx').auto() or have_system or have_vhost_user_gpu
   rutabaga = dependency('rutabaga_gfx_ffi',
-                         method: 'pkg-config',
+                         method: 'pkg-config', include_type: 'system',
                          required: get_option('rutabaga_gfx'))
 endif
 blkio = not_found
 if not get_option('blkio').auto() or have_block
   blkio = dependency('blkio',
-                     method: 'pkg-config',
+                     method: 'pkg-config', include_type: 'system',
                      required: get_option('blkio'))
 endif
 curl = not_found
 if not get_option('curl').auto() or have_block
   curl = dependency('libcurl', version: '>=7.29.0',
-                    method: 'pkg-config',
+                    method: 'pkg-config', include_type: 'system',
                     required: get_option('curl'))
 endif
 libudev = not_found
 if host_os == 'linux' and (have_system or have_tools)
   libudev = dependency('libudev',
-                       method: 'pkg-config',
+                       method: 'pkg-config', include_type: 'system',
                        required: get_option('libudev'))
 endif
 
@@ -1504,7 +1504,7 @@ if have_system and get_option('curses').allowed()
   curses_dep_list = host_os == 'windows' ? ['ncurses', 'ncursesw'] : ['ncursesw']
   curses = dependency(curses_dep_list,
                       required: false,
-                      method: 'pkg-config')
+                      method: 'pkg-config', include_type: 'system')
   msg = get_option('curses').enabled() ? 'curses library not found' : ''
   curses_compile_args = ['-DNCURSES_WIDECHAR=1']
   if curses.found()
@@ -1593,7 +1593,7 @@ endif
 
 sdl = not_found
 if not get_option('sdl').auto() or have_system
-  sdl = dependency('sdl2', required: get_option('sdl'))
+  sdl = dependency('sdl2', required: get_option('sdl'), include_type: 'system')
   sdl_image = not_found
 endif
 if sdl.found()
@@ -1608,7 +1608,7 @@ if sdl.found()
                              version: sdl.version())
   endif
   sdl_image = dependency('SDL2_image', required: get_option('sdl_image'),
-                         method: 'pkg-config')
+                         method: 'pkg-config', include_type: 'system')
 else
   if get_option('sdl_image').enabled()
     error('sdl-image required, but SDL was @0@'.format(
@@ -1649,7 +1649,7 @@ glusterfs_iocb_has_stat = false
 if not get_option('glusterfs').auto() or have_block
   glusterfs = dependency('glusterfs-api', version: '>=3',
                          required: get_option('glusterfs'),
-                         method: 'pkg-config')
+                         method: 'pkg-config', include_type: 'system')
   if glusterfs.found()
     glusterfs_ftruncate_has_stat = cc.links('''
       #include <glusterfs/api/glfs.h>
@@ -1707,7 +1707,7 @@ endif
 libssh = not_found
 if not get_option('libssh').auto() or have_block
   libssh = dependency('libssh', version: '>=0.8.7',
-                    method: 'pkg-config',
+                    method: 'pkg-config', include_type: 'system',
                     required: get_option('libssh'))
 endif
 
@@ -1775,12 +1775,12 @@ endif
 coreaudio = not_found
 if not get_option('coreaudio').auto() or (host_os == 'darwin' and have_system)
   coreaudio = dependency('appleframeworks', modules: 'CoreAudio',
-                         required: get_option('coreaudio'))
+                         required: get_option('coreaudio'), include_type: 'system')
 endif
 
 opengl = not_found
 if not get_option('opengl').auto() or have_system or have_vhost_user_gpu
-  epoxy = dependency('epoxy', method: 'pkg-config',
+  epoxy = dependency('epoxy', method: 'pkg-config', include_type: 'system',
                       required: get_option('opengl'))
   if cc.has_header('epoxy/egl.h', dependencies: epoxy)
     opengl = epoxy
@@ -1790,14 +1790,14 @@ if not get_option('opengl').auto() or have_system or have_vhost_user_gpu
 endif
 gbm = not_found
 if (have_system or have_tools) and (virgl.found() or opengl.found())
-  gbm = dependency('gbm', method: 'pkg-config', required: false)
+  gbm = dependency('gbm', method: 'pkg-config', include_type: 'system', required: false)
 endif
 have_vhost_user_gpu = have_vhost_user_gpu and virgl.found() and opengl.found() and gbm.found()
 
 libcbor = not_found
 if not get_option('libcbor').auto() or have_system
   libcbor = dependency('libcbor', version: '>=0.7.0',
-                       required: get_option('libcbor'))
+                       required: get_option('libcbor'), include_type: 'system')
 endif
 
 gnutls = not_found
@@ -1817,14 +1817,14 @@ if get_option('gnutls').enabled() or (get_option('gnutls').auto() and have_syste
   # still use a different crypto backend to satisfy
   # the platform support requirements
   gnutls_crypto = dependency('gnutls', version: '>=3.6.14',
-                             method: 'pkg-config',
+                             method: 'pkg-config', include_type: 'system',
                              required: false)
   if gnutls_crypto.found()
     gnutls = gnutls_crypto
   else
     # Our min version if all we need is TLS
     gnutls = dependency('gnutls', version: '>=3.5.18',
-                        method: 'pkg-config',
+                        method: 'pkg-config', include_type: 'system',
                         required: get_option('gnutls'))
   endif
 endif
@@ -1853,7 +1853,7 @@ endif
 if not gnutls_crypto.found()
   if (not get_option('gcrypt').auto() or have_system) and not get_option('nettle').enabled()
     gcrypt = dependency('libgcrypt', version: '>=1.8',
-                        required: get_option('gcrypt'))
+                        required: get_option('gcrypt'), include_type: 'system')
     # Debian has removed -lgpg-error from libgcrypt-config
     # as it "spreads unnecessary dependencies" which in
     # turn breaks static builds...
@@ -1888,7 +1888,7 @@ if not gnutls_crypto.found()
   endif
   if (not get_option('nettle').auto() or have_system) and not gcrypt.found()
     nettle = dependency('nettle', version: '>=3.4',
-                        method: 'pkg-config',
+                        method: 'pkg-config', include_type: 'system',
                         required: get_option('nettle'))
     if nettle.found() and not cc.has_header('nettle/xts.h', dependencies: nettle)
       xts = 'private'
@@ -1936,7 +1936,7 @@ endif
 capstone = not_found
 if not get_option('capstone').auto() or have_system or have_user
   capstone = dependency('capstone', version: '>=3.0.5',
-                        method: 'pkg-config',
+                        method: 'pkg-config', include_type: 'system',
                         required: get_option('capstone'))
 
   # Some versions of capstone have broken pkg-config file
@@ -1952,10 +1952,10 @@ if not get_option('capstone').auto() or have_system or have_user
   endif
 endif
 
-gmp = dependency('gmp', required: false, method: 'pkg-config')
+gmp = dependency('gmp', required: false, method: 'pkg-config', include_type: 'system')
 if nettle.found() and gmp.found()
   hogweed = dependency('hogweed', version: '>=3.4',
-                       method: 'pkg-config',
+                       method: 'pkg-config', include_type: 'system',
                        required: get_option('nettle'))
 endif
 
@@ -1971,18 +1971,18 @@ if get_option('gtk') \
                       error_message: 'cannot enable GTK if pixman is not available') \
              .allowed()
   gtk = dependency('gtk+-3.0', version: '>=3.22.0',
-                   method: 'pkg-config',
+                   method: 'pkg-config', include_type: 'system',
                    required: get_option('gtk'))
   if gtk.found()
     gtkx11 = dependency('gtk+-x11-3.0', version: '>=3.22.0',
-                        method: 'pkg-config',
+                        method: 'pkg-config', include_type: 'system',
                         required: false)
     gtk = declare_dependency(dependencies: [gtk, gtkx11],
                              version: gtk.version())
 
     if not get_option('vte').auto() or have_system
       vte = dependency('vte-2.91',
-                       method: 'pkg-config',
+                       method: 'pkg-config', include_type: 'system',
                        required: get_option('vte'))
     endif
   elif have_gtk_clipboard
@@ -1992,12 +1992,12 @@ endif
 
 x11 = not_found
 if gtkx11.found()
-  x11 = dependency('x11', method: 'pkg-config', required: gtkx11.found())
+  x11 = dependency('x11', method: 'pkg-config', include_type: 'system', required: gtkx11.found())
 endif
 png = not_found
 if get_option('png').allowed() and have_system
    png = dependency('libpng', version: '>=1.6.34', required: get_option('png'),
-                    method: 'pkg-config')
+                    method: 'pkg-config', include_type: 'system')
 endif
 vnc = not_found
 jpeg = not_found
@@ -2009,7 +2009,7 @@ if get_option('vnc') \
              .allowed()
   vnc = declare_dependency() # dummy dependency
   jpeg = dependency('libjpeg', required: get_option('vnc_jpeg'),
-                    method: 'pkg-config')
+                    method: 'pkg-config', include_type: 'system')
   sasl = cc.find_library('sasl2', has_headers: ['sasl/sasl.h'],
                          required: get_option('vnc_sasl'))
   if sasl.found()
@@ -2135,49 +2135,49 @@ endif
 cacard = not_found
 if not get_option('smartcard').auto() or have_system
   cacard = dependency('libcacard', required: get_option('smartcard'),
-                      version: '>=2.5.1', method: 'pkg-config')
+                      version: '>=2.5.1', method: 'pkg-config', include_type: 'system')
 endif
 u2f = not_found
 if not get_option('u2f').auto() or have_system
   u2f = dependency('u2f-emu', required: get_option('u2f'),
-                   method: 'pkg-config')
+                   method: 'pkg-config', include_type: 'system')
 endif
 canokey = not_found
 if not get_option('canokey').auto() or have_system
   canokey = dependency('canokey-qemu', required: get_option('canokey'),
-                   method: 'pkg-config')
+                   method: 'pkg-config', include_type: 'system')
 endif
 usbredir = not_found
 if not get_option('usb_redir').auto() or have_system
   usbredir = dependency('libusbredirparser-0.5', required: get_option('usb_redir'),
-                        version: '>=0.6', method: 'pkg-config')
+                        version: '>=0.6', method: 'pkg-config', include_type: 'system')
 endif
 libusb = not_found
 if not get_option('libusb').auto() or have_system
   libusb = dependency('libusb-1.0', required: get_option('libusb'),
-                      version: '>=1.0.13', method: 'pkg-config')
+                      version: '>=1.0.13', method: 'pkg-config', include_type: 'system')
 endif
 
 libpmem = not_found
 if not get_option('libpmem').auto() or have_system
   libpmem = dependency('libpmem', required: get_option('libpmem'),
-                       method: 'pkg-config')
+                       method: 'pkg-config', include_type: 'system')
 endif
 libdaxctl = not_found
 if not get_option('libdaxctl').auto() or have_system
   libdaxctl = dependency('libdaxctl', required: get_option('libdaxctl'),
-                         version: '>=57', method: 'pkg-config')
+                         version: '>=57', method: 'pkg-config', include_type: 'system')
 endif
 tasn1 = not_found
 if gnutls.found()
   tasn1 = dependency('libtasn1',
                      required: false,
-                     method: 'pkg-config')
+                     method: 'pkg-config', include_type: 'system')
 endif
 keyutils = not_found
 if not get_option('libkeyutils').auto() or have_block
   keyutils = dependency('libkeyutils', required: get_option('libkeyutils'),
-                        method: 'pkg-config')
+                        method: 'pkg-config', include_type: 'system')
 endif
 
 has_gettid = cc.has_function('gettid')
@@ -2185,7 +2185,7 @@ has_gettid = cc.has_function('gettid')
 # libselinux
 selinux = dependency('libselinux',
                      required: get_option('selinux'),
-                     method: 'pkg-config')
+                     method: 'pkg-config', include_type: 'system')
 
 # Malloc tests
 
@@ -2237,7 +2237,7 @@ if get_option('fuse').disabled() and get_option('fuse_lseek').enabled()
 endif
 
 fuse = dependency('fuse3', required: get_option('fuse'),
-                  version: '>=3.1', method: 'pkg-config')
+                  version: '>=3.1', method: 'pkg-config', include_type: 'system')
 
 fuse_lseek = not_found
 if get_option('fuse_lseek').allowed()
@@ -2275,7 +2275,7 @@ endif
 
 # libbpf
 bpf_version = '1.1.0'
-libbpf = dependency('libbpf', version: '>=' + bpf_version, required: get_option('bpf'), method: 'pkg-config')
+libbpf = dependency('libbpf', version: '>=' + bpf_version, required: get_option('bpf'), method: 'pkg-config', include_type: 'system')
 if libbpf.found() and not cc.links('''
    #include <bpf/libbpf.h>
    #include <linux/bpf.h>
@@ -2299,7 +2299,7 @@ libxdp = not_found
 if not get_option('af_xdp').auto() or have_system
     if libbpf.found()
         libxdp = dependency('libxdp', required: get_option('af_xdp'),
-                            version: '>=1.4.0', method: 'pkg-config')
+                            version: '>=1.4.0', method: 'pkg-config', include_type: 'system')
     else
         if get_option('af_xdp').enabled()
             error('libxdp requested, but libbpf is not available')
@@ -2312,7 +2312,7 @@ libdw = not_found
 if not get_option('libdw').auto() or \
         (not get_option('prefer_static') and (have_system or have_user))
     libdw = dependency('libdw',
-                       method: 'pkg-config',
+                       method: 'pkg-config', include_type: 'system',
                        required: get_option('libdw'))
 endif
 
-- 
2.50.0



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] meson: Add most 3rd-party includes as system includes
  2025-06-17 20:34 [PATCH] meson: Add most 3rd-party includes as system includes Bernhard Beschow
@ 2025-07-03  6:25 ` Bernhard Beschow
  2025-07-10 17:54   ` Bernhard Beschow
  2025-07-11 10:26 ` Philippe Mathieu-Daudé
  2025-07-11 10:45 ` Peter Maydell
  2 siblings, 1 reply; 10+ messages in thread
From: Bernhard Beschow @ 2025-07-03  6:25 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Daniel P. Berrangé,
	Philippe Mathieu-Daudé, Marc-André Lureau



Am 17. Juni 2025 20:34:35 UTC schrieb Bernhard Beschow <shentey@gmail.com>:
>When compiling QEMU against fuse3-3.17.1 with --enable-werror the build fails
>with:
>
>  In file included from ../src/block/export/fuse.c:33:
>  /usr/include/fuse3/fuse.h:959:5: error: redundant redeclaration of ‘fuse_main_real_versioned’ [-Werror=redundant-decls]
>    959 | int fuse_main_real_versioned(int argc, char *argv[],
>        |     ^~~~~~~~~~~~~~~~~~~~~~~~
>  /usr/include/fuse3/fuse.h:885:5: note: previous declaration of ‘fuse_main_real_versioned’ with type ‘int(int,  char **, const struct fuse_operations *, size_t,  struct libfuse_version *, void *)’ {aka ‘int(int,  char **, const struct fuse_operations *, long unsigned int,  struct libfuse_version *, void *)’}
>    885 | int fuse_main_real_versioned(int argc, char *argv[],
>        |     ^~~~~~~~~~~~~~~~~~~~~~~~
>  cc1: all warnings being treated as errors
>
>That is, a fuse header triggers a warning within itself. Since QEMU adds the
>fuse3 include path via `-I`, the compiler thinks that the header is part of the
>QEMU project, and thus raises a warning. The compiler can be told to ignore
>warnings within 3rd party headers by adding these paths via `-isystem`. Fix the
>above build failure by marking fuse as system dependency. While at it mark
>every 3rd-party dependency as system dependency to prevent similar issues in the
>future but skip glib since that results in glib include paths to be omitted from
>bindgen in case of a Rust build.
>
>Signed-off-by: Bernhard Beschow <shentey@gmail.com>

Ping

>---
> meson.build | 160 ++++++++++++++++++++++++++--------------------------
> 1 file changed, 80 insertions(+), 80 deletions(-)
>
>diff --git a/meson.build b/meson.build
>index 34729c2a3d..694cf95f6f 100644
>--- a/meson.build
>+++ b/meson.build
>@@ -826,7 +826,7 @@ endif
> #####################################
> 
> libm = cc.find_library('m', required: false)
>-threads = dependency('threads')
>+threads = dependency('threads', include_type: 'system')
> util = cc.find_library('util', required: false)
> winmm = []
> socket = []
>@@ -859,11 +859,11 @@ if host_os == 'windows'
>                                       include_directories: include_directories('.'))
>   host_dsosuf = '.dll'
> elif host_os == 'darwin'
>-  coref = dependency('appleframeworks', modules: 'CoreFoundation')
>-  iokit = dependency('appleframeworks', modules: 'IOKit', required: false)
>+  coref = dependency('appleframeworks', modules: 'CoreFoundation', include_type: 'system')
>+  iokit = dependency('appleframeworks', modules: 'IOKit', required: false, include_type: 'system')
>   host_dsosuf = '.dylib'
>   pvg = dependency('appleframeworks', modules: ['ParavirtualizedGraphics', 'Metal'],
>-                   required: get_option('pvg'))
>+                   required: get_option('pvg'), include_type: 'system')
> elif host_os == 'sunos'
>   socket = [cc.find_library('socket'),
>             cc.find_library('nsl'),
>@@ -899,7 +899,7 @@ endif
> hvf = not_found
> if get_option('hvf').allowed()
>   hvf = dependency('appleframeworks', modules: 'Hypervisor',
>-                   required: get_option('hvf'))
>+                   required: get_option('hvf'), include_type: 'system')
>   if hvf.found()
>     accelerators += 'CONFIG_HVF'
>   endif
>@@ -960,30 +960,30 @@ endif
> xen = not_found
> if get_option('xen').enabled() or (get_option('xen').auto() and have_system)
>   xencontrol = dependency('xencontrol', required: false,
>-                          method: 'pkg-config')
>+                          method: 'pkg-config', include_type: 'system')
>   if xencontrol.found()
>     xen_pc = declare_dependency(version: xencontrol.version(),
>       dependencies: [
>         xencontrol,
>         # disabler: true makes xen_pc.found() return false if any is not found
>         dependency('xenstore', required: false,
>-                   method: 'pkg-config',
>+                   method: 'pkg-config', include_type: 'system',
>                    disabler: true),
>         dependency('xenforeignmemory', required: false,
>-                   method: 'pkg-config',
>+                   method: 'pkg-config', include_type: 'system',
>                    disabler: true),
>         dependency('xengnttab', required: false,
>-                   method: 'pkg-config',
>+                   method: 'pkg-config', include_type: 'system',
>                    disabler: true),
>         dependency('xenevtchn', required: false,
>-                   method: 'pkg-config',
>+                   method: 'pkg-config', include_type: 'system',
>                    disabler: true),
>         dependency('xendevicemodel', required: false,
>-                   method: 'pkg-config',
>+                   method: 'pkg-config', include_type: 'system',
>                    disabler: true),
>         # optional, no "disabler: true"
>         dependency('xentoolcore', required: false,
>-                   method: 'pkg-config')])
>+                   method: 'pkg-config', include_type: 'system')])
>     if xen_pc.found()
>       xen = xen_pc
>     endif
>@@ -1050,10 +1050,10 @@ glib_pc = dependency('glib-2.0', version: glib_req_ver, required: true,
> glib_cflags = []
> if enable_modules
>   gmodule = dependency('gmodule-export-2.0', version: glib_req_ver, required: true,
>-                       method: 'pkg-config')
>+                       method: 'pkg-config', include_type: 'system')
> elif get_option('plugins')
>   gmodule = dependency('gmodule-no-export-2.0', version: glib_req_ver, required: true,
>-                       method: 'pkg-config')
>+                       method: 'pkg-config', include_type: 'system')
> else
>   gmodule = not_found
> endif
>@@ -1109,7 +1109,7 @@ gdbus_codegen = not_found
> gdbus_codegen_error = '@0@ requires gdbus-codegen, please install libgio'
> if not get_option('gio').auto() or have_system
>   gio = dependency('gio-2.0', required: get_option('gio'),
>-                   method: 'pkg-config')
>+                   method: 'pkg-config', include_type: 'system')
>   if gio.found() and not cc.links('''
>     #include <gio/gio.h>
>     int main(void)
>@@ -1126,7 +1126,7 @@ if not get_option('gio').auto() or have_system
>     gdbus_codegen = find_program('gdbus-codegen',
>                                  required: get_option('gio'))
>     gio_unix = dependency('gio-unix-2.0', required: get_option('gio'),
>-                          method: 'pkg-config')
>+                          method: 'pkg-config', include_type: 'system')
>     gio = declare_dependency(dependencies: [gio, gio_unix],
>                              version: gio.version())
>   endif
>@@ -1141,15 +1141,15 @@ xml_pp = find_program('scripts/xml-preprocess.py')
> lttng = not_found
> if 'ust' in get_option('trace_backends')
>   lttng = dependency('lttng-ust', required: true, version: '>= 2.1',
>-                     method: 'pkg-config')
>+                     method: 'pkg-config', include_type: 'system')
> endif
> pixman = not_found
> if not get_option('pixman').auto() or have_system or have_tools
>   pixman = dependency('pixman-1', required: get_option('pixman'), version:'>=0.21.8',
>-                      method: 'pkg-config')
>+                      method: 'pkg-config', include_type: 'system')
> endif
> 
>-zlib = dependency('zlib', required: true)
>+zlib = dependency('zlib', required: true, include_type: 'system')
> 
> libaio = not_found
> if not get_option('linux_aio').auto() or have_block
>@@ -1167,7 +1167,7 @@ linux_io_uring = not_found
> if not get_option('linux_io_uring').auto() or have_block
>   linux_io_uring = dependency('liburing', version: '>=0.3',
>                               required: get_option('linux_io_uring'),
>-                              method: 'pkg-config')
>+                              method: 'pkg-config', include_type: 'system')
>   if not cc.links(linux_io_uring_test)
>     linux_io_uring = not_found
>   endif
>@@ -1177,7 +1177,7 @@ libnfs = not_found
> if not get_option('libnfs').auto() or have_block
>   libnfs = dependency('libnfs', version: ['>=1.9.3', '<6.0.0'],
>                       required: get_option('libnfs'),
>-                      method: 'pkg-config')
>+                      method: 'pkg-config', include_type: 'system')
> endif
> 
> libattr_test = '''
>@@ -1214,9 +1214,9 @@ endif
> 
> cocoa = dependency('appleframeworks',
>                    modules: ['Cocoa', 'CoreVideo', 'QuartzCore'],
>-                   required: get_option('cocoa'))
>+                   required: get_option('cocoa'), include_type: 'system')
> 
>-vmnet = dependency('appleframeworks', modules: 'vmnet', required: get_option('vmnet'))
>+vmnet = dependency('appleframeworks', modules: 'vmnet', required: get_option('vmnet'), include_type: 'system')
> if vmnet.found() and not cc.has_header_symbol('vmnet/vmnet.h',
>                                               'VMNET_BRIDGED_MODE',
>                                               dependencies: vmnet)
>@@ -1233,7 +1233,7 @@ seccomp_has_sysrawrc = false
> if not get_option('seccomp').auto() or have_system or have_tools
>   seccomp = dependency('libseccomp', version: '>=2.3.0',
>                        required: get_option('seccomp'),
>-                       method: 'pkg-config')
>+                       method: 'pkg-config', include_type: 'system')
>   if seccomp.found()
>     seccomp_has_sysrawrc = cc.has_header_symbol('seccomp.h',
>                                                 'SCMP_FLTATR_API_SYSRAWRC',
>@@ -1265,13 +1265,13 @@ if get_option('xkbcommon').auto() and not have_system and not have_tools
>   xkbcommon = not_found
> else
>   xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'),
>-                         method: 'pkg-config')
>+                         method: 'pkg-config', include_type: 'system')
> endif
> 
> slirp = not_found
> if not get_option('slirp').auto() or have_system
>   slirp = dependency('slirp', required: get_option('slirp'),
>-                     method: 'pkg-config')
>+                     method: 'pkg-config', include_type: 'system')
>   # slirp < 4.7 is incompatible with CFI support in QEMU.  This is because
>   # it passes function pointers within libslirp as callbacks for timers.
>   # When using a system-wide shared libslirp, the type information for the
>@@ -1313,35 +1313,35 @@ endif
> pulse = not_found
> if not get_option('pa').auto() or (host_os == 'linux' and have_system)
>   pulse = dependency('libpulse', required: get_option('pa'),
>-                     method: 'pkg-config')
>+                     method: 'pkg-config', include_type: 'system')
> endif
> alsa = not_found
> if not get_option('alsa').auto() or (host_os == 'linux' and have_system)
>   alsa = dependency('alsa', required: get_option('alsa'),
>-                    method: 'pkg-config')
>+                    method: 'pkg-config', include_type: 'system')
> endif
> jack = not_found
> if not get_option('jack').auto() or have_system
>   jack = dependency('jack', required: get_option('jack'),
>-                    method: 'pkg-config')
>+                    method: 'pkg-config', include_type: 'system')
> endif
> pipewire = not_found
> if not get_option('pipewire').auto() or (host_os == 'linux' and have_system)
>   pipewire = dependency('libpipewire-0.3', version: '>=0.3.60',
>                     required: get_option('pipewire'),
>-                    method: 'pkg-config')
>+                    method: 'pkg-config', include_type: 'system')
> endif
> sndio = not_found
> if not get_option('sndio').auto() or have_system
>   sndio = dependency('sndio', required: get_option('sndio'),
>-                    method: 'pkg-config')
>+                    method: 'pkg-config', include_type: 'system')
> endif
> 
> spice_protocol = not_found
> if not get_option('spice_protocol').auto() or have_system
>   spice_protocol = dependency('spice-protocol', version: '>=0.14.0',
>                               required: get_option('spice_protocol'),
>-                              method: 'pkg-config')
>+                              method: 'pkg-config', include_type: 'system')
> endif
> spice = not_found
> if get_option('spice') \
>@@ -1351,7 +1351,7 @@ if get_option('spice') \
>              .allowed()
>   spice = dependency('spice-server', version: '>=0.14.0',
>                      required: get_option('spice'),
>-                     method: 'pkg-config')
>+                     method: 'pkg-config', include_type: 'system')
> endif
> spice_headers = spice.partial_dependency(compile_args: true, includes: true)
> 
>@@ -1361,28 +1361,28 @@ libiscsi = not_found
> if not get_option('libiscsi').auto() or have_block
>   libiscsi = dependency('libiscsi', version: '>=1.9.0',
>                          required: get_option('libiscsi'),
>-                         method: 'pkg-config')
>+                         method: 'pkg-config', include_type: 'system')
> endif
> zstd = not_found
> if not get_option('zstd').auto() or have_block
>   zstd = dependency('libzstd', version: '>=1.4.0',
>                     required: get_option('zstd'),
>-                    method: 'pkg-config')
>+                    method: 'pkg-config', include_type: 'system')
> endif
> qpl = not_found
> if not get_option('qpl').auto() or have_system
>   qpl = dependency('qpl', version: '>=1.5.0',
>                     required: get_option('qpl'),
>-                    method: 'pkg-config')
>+                    method: 'pkg-config', include_type: 'system')
> endif
> uadk = not_found
> if not get_option('uadk').auto() or have_system
>   libwd = dependency('libwd', version: '>=2.6',
>                       required: get_option('uadk'),
>-                      method: 'pkg-config')
>+                      method: 'pkg-config', include_type: 'system')
>   libwd_comp = dependency('libwd_comp', version: '>=2.6',
>                            required: get_option('uadk'),
>-                           method: 'pkg-config')
>+                           method: 'pkg-config', include_type: 'system')
>   if libwd.found() and libwd_comp.found()
>      uadk = declare_dependency(dependencies: [libwd, libwd_comp])
>   endif
>@@ -1392,7 +1392,7 @@ qatzip = not_found
> if not get_option('qatzip').auto() or have_system
>   qatzip = dependency('qatzip', version: '>=1.1.2',
>                       required: get_option('qatzip'),
>-                      method: 'pkg-config')
>+                      method: 'pkg-config', include_type: 'system')
> endif
> 
> virgl = not_found
>@@ -1400,31 +1400,31 @@ virgl = not_found
> have_vhost_user_gpu = have_tools and host_os == 'linux' and pixman.found()
> if not get_option('virglrenderer').auto() or have_system or have_vhost_user_gpu
>   virgl = dependency('virglrenderer',
>-                     method: 'pkg-config',
>+                     method: 'pkg-config', include_type: 'system',
>                      required: get_option('virglrenderer'))
> endif
> rutabaga = not_found
> if not get_option('rutabaga_gfx').auto() or have_system or have_vhost_user_gpu
>   rutabaga = dependency('rutabaga_gfx_ffi',
>-                         method: 'pkg-config',
>+                         method: 'pkg-config', include_type: 'system',
>                          required: get_option('rutabaga_gfx'))
> endif
> blkio = not_found
> if not get_option('blkio').auto() or have_block
>   blkio = dependency('blkio',
>-                     method: 'pkg-config',
>+                     method: 'pkg-config', include_type: 'system',
>                      required: get_option('blkio'))
> endif
> curl = not_found
> if not get_option('curl').auto() or have_block
>   curl = dependency('libcurl', version: '>=7.29.0',
>-                    method: 'pkg-config',
>+                    method: 'pkg-config', include_type: 'system',
>                     required: get_option('curl'))
> endif
> libudev = not_found
> if host_os == 'linux' and (have_system or have_tools)
>   libudev = dependency('libudev',
>-                       method: 'pkg-config',
>+                       method: 'pkg-config', include_type: 'system',
>                        required: get_option('libudev'))
> endif
> 
>@@ -1504,7 +1504,7 @@ if have_system and get_option('curses').allowed()
>   curses_dep_list = host_os == 'windows' ? ['ncurses', 'ncursesw'] : ['ncursesw']
>   curses = dependency(curses_dep_list,
>                       required: false,
>-                      method: 'pkg-config')
>+                      method: 'pkg-config', include_type: 'system')
>   msg = get_option('curses').enabled() ? 'curses library not found' : ''
>   curses_compile_args = ['-DNCURSES_WIDECHAR=1']
>   if curses.found()
>@@ -1593,7 +1593,7 @@ endif
> 
> sdl = not_found
> if not get_option('sdl').auto() or have_system
>-  sdl = dependency('sdl2', required: get_option('sdl'))
>+  sdl = dependency('sdl2', required: get_option('sdl'), include_type: 'system')
>   sdl_image = not_found
> endif
> if sdl.found()
>@@ -1608,7 +1608,7 @@ if sdl.found()
>                              version: sdl.version())
>   endif
>   sdl_image = dependency('SDL2_image', required: get_option('sdl_image'),
>-                         method: 'pkg-config')
>+                         method: 'pkg-config', include_type: 'system')
> else
>   if get_option('sdl_image').enabled()
>     error('sdl-image required, but SDL was @0@'.format(
>@@ -1649,7 +1649,7 @@ glusterfs_iocb_has_stat = false
> if not get_option('glusterfs').auto() or have_block
>   glusterfs = dependency('glusterfs-api', version: '>=3',
>                          required: get_option('glusterfs'),
>-                         method: 'pkg-config')
>+                         method: 'pkg-config', include_type: 'system')
>   if glusterfs.found()
>     glusterfs_ftruncate_has_stat = cc.links('''
>       #include <glusterfs/api/glfs.h>
>@@ -1707,7 +1707,7 @@ endif
> libssh = not_found
> if not get_option('libssh').auto() or have_block
>   libssh = dependency('libssh', version: '>=0.8.7',
>-                    method: 'pkg-config',
>+                    method: 'pkg-config', include_type: 'system',
>                     required: get_option('libssh'))
> endif
> 
>@@ -1775,12 +1775,12 @@ endif
> coreaudio = not_found
> if not get_option('coreaudio').auto() or (host_os == 'darwin' and have_system)
>   coreaudio = dependency('appleframeworks', modules: 'CoreAudio',
>-                         required: get_option('coreaudio'))
>+                         required: get_option('coreaudio'), include_type: 'system')
> endif
> 
> opengl = not_found
> if not get_option('opengl').auto() or have_system or have_vhost_user_gpu
>-  epoxy = dependency('epoxy', method: 'pkg-config',
>+  epoxy = dependency('epoxy', method: 'pkg-config', include_type: 'system',
>                       required: get_option('opengl'))
>   if cc.has_header('epoxy/egl.h', dependencies: epoxy)
>     opengl = epoxy
>@@ -1790,14 +1790,14 @@ if not get_option('opengl').auto() or have_system or have_vhost_user_gpu
> endif
> gbm = not_found
> if (have_system or have_tools) and (virgl.found() or opengl.found())
>-  gbm = dependency('gbm', method: 'pkg-config', required: false)
>+  gbm = dependency('gbm', method: 'pkg-config', include_type: 'system', required: false)
> endif
> have_vhost_user_gpu = have_vhost_user_gpu and virgl.found() and opengl.found() and gbm.found()
> 
> libcbor = not_found
> if not get_option('libcbor').auto() or have_system
>   libcbor = dependency('libcbor', version: '>=0.7.0',
>-                       required: get_option('libcbor'))
>+                       required: get_option('libcbor'), include_type: 'system')
> endif
> 
> gnutls = not_found
>@@ -1817,14 +1817,14 @@ if get_option('gnutls').enabled() or (get_option('gnutls').auto() and have_syste
>   # still use a different crypto backend to satisfy
>   # the platform support requirements
>   gnutls_crypto = dependency('gnutls', version: '>=3.6.14',
>-                             method: 'pkg-config',
>+                             method: 'pkg-config', include_type: 'system',
>                              required: false)
>   if gnutls_crypto.found()
>     gnutls = gnutls_crypto
>   else
>     # Our min version if all we need is TLS
>     gnutls = dependency('gnutls', version: '>=3.5.18',
>-                        method: 'pkg-config',
>+                        method: 'pkg-config', include_type: 'system',
>                         required: get_option('gnutls'))
>   endif
> endif
>@@ -1853,7 +1853,7 @@ endif
> if not gnutls_crypto.found()
>   if (not get_option('gcrypt').auto() or have_system) and not get_option('nettle').enabled()
>     gcrypt = dependency('libgcrypt', version: '>=1.8',
>-                        required: get_option('gcrypt'))
>+                        required: get_option('gcrypt'), include_type: 'system')
>     # Debian has removed -lgpg-error from libgcrypt-config
>     # as it "spreads unnecessary dependencies" which in
>     # turn breaks static builds...
>@@ -1888,7 +1888,7 @@ if not gnutls_crypto.found()
>   endif
>   if (not get_option('nettle').auto() or have_system) and not gcrypt.found()
>     nettle = dependency('nettle', version: '>=3.4',
>-                        method: 'pkg-config',
>+                        method: 'pkg-config', include_type: 'system',
>                         required: get_option('nettle'))
>     if nettle.found() and not cc.has_header('nettle/xts.h', dependencies: nettle)
>       xts = 'private'
>@@ -1936,7 +1936,7 @@ endif
> capstone = not_found
> if not get_option('capstone').auto() or have_system or have_user
>   capstone = dependency('capstone', version: '>=3.0.5',
>-                        method: 'pkg-config',
>+                        method: 'pkg-config', include_type: 'system',
>                         required: get_option('capstone'))
> 
>   # Some versions of capstone have broken pkg-config file
>@@ -1952,10 +1952,10 @@ if not get_option('capstone').auto() or have_system or have_user
>   endif
> endif
> 
>-gmp = dependency('gmp', required: false, method: 'pkg-config')
>+gmp = dependency('gmp', required: false, method: 'pkg-config', include_type: 'system')
> if nettle.found() and gmp.found()
>   hogweed = dependency('hogweed', version: '>=3.4',
>-                       method: 'pkg-config',
>+                       method: 'pkg-config', include_type: 'system',
>                        required: get_option('nettle'))
> endif
> 
>@@ -1971,18 +1971,18 @@ if get_option('gtk') \
>                       error_message: 'cannot enable GTK if pixman is not available') \
>              .allowed()
>   gtk = dependency('gtk+-3.0', version: '>=3.22.0',
>-                   method: 'pkg-config',
>+                   method: 'pkg-config', include_type: 'system',
>                    required: get_option('gtk'))
>   if gtk.found()
>     gtkx11 = dependency('gtk+-x11-3.0', version: '>=3.22.0',
>-                        method: 'pkg-config',
>+                        method: 'pkg-config', include_type: 'system',
>                         required: false)
>     gtk = declare_dependency(dependencies: [gtk, gtkx11],
>                              version: gtk.version())
> 
>     if not get_option('vte').auto() or have_system
>       vte = dependency('vte-2.91',
>-                       method: 'pkg-config',
>+                       method: 'pkg-config', include_type: 'system',
>                        required: get_option('vte'))
>     endif
>   elif have_gtk_clipboard
>@@ -1992,12 +1992,12 @@ endif
> 
> x11 = not_found
> if gtkx11.found()
>-  x11 = dependency('x11', method: 'pkg-config', required: gtkx11.found())
>+  x11 = dependency('x11', method: 'pkg-config', include_type: 'system', required: gtkx11.found())
> endif
> png = not_found
> if get_option('png').allowed() and have_system
>    png = dependency('libpng', version: '>=1.6.34', required: get_option('png'),
>-                    method: 'pkg-config')
>+                    method: 'pkg-config', include_type: 'system')
> endif
> vnc = not_found
> jpeg = not_found
>@@ -2009,7 +2009,7 @@ if get_option('vnc') \
>              .allowed()
>   vnc = declare_dependency() # dummy dependency
>   jpeg = dependency('libjpeg', required: get_option('vnc_jpeg'),
>-                    method: 'pkg-config')
>+                    method: 'pkg-config', include_type: 'system')
>   sasl = cc.find_library('sasl2', has_headers: ['sasl/sasl.h'],
>                          required: get_option('vnc_sasl'))
>   if sasl.found()
>@@ -2135,49 +2135,49 @@ endif
> cacard = not_found
> if not get_option('smartcard').auto() or have_system
>   cacard = dependency('libcacard', required: get_option('smartcard'),
>-                      version: '>=2.5.1', method: 'pkg-config')
>+                      version: '>=2.5.1', method: 'pkg-config', include_type: 'system')
> endif
> u2f = not_found
> if not get_option('u2f').auto() or have_system
>   u2f = dependency('u2f-emu', required: get_option('u2f'),
>-                   method: 'pkg-config')
>+                   method: 'pkg-config', include_type: 'system')
> endif
> canokey = not_found
> if not get_option('canokey').auto() or have_system
>   canokey = dependency('canokey-qemu', required: get_option('canokey'),
>-                   method: 'pkg-config')
>+                   method: 'pkg-config', include_type: 'system')
> endif
> usbredir = not_found
> if not get_option('usb_redir').auto() or have_system
>   usbredir = dependency('libusbredirparser-0.5', required: get_option('usb_redir'),
>-                        version: '>=0.6', method: 'pkg-config')
>+                        version: '>=0.6', method: 'pkg-config', include_type: 'system')
> endif
> libusb = not_found
> if not get_option('libusb').auto() or have_system
>   libusb = dependency('libusb-1.0', required: get_option('libusb'),
>-                      version: '>=1.0.13', method: 'pkg-config')
>+                      version: '>=1.0.13', method: 'pkg-config', include_type: 'system')
> endif
> 
> libpmem = not_found
> if not get_option('libpmem').auto() or have_system
>   libpmem = dependency('libpmem', required: get_option('libpmem'),
>-                       method: 'pkg-config')
>+                       method: 'pkg-config', include_type: 'system')
> endif
> libdaxctl = not_found
> if not get_option('libdaxctl').auto() or have_system
>   libdaxctl = dependency('libdaxctl', required: get_option('libdaxctl'),
>-                         version: '>=57', method: 'pkg-config')
>+                         version: '>=57', method: 'pkg-config', include_type: 'system')
> endif
> tasn1 = not_found
> if gnutls.found()
>   tasn1 = dependency('libtasn1',
>                      required: false,
>-                     method: 'pkg-config')
>+                     method: 'pkg-config', include_type: 'system')
> endif
> keyutils = not_found
> if not get_option('libkeyutils').auto() or have_block
>   keyutils = dependency('libkeyutils', required: get_option('libkeyutils'),
>-                        method: 'pkg-config')
>+                        method: 'pkg-config', include_type: 'system')
> endif
> 
> has_gettid = cc.has_function('gettid')
>@@ -2185,7 +2185,7 @@ has_gettid = cc.has_function('gettid')
> # libselinux
> selinux = dependency('libselinux',
>                      required: get_option('selinux'),
>-                     method: 'pkg-config')
>+                     method: 'pkg-config', include_type: 'system')
> 
> # Malloc tests
> 
>@@ -2237,7 +2237,7 @@ if get_option('fuse').disabled() and get_option('fuse_lseek').enabled()
> endif
> 
> fuse = dependency('fuse3', required: get_option('fuse'),
>-                  version: '>=3.1', method: 'pkg-config')
>+                  version: '>=3.1', method: 'pkg-config', include_type: 'system')
> 
> fuse_lseek = not_found
> if get_option('fuse_lseek').allowed()
>@@ -2275,7 +2275,7 @@ endif
> 
> # libbpf
> bpf_version = '1.1.0'
>-libbpf = dependency('libbpf', version: '>=' + bpf_version, required: get_option('bpf'), method: 'pkg-config')
>+libbpf = dependency('libbpf', version: '>=' + bpf_version, required: get_option('bpf'), method: 'pkg-config', include_type: 'system')
> if libbpf.found() and not cc.links('''
>    #include <bpf/libbpf.h>
>    #include <linux/bpf.h>
>@@ -2299,7 +2299,7 @@ libxdp = not_found
> if not get_option('af_xdp').auto() or have_system
>     if libbpf.found()
>         libxdp = dependency('libxdp', required: get_option('af_xdp'),
>-                            version: '>=1.4.0', method: 'pkg-config')
>+                            version: '>=1.4.0', method: 'pkg-config', include_type: 'system')
>     else
>         if get_option('af_xdp').enabled()
>             error('libxdp requested, but libbpf is not available')
>@@ -2312,7 +2312,7 @@ libdw = not_found
> if not get_option('libdw').auto() or \
>         (not get_option('prefer_static') and (have_system or have_user))
>     libdw = dependency('libdw',
>-                       method: 'pkg-config',
>+                       method: 'pkg-config', include_type: 'system',
>                        required: get_option('libdw'))
> endif
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] meson: Add most 3rd-party includes as system includes
  2025-07-03  6:25 ` Bernhard Beschow
@ 2025-07-10 17:54   ` Bernhard Beschow
  0 siblings, 0 replies; 10+ messages in thread
From: Bernhard Beschow @ 2025-07-10 17:54 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Daniel P. Berrangé,
	Philippe Mathieu-Daudé, Marc-André Lureau



Am 3. Juli 2025 06:25:11 UTC schrieb Bernhard Beschow <shentey@gmail.com>:
>
>
>Am 17. Juni 2025 20:34:35 UTC schrieb Bernhard Beschow <shentey@gmail.com>:
>>When compiling QEMU against fuse3-3.17.1 with --enable-werror the build fails
>>with:
>>
>>  In file included from ../src/block/export/fuse.c:33:
>>  /usr/include/fuse3/fuse.h:959:5: error: redundant redeclaration of ‘fuse_main_real_versioned’ [-Werror=redundant-decls]
>>    959 | int fuse_main_real_versioned(int argc, char *argv[],
>>        |     ^~~~~~~~~~~~~~~~~~~~~~~~
>>  /usr/include/fuse3/fuse.h:885:5: note: previous declaration of ‘fuse_main_real_versioned’ with type ‘int(int,  char **, const struct fuse_operations *, size_t,  struct libfuse_version *, void *)’ {aka ‘int(int,  char **, const struct fuse_operations *, long unsigned int,  struct libfuse_version *, void *)’}
>>    885 | int fuse_main_real_versioned(int argc, char *argv[],
>>        |     ^~~~~~~~~~~~~~~~~~~~~~~~
>>  cc1: all warnings being treated as errors
>>
>>That is, a fuse header triggers a warning within itself. Since QEMU adds the
>>fuse3 include path via `-I`, the compiler thinks that the header is part of the
>>QEMU project, and thus raises a warning. The compiler can be told to ignore
>>warnings within 3rd party headers by adding these paths via `-isystem`. Fix the
>>above build failure by marking fuse as system dependency. While at it mark
>>every 3rd-party dependency as system dependency to prevent similar issues in the
>>future but skip glib since that results in glib include paths to be omitted from
>>bindgen in case of a Rust build.
>>
>>Signed-off-by: Bernhard Beschow <shentey@gmail.com>
>
>Ping

Ping^2

>
>>---
>> meson.build | 160 ++++++++++++++++++++++++++--------------------------
>> 1 file changed, 80 insertions(+), 80 deletions(-)
>>
>>diff --git a/meson.build b/meson.build
>>index 34729c2a3d..694cf95f6f 100644
>>--- a/meson.build
>>+++ b/meson.build
>>@@ -826,7 +826,7 @@ endif
>> #####################################
>> 
>> libm = cc.find_library('m', required: false)
>>-threads = dependency('threads')
>>+threads = dependency('threads', include_type: 'system')
>> util = cc.find_library('util', required: false)
>> winmm = []
>> socket = []
>>@@ -859,11 +859,11 @@ if host_os == 'windows'
>>                                       include_directories: include_directories('.'))
>>   host_dsosuf = '.dll'
>> elif host_os == 'darwin'
>>-  coref = dependency('appleframeworks', modules: 'CoreFoundation')
>>-  iokit = dependency('appleframeworks', modules: 'IOKit', required: false)
>>+  coref = dependency('appleframeworks', modules: 'CoreFoundation', include_type: 'system')
>>+  iokit = dependency('appleframeworks', modules: 'IOKit', required: false, include_type: 'system')
>>   host_dsosuf = '.dylib'
>>   pvg = dependency('appleframeworks', modules: ['ParavirtualizedGraphics', 'Metal'],
>>-                   required: get_option('pvg'))
>>+                   required: get_option('pvg'), include_type: 'system')
>> elif host_os == 'sunos'
>>   socket = [cc.find_library('socket'),
>>             cc.find_library('nsl'),
>>@@ -899,7 +899,7 @@ endif
>> hvf = not_found
>> if get_option('hvf').allowed()
>>   hvf = dependency('appleframeworks', modules: 'Hypervisor',
>>-                   required: get_option('hvf'))
>>+                   required: get_option('hvf'), include_type: 'system')
>>   if hvf.found()
>>     accelerators += 'CONFIG_HVF'
>>   endif
>>@@ -960,30 +960,30 @@ endif
>> xen = not_found
>> if get_option('xen').enabled() or (get_option('xen').auto() and have_system)
>>   xencontrol = dependency('xencontrol', required: false,
>>-                          method: 'pkg-config')
>>+                          method: 'pkg-config', include_type: 'system')
>>   if xencontrol.found()
>>     xen_pc = declare_dependency(version: xencontrol.version(),
>>       dependencies: [
>>         xencontrol,
>>         # disabler: true makes xen_pc.found() return false if any is not found
>>         dependency('xenstore', required: false,
>>-                   method: 'pkg-config',
>>+                   method: 'pkg-config', include_type: 'system',
>>                    disabler: true),
>>         dependency('xenforeignmemory', required: false,
>>-                   method: 'pkg-config',
>>+                   method: 'pkg-config', include_type: 'system',
>>                    disabler: true),
>>         dependency('xengnttab', required: false,
>>-                   method: 'pkg-config',
>>+                   method: 'pkg-config', include_type: 'system',
>>                    disabler: true),
>>         dependency('xenevtchn', required: false,
>>-                   method: 'pkg-config',
>>+                   method: 'pkg-config', include_type: 'system',
>>                    disabler: true),
>>         dependency('xendevicemodel', required: false,
>>-                   method: 'pkg-config',
>>+                   method: 'pkg-config', include_type: 'system',
>>                    disabler: true),
>>         # optional, no "disabler: true"
>>         dependency('xentoolcore', required: false,
>>-                   method: 'pkg-config')])
>>+                   method: 'pkg-config', include_type: 'system')])
>>     if xen_pc.found()
>>       xen = xen_pc
>>     endif
>>@@ -1050,10 +1050,10 @@ glib_pc = dependency('glib-2.0', version: glib_req_ver, required: true,
>> glib_cflags = []
>> if enable_modules
>>   gmodule = dependency('gmodule-export-2.0', version: glib_req_ver, required: true,
>>-                       method: 'pkg-config')
>>+                       method: 'pkg-config', include_type: 'system')
>> elif get_option('plugins')
>>   gmodule = dependency('gmodule-no-export-2.0', version: glib_req_ver, required: true,
>>-                       method: 'pkg-config')
>>+                       method: 'pkg-config', include_type: 'system')
>> else
>>   gmodule = not_found
>> endif
>>@@ -1109,7 +1109,7 @@ gdbus_codegen = not_found
>> gdbus_codegen_error = '@0@ requires gdbus-codegen, please install libgio'
>> if not get_option('gio').auto() or have_system
>>   gio = dependency('gio-2.0', required: get_option('gio'),
>>-                   method: 'pkg-config')
>>+                   method: 'pkg-config', include_type: 'system')
>>   if gio.found() and not cc.links('''
>>     #include <gio/gio.h>
>>     int main(void)
>>@@ -1126,7 +1126,7 @@ if not get_option('gio').auto() or have_system
>>     gdbus_codegen = find_program('gdbus-codegen',
>>                                  required: get_option('gio'))
>>     gio_unix = dependency('gio-unix-2.0', required: get_option('gio'),
>>-                          method: 'pkg-config')
>>+                          method: 'pkg-config', include_type: 'system')
>>     gio = declare_dependency(dependencies: [gio, gio_unix],
>>                              version: gio.version())
>>   endif
>>@@ -1141,15 +1141,15 @@ xml_pp = find_program('scripts/xml-preprocess.py')
>> lttng = not_found
>> if 'ust' in get_option('trace_backends')
>>   lttng = dependency('lttng-ust', required: true, version: '>= 2.1',
>>-                     method: 'pkg-config')
>>+                     method: 'pkg-config', include_type: 'system')
>> endif
>> pixman = not_found
>> if not get_option('pixman').auto() or have_system or have_tools
>>   pixman = dependency('pixman-1', required: get_option('pixman'), version:'>=0.21.8',
>>-                      method: 'pkg-config')
>>+                      method: 'pkg-config', include_type: 'system')
>> endif
>> 
>>-zlib = dependency('zlib', required: true)
>>+zlib = dependency('zlib', required: true, include_type: 'system')
>> 
>> libaio = not_found
>> if not get_option('linux_aio').auto() or have_block
>>@@ -1167,7 +1167,7 @@ linux_io_uring = not_found
>> if not get_option('linux_io_uring').auto() or have_block
>>   linux_io_uring = dependency('liburing', version: '>=0.3',
>>                               required: get_option('linux_io_uring'),
>>-                              method: 'pkg-config')
>>+                              method: 'pkg-config', include_type: 'system')
>>   if not cc.links(linux_io_uring_test)
>>     linux_io_uring = not_found
>>   endif
>>@@ -1177,7 +1177,7 @@ libnfs = not_found
>> if not get_option('libnfs').auto() or have_block
>>   libnfs = dependency('libnfs', version: ['>=1.9.3', '<6.0.0'],
>>                       required: get_option('libnfs'),
>>-                      method: 'pkg-config')
>>+                      method: 'pkg-config', include_type: 'system')
>> endif
>> 
>> libattr_test = '''
>>@@ -1214,9 +1214,9 @@ endif
>> 
>> cocoa = dependency('appleframeworks',
>>                    modules: ['Cocoa', 'CoreVideo', 'QuartzCore'],
>>-                   required: get_option('cocoa'))
>>+                   required: get_option('cocoa'), include_type: 'system')
>> 
>>-vmnet = dependency('appleframeworks', modules: 'vmnet', required: get_option('vmnet'))
>>+vmnet = dependency('appleframeworks', modules: 'vmnet', required: get_option('vmnet'), include_type: 'system')
>> if vmnet.found() and not cc.has_header_symbol('vmnet/vmnet.h',
>>                                               'VMNET_BRIDGED_MODE',
>>                                               dependencies: vmnet)
>>@@ -1233,7 +1233,7 @@ seccomp_has_sysrawrc = false
>> if not get_option('seccomp').auto() or have_system or have_tools
>>   seccomp = dependency('libseccomp', version: '>=2.3.0',
>>                        required: get_option('seccomp'),
>>-                       method: 'pkg-config')
>>+                       method: 'pkg-config', include_type: 'system')
>>   if seccomp.found()
>>     seccomp_has_sysrawrc = cc.has_header_symbol('seccomp.h',
>>                                                 'SCMP_FLTATR_API_SYSRAWRC',
>>@@ -1265,13 +1265,13 @@ if get_option('xkbcommon').auto() and not have_system and not have_tools
>>   xkbcommon = not_found
>> else
>>   xkbcommon = dependency('xkbcommon', required: get_option('xkbcommon'),
>>-                         method: 'pkg-config')
>>+                         method: 'pkg-config', include_type: 'system')
>> endif
>> 
>> slirp = not_found
>> if not get_option('slirp').auto() or have_system
>>   slirp = dependency('slirp', required: get_option('slirp'),
>>-                     method: 'pkg-config')
>>+                     method: 'pkg-config', include_type: 'system')
>>   # slirp < 4.7 is incompatible with CFI support in QEMU.  This is because
>>   # it passes function pointers within libslirp as callbacks for timers.
>>   # When using a system-wide shared libslirp, the type information for the
>>@@ -1313,35 +1313,35 @@ endif
>> pulse = not_found
>> if not get_option('pa').auto() or (host_os == 'linux' and have_system)
>>   pulse = dependency('libpulse', required: get_option('pa'),
>>-                     method: 'pkg-config')
>>+                     method: 'pkg-config', include_type: 'system')
>> endif
>> alsa = not_found
>> if not get_option('alsa').auto() or (host_os == 'linux' and have_system)
>>   alsa = dependency('alsa', required: get_option('alsa'),
>>-                    method: 'pkg-config')
>>+                    method: 'pkg-config', include_type: 'system')
>> endif
>> jack = not_found
>> if not get_option('jack').auto() or have_system
>>   jack = dependency('jack', required: get_option('jack'),
>>-                    method: 'pkg-config')
>>+                    method: 'pkg-config', include_type: 'system')
>> endif
>> pipewire = not_found
>> if not get_option('pipewire').auto() or (host_os == 'linux' and have_system)
>>   pipewire = dependency('libpipewire-0.3', version: '>=0.3.60',
>>                     required: get_option('pipewire'),
>>-                    method: 'pkg-config')
>>+                    method: 'pkg-config', include_type: 'system')
>> endif
>> sndio = not_found
>> if not get_option('sndio').auto() or have_system
>>   sndio = dependency('sndio', required: get_option('sndio'),
>>-                    method: 'pkg-config')
>>+                    method: 'pkg-config', include_type: 'system')
>> endif
>> 
>> spice_protocol = not_found
>> if not get_option('spice_protocol').auto() or have_system
>>   spice_protocol = dependency('spice-protocol', version: '>=0.14.0',
>>                               required: get_option('spice_protocol'),
>>-                              method: 'pkg-config')
>>+                              method: 'pkg-config', include_type: 'system')
>> endif
>> spice = not_found
>> if get_option('spice') \
>>@@ -1351,7 +1351,7 @@ if get_option('spice') \
>>              .allowed()
>>   spice = dependency('spice-server', version: '>=0.14.0',
>>                      required: get_option('spice'),
>>-                     method: 'pkg-config')
>>+                     method: 'pkg-config', include_type: 'system')
>> endif
>> spice_headers = spice.partial_dependency(compile_args: true, includes: true)
>> 
>>@@ -1361,28 +1361,28 @@ libiscsi = not_found
>> if not get_option('libiscsi').auto() or have_block
>>   libiscsi = dependency('libiscsi', version: '>=1.9.0',
>>                          required: get_option('libiscsi'),
>>-                         method: 'pkg-config')
>>+                         method: 'pkg-config', include_type: 'system')
>> endif
>> zstd = not_found
>> if not get_option('zstd').auto() or have_block
>>   zstd = dependency('libzstd', version: '>=1.4.0',
>>                     required: get_option('zstd'),
>>-                    method: 'pkg-config')
>>+                    method: 'pkg-config', include_type: 'system')
>> endif
>> qpl = not_found
>> if not get_option('qpl').auto() or have_system
>>   qpl = dependency('qpl', version: '>=1.5.0',
>>                     required: get_option('qpl'),
>>-                    method: 'pkg-config')
>>+                    method: 'pkg-config', include_type: 'system')
>> endif
>> uadk = not_found
>> if not get_option('uadk').auto() or have_system
>>   libwd = dependency('libwd', version: '>=2.6',
>>                       required: get_option('uadk'),
>>-                      method: 'pkg-config')
>>+                      method: 'pkg-config', include_type: 'system')
>>   libwd_comp = dependency('libwd_comp', version: '>=2.6',
>>                            required: get_option('uadk'),
>>-                           method: 'pkg-config')
>>+                           method: 'pkg-config', include_type: 'system')
>>   if libwd.found() and libwd_comp.found()
>>      uadk = declare_dependency(dependencies: [libwd, libwd_comp])
>>   endif
>>@@ -1392,7 +1392,7 @@ qatzip = not_found
>> if not get_option('qatzip').auto() or have_system
>>   qatzip = dependency('qatzip', version: '>=1.1.2',
>>                       required: get_option('qatzip'),
>>-                      method: 'pkg-config')
>>+                      method: 'pkg-config', include_type: 'system')
>> endif
>> 
>> virgl = not_found
>>@@ -1400,31 +1400,31 @@ virgl = not_found
>> have_vhost_user_gpu = have_tools and host_os == 'linux' and pixman.found()
>> if not get_option('virglrenderer').auto() or have_system or have_vhost_user_gpu
>>   virgl = dependency('virglrenderer',
>>-                     method: 'pkg-config',
>>+                     method: 'pkg-config', include_type: 'system',
>>                      required: get_option('virglrenderer'))
>> endif
>> rutabaga = not_found
>> if not get_option('rutabaga_gfx').auto() or have_system or have_vhost_user_gpu
>>   rutabaga = dependency('rutabaga_gfx_ffi',
>>-                         method: 'pkg-config',
>>+                         method: 'pkg-config', include_type: 'system',
>>                          required: get_option('rutabaga_gfx'))
>> endif
>> blkio = not_found
>> if not get_option('blkio').auto() or have_block
>>   blkio = dependency('blkio',
>>-                     method: 'pkg-config',
>>+                     method: 'pkg-config', include_type: 'system',
>>                      required: get_option('blkio'))
>> endif
>> curl = not_found
>> if not get_option('curl').auto() or have_block
>>   curl = dependency('libcurl', version: '>=7.29.0',
>>-                    method: 'pkg-config',
>>+                    method: 'pkg-config', include_type: 'system',
>>                     required: get_option('curl'))
>> endif
>> libudev = not_found
>> if host_os == 'linux' and (have_system or have_tools)
>>   libudev = dependency('libudev',
>>-                       method: 'pkg-config',
>>+                       method: 'pkg-config', include_type: 'system',
>>                        required: get_option('libudev'))
>> endif
>> 
>>@@ -1504,7 +1504,7 @@ if have_system and get_option('curses').allowed()
>>   curses_dep_list = host_os == 'windows' ? ['ncurses', 'ncursesw'] : ['ncursesw']
>>   curses = dependency(curses_dep_list,
>>                       required: false,
>>-                      method: 'pkg-config')
>>+                      method: 'pkg-config', include_type: 'system')
>>   msg = get_option('curses').enabled() ? 'curses library not found' : ''
>>   curses_compile_args = ['-DNCURSES_WIDECHAR=1']
>>   if curses.found()
>>@@ -1593,7 +1593,7 @@ endif
>> 
>> sdl = not_found
>> if not get_option('sdl').auto() or have_system
>>-  sdl = dependency('sdl2', required: get_option('sdl'))
>>+  sdl = dependency('sdl2', required: get_option('sdl'), include_type: 'system')
>>   sdl_image = not_found
>> endif
>> if sdl.found()
>>@@ -1608,7 +1608,7 @@ if sdl.found()
>>                              version: sdl.version())
>>   endif
>>   sdl_image = dependency('SDL2_image', required: get_option('sdl_image'),
>>-                         method: 'pkg-config')
>>+                         method: 'pkg-config', include_type: 'system')
>> else
>>   if get_option('sdl_image').enabled()
>>     error('sdl-image required, but SDL was @0@'.format(
>>@@ -1649,7 +1649,7 @@ glusterfs_iocb_has_stat = false
>> if not get_option('glusterfs').auto() or have_block
>>   glusterfs = dependency('glusterfs-api', version: '>=3',
>>                          required: get_option('glusterfs'),
>>-                         method: 'pkg-config')
>>+                         method: 'pkg-config', include_type: 'system')
>>   if glusterfs.found()
>>     glusterfs_ftruncate_has_stat = cc.links('''
>>       #include <glusterfs/api/glfs.h>
>>@@ -1707,7 +1707,7 @@ endif
>> libssh = not_found
>> if not get_option('libssh').auto() or have_block
>>   libssh = dependency('libssh', version: '>=0.8.7',
>>-                    method: 'pkg-config',
>>+                    method: 'pkg-config', include_type: 'system',
>>                     required: get_option('libssh'))
>> endif
>> 
>>@@ -1775,12 +1775,12 @@ endif
>> coreaudio = not_found
>> if not get_option('coreaudio').auto() or (host_os == 'darwin' and have_system)
>>   coreaudio = dependency('appleframeworks', modules: 'CoreAudio',
>>-                         required: get_option('coreaudio'))
>>+                         required: get_option('coreaudio'), include_type: 'system')
>> endif
>> 
>> opengl = not_found
>> if not get_option('opengl').auto() or have_system or have_vhost_user_gpu
>>-  epoxy = dependency('epoxy', method: 'pkg-config',
>>+  epoxy = dependency('epoxy', method: 'pkg-config', include_type: 'system',
>>                       required: get_option('opengl'))
>>   if cc.has_header('epoxy/egl.h', dependencies: epoxy)
>>     opengl = epoxy
>>@@ -1790,14 +1790,14 @@ if not get_option('opengl').auto() or have_system or have_vhost_user_gpu
>> endif
>> gbm = not_found
>> if (have_system or have_tools) and (virgl.found() or opengl.found())
>>-  gbm = dependency('gbm', method: 'pkg-config', required: false)
>>+  gbm = dependency('gbm', method: 'pkg-config', include_type: 'system', required: false)
>> endif
>> have_vhost_user_gpu = have_vhost_user_gpu and virgl.found() and opengl.found() and gbm.found()
>> 
>> libcbor = not_found
>> if not get_option('libcbor').auto() or have_system
>>   libcbor = dependency('libcbor', version: '>=0.7.0',
>>-                       required: get_option('libcbor'))
>>+                       required: get_option('libcbor'), include_type: 'system')
>> endif
>> 
>> gnutls = not_found
>>@@ -1817,14 +1817,14 @@ if get_option('gnutls').enabled() or (get_option('gnutls').auto() and have_syste
>>   # still use a different crypto backend to satisfy
>>   # the platform support requirements
>>   gnutls_crypto = dependency('gnutls', version: '>=3.6.14',
>>-                             method: 'pkg-config',
>>+                             method: 'pkg-config', include_type: 'system',
>>                              required: false)
>>   if gnutls_crypto.found()
>>     gnutls = gnutls_crypto
>>   else
>>     # Our min version if all we need is TLS
>>     gnutls = dependency('gnutls', version: '>=3.5.18',
>>-                        method: 'pkg-config',
>>+                        method: 'pkg-config', include_type: 'system',
>>                         required: get_option('gnutls'))
>>   endif
>> endif
>>@@ -1853,7 +1853,7 @@ endif
>> if not gnutls_crypto.found()
>>   if (not get_option('gcrypt').auto() or have_system) and not get_option('nettle').enabled()
>>     gcrypt = dependency('libgcrypt', version: '>=1.8',
>>-                        required: get_option('gcrypt'))
>>+                        required: get_option('gcrypt'), include_type: 'system')
>>     # Debian has removed -lgpg-error from libgcrypt-config
>>     # as it "spreads unnecessary dependencies" which in
>>     # turn breaks static builds...
>>@@ -1888,7 +1888,7 @@ if not gnutls_crypto.found()
>>   endif
>>   if (not get_option('nettle').auto() or have_system) and not gcrypt.found()
>>     nettle = dependency('nettle', version: '>=3.4',
>>-                        method: 'pkg-config',
>>+                        method: 'pkg-config', include_type: 'system',
>>                         required: get_option('nettle'))
>>     if nettle.found() and not cc.has_header('nettle/xts.h', dependencies: nettle)
>>       xts = 'private'
>>@@ -1936,7 +1936,7 @@ endif
>> capstone = not_found
>> if not get_option('capstone').auto() or have_system or have_user
>>   capstone = dependency('capstone', version: '>=3.0.5',
>>-                        method: 'pkg-config',
>>+                        method: 'pkg-config', include_type: 'system',
>>                         required: get_option('capstone'))
>> 
>>   # Some versions of capstone have broken pkg-config file
>>@@ -1952,10 +1952,10 @@ if not get_option('capstone').auto() or have_system or have_user
>>   endif
>> endif
>> 
>>-gmp = dependency('gmp', required: false, method: 'pkg-config')
>>+gmp = dependency('gmp', required: false, method: 'pkg-config', include_type: 'system')
>> if nettle.found() and gmp.found()
>>   hogweed = dependency('hogweed', version: '>=3.4',
>>-                       method: 'pkg-config',
>>+                       method: 'pkg-config', include_type: 'system',
>>                        required: get_option('nettle'))
>> endif
>> 
>>@@ -1971,18 +1971,18 @@ if get_option('gtk') \
>>                       error_message: 'cannot enable GTK if pixman is not available') \
>>              .allowed()
>>   gtk = dependency('gtk+-3.0', version: '>=3.22.0',
>>-                   method: 'pkg-config',
>>+                   method: 'pkg-config', include_type: 'system',
>>                    required: get_option('gtk'))
>>   if gtk.found()
>>     gtkx11 = dependency('gtk+-x11-3.0', version: '>=3.22.0',
>>-                        method: 'pkg-config',
>>+                        method: 'pkg-config', include_type: 'system',
>>                         required: false)
>>     gtk = declare_dependency(dependencies: [gtk, gtkx11],
>>                              version: gtk.version())
>> 
>>     if not get_option('vte').auto() or have_system
>>       vte = dependency('vte-2.91',
>>-                       method: 'pkg-config',
>>+                       method: 'pkg-config', include_type: 'system',
>>                        required: get_option('vte'))
>>     endif
>>   elif have_gtk_clipboard
>>@@ -1992,12 +1992,12 @@ endif
>> 
>> x11 = not_found
>> if gtkx11.found()
>>-  x11 = dependency('x11', method: 'pkg-config', required: gtkx11.found())
>>+  x11 = dependency('x11', method: 'pkg-config', include_type: 'system', required: gtkx11.found())
>> endif
>> png = not_found
>> if get_option('png').allowed() and have_system
>>    png = dependency('libpng', version: '>=1.6.34', required: get_option('png'),
>>-                    method: 'pkg-config')
>>+                    method: 'pkg-config', include_type: 'system')
>> endif
>> vnc = not_found
>> jpeg = not_found
>>@@ -2009,7 +2009,7 @@ if get_option('vnc') \
>>              .allowed()
>>   vnc = declare_dependency() # dummy dependency
>>   jpeg = dependency('libjpeg', required: get_option('vnc_jpeg'),
>>-                    method: 'pkg-config')
>>+                    method: 'pkg-config', include_type: 'system')
>>   sasl = cc.find_library('sasl2', has_headers: ['sasl/sasl.h'],
>>                          required: get_option('vnc_sasl'))
>>   if sasl.found()
>>@@ -2135,49 +2135,49 @@ endif
>> cacard = not_found
>> if not get_option('smartcard').auto() or have_system
>>   cacard = dependency('libcacard', required: get_option('smartcard'),
>>-                      version: '>=2.5.1', method: 'pkg-config')
>>+                      version: '>=2.5.1', method: 'pkg-config', include_type: 'system')
>> endif
>> u2f = not_found
>> if not get_option('u2f').auto() or have_system
>>   u2f = dependency('u2f-emu', required: get_option('u2f'),
>>-                   method: 'pkg-config')
>>+                   method: 'pkg-config', include_type: 'system')
>> endif
>> canokey = not_found
>> if not get_option('canokey').auto() or have_system
>>   canokey = dependency('canokey-qemu', required: get_option('canokey'),
>>-                   method: 'pkg-config')
>>+                   method: 'pkg-config', include_type: 'system')
>> endif
>> usbredir = not_found
>> if not get_option('usb_redir').auto() or have_system
>>   usbredir = dependency('libusbredirparser-0.5', required: get_option('usb_redir'),
>>-                        version: '>=0.6', method: 'pkg-config')
>>+                        version: '>=0.6', method: 'pkg-config', include_type: 'system')
>> endif
>> libusb = not_found
>> if not get_option('libusb').auto() or have_system
>>   libusb = dependency('libusb-1.0', required: get_option('libusb'),
>>-                      version: '>=1.0.13', method: 'pkg-config')
>>+                      version: '>=1.0.13', method: 'pkg-config', include_type: 'system')
>> endif
>> 
>> libpmem = not_found
>> if not get_option('libpmem').auto() or have_system
>>   libpmem = dependency('libpmem', required: get_option('libpmem'),
>>-                       method: 'pkg-config')
>>+                       method: 'pkg-config', include_type: 'system')
>> endif
>> libdaxctl = not_found
>> if not get_option('libdaxctl').auto() or have_system
>>   libdaxctl = dependency('libdaxctl', required: get_option('libdaxctl'),
>>-                         version: '>=57', method: 'pkg-config')
>>+                         version: '>=57', method: 'pkg-config', include_type: 'system')
>> endif
>> tasn1 = not_found
>> if gnutls.found()
>>   tasn1 = dependency('libtasn1',
>>                      required: false,
>>-                     method: 'pkg-config')
>>+                     method: 'pkg-config', include_type: 'system')
>> endif
>> keyutils = not_found
>> if not get_option('libkeyutils').auto() or have_block
>>   keyutils = dependency('libkeyutils', required: get_option('libkeyutils'),
>>-                        method: 'pkg-config')
>>+                        method: 'pkg-config', include_type: 'system')
>> endif
>> 
>> has_gettid = cc.has_function('gettid')
>>@@ -2185,7 +2185,7 @@ has_gettid = cc.has_function('gettid')
>> # libselinux
>> selinux = dependency('libselinux',
>>                      required: get_option('selinux'),
>>-                     method: 'pkg-config')
>>+                     method: 'pkg-config', include_type: 'system')
>> 
>> # Malloc tests
>> 
>>@@ -2237,7 +2237,7 @@ if get_option('fuse').disabled() and get_option('fuse_lseek').enabled()
>> endif
>> 
>> fuse = dependency('fuse3', required: get_option('fuse'),
>>-                  version: '>=3.1', method: 'pkg-config')
>>+                  version: '>=3.1', method: 'pkg-config', include_type: 'system')
>> 
>> fuse_lseek = not_found
>> if get_option('fuse_lseek').allowed()
>>@@ -2275,7 +2275,7 @@ endif
>> 
>> # libbpf
>> bpf_version = '1.1.0'
>>-libbpf = dependency('libbpf', version: '>=' + bpf_version, required: get_option('bpf'), method: 'pkg-config')
>>+libbpf = dependency('libbpf', version: '>=' + bpf_version, required: get_option('bpf'), method: 'pkg-config', include_type: 'system')
>> if libbpf.found() and not cc.links('''
>>    #include <bpf/libbpf.h>
>>    #include <linux/bpf.h>
>>@@ -2299,7 +2299,7 @@ libxdp = not_found
>> if not get_option('af_xdp').auto() or have_system
>>     if libbpf.found()
>>         libxdp = dependency('libxdp', required: get_option('af_xdp'),
>>-                            version: '>=1.4.0', method: 'pkg-config')
>>+                            version: '>=1.4.0', method: 'pkg-config', include_type: 'system')
>>     else
>>         if get_option('af_xdp').enabled()
>>             error('libxdp requested, but libbpf is not available')
>>@@ -2312,7 +2312,7 @@ libdw = not_found
>> if not get_option('libdw').auto() or \
>>         (not get_option('prefer_static') and (have_system or have_user))
>>     libdw = dependency('libdw',
>>-                       method: 'pkg-config',
>>+                       method: 'pkg-config', include_type: 'system',
>>                        required: get_option('libdw'))
>> endif
>> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] meson: Add most 3rd-party includes as system includes
  2025-06-17 20:34 [PATCH] meson: Add most 3rd-party includes as system includes Bernhard Beschow
  2025-07-03  6:25 ` Bernhard Beschow
@ 2025-07-11 10:26 ` Philippe Mathieu-Daudé
  2025-07-11 10:45 ` Peter Maydell
  2 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-07-11 10:26 UTC (permalink / raw)
  To: Bernhard Beschow, qemu-devel
  Cc: Paolo Bonzini, Daniel P. Berrangé, Marc-André Lureau,
	Manos Pitsidianakis, Gerd Hoffmann

On 17/6/25 22:34, Bernhard Beschow wrote:
> When compiling QEMU against fuse3-3.17.1 with --enable-werror the build fails
> with:
> 
>    In file included from ../src/block/export/fuse.c:33:
>    /usr/include/fuse3/fuse.h:959:5: error: redundant redeclaration of ‘fuse_main_real_versioned’ [-Werror=redundant-decls]
>      959 | int fuse_main_real_versioned(int argc, char *argv[],
>          |     ^~~~~~~~~~~~~~~~~~~~~~~~
>    /usr/include/fuse3/fuse.h:885:5: note: previous declaration of ‘fuse_main_real_versioned’ with type ‘int(int,  char **, const struct fuse_operations *, size_t,  struct libfuse_version *, void *)’ {aka ‘int(int,  char **, const struct fuse_operations *, long unsigned int,  struct libfuse_version *, void *)’}
>      885 | int fuse_main_real_versioned(int argc, char *argv[],
>          |     ^~~~~~~~~~~~~~~~~~~~~~~~
>    cc1: all warnings being treated as errors
> 
> That is, a fuse header triggers a warning within itself. Since QEMU adds the
> fuse3 include path via `-I`, the compiler thinks that the header is part of the
> QEMU project, and thus raises a warning. The compiler can be told to ignore
> warnings within 3rd party headers by adding these paths via `-isystem`. Fix the
> above build failure by marking fuse as system dependency. While at it mark
> every 3rd-party dependency as system dependency to prevent similar issues in the
> future but skip glib since that results in glib include paths to be omitted from
> bindgen in case of a Rust build.
> 
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   meson.build | 160 ++++++++++++++++++++++++++--------------------------
>   1 file changed, 80 insertions(+), 80 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index 34729c2a3d..694cf95f6f 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -826,7 +826,7 @@ endif
>   #####################################
>   
>   libm = cc.find_library('m', required: false)
> -threads = dependency('threads')
> +threads = dependency('threads', include_type: 'system')
>   util = cc.find_library('util', required: false)
>   winmm = []
>   socket = []
> @@ -859,11 +859,11 @@ if host_os == 'windows'
>                                         include_directories: include_directories('.'))
>     host_dsosuf = '.dll'
>   elif host_os == 'darwin'
> -  coref = dependency('appleframeworks', modules: 'CoreFoundation')
> -  iokit = dependency('appleframeworks', modules: 'IOKit', required: false)
> +  coref = dependency('appleframeworks', modules: 'CoreFoundation', include_type: 'system')
> +  iokit = dependency('appleframeworks', modules: 'IOKit', required: false, include_type: 'system')
>     host_dsosuf = '.dylib'
>     pvg = dependency('appleframeworks', modules: ['ParavirtualizedGraphics', 'Metal'],
> -                   required: get_option('pvg'))
> +                   required: get_option('pvg'), include_type: 'system')
>   elif host_os == 'sunos'
>     socket = [cc.find_library('socket'),
>               cc.find_library('nsl'),
> @@ -899,7 +899,7 @@ endif
>   hvf = not_found
>   if get_option('hvf').allowed()
>     hvf = dependency('appleframeworks', modules: 'Hypervisor',
> -                   required: get_option('hvf'))
> +                   required: get_option('hvf'), include_type: 'system')
>     if hvf.found()
>       accelerators += 'CONFIG_HVF'
>     endif

To the best of my meson knowledge:
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] meson: Add most 3rd-party includes as system includes
  2025-06-17 20:34 [PATCH] meson: Add most 3rd-party includes as system includes Bernhard Beschow
  2025-07-03  6:25 ` Bernhard Beschow
  2025-07-11 10:26 ` Philippe Mathieu-Daudé
@ 2025-07-11 10:45 ` Peter Maydell
  2025-07-11 11:00   ` Daniel P. Berrangé
  2025-07-14 10:35   ` Bernhard Beschow
  2 siblings, 2 replies; 10+ messages in thread
From: Peter Maydell @ 2025-07-11 10:45 UTC (permalink / raw)
  To: Bernhard Beschow
  Cc: qemu-devel, Paolo Bonzini, Daniel P. Berrangé,
	Philippe Mathieu-Daudé, Marc-André Lureau

On Tue, 17 Jun 2025 at 21:35, Bernhard Beschow <shentey@gmail.com> wrote:
>
> When compiling QEMU against fuse3-3.17.1 with --enable-werror the build fails
> with:
>
>   In file included from ../src/block/export/fuse.c:33:
>   /usr/include/fuse3/fuse.h:959:5: error: redundant redeclaration of ‘fuse_main_real_versioned’ [-Werror=redundant-decls]
>     959 | int fuse_main_real_versioned(int argc, char *argv[],
>         |     ^~~~~~~~~~~~~~~~~~~~~~~~
>   /usr/include/fuse3/fuse.h:885:5: note: previous declaration of ‘fuse_main_real_versioned’ with type ‘int(int,  char **, const struct fuse_operations *, size_t,  struct libfuse_version *, void *)’ {aka ‘int(int,  char **, const struct fuse_operations *, long unsigned int,  struct libfuse_version *, void *)’}
>     885 | int fuse_main_real_versioned(int argc, char *argv[],
>         |     ^~~~~~~~~~~~~~~~~~~~~~~~
>   cc1: all warnings being treated as errors
>
> That is, a fuse header triggers a warning within itself. Since QEMU adds the
> fuse3 include path via `-I`, the compiler thinks that the header is part of the
> QEMU project, and thus raises a warning. The compiler can be told to ignore
> warnings within 3rd party headers by adding these paths via `-isystem`. Fix the
> above build failure by marking fuse as system dependency. While at it mark
> every 3rd-party dependency as system dependency to prevent similar issues in the
> future but skip glib since that results in glib include paths to be omitted from
> bindgen in case of a Rust build.

The problem with this is that -isystem does not only do "suppress
warnings in these headers" -- it also alters the search order
for includes, in a way that can sometimes cause problems:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129
So this isn't completely risk-free, though I think meson tries to
avoid some of this by doing something a bit more complex than a
pure 's/-I/-isystem/'.

We would also lose the warnings about e.g. use of deprecated
functions in our dependencies.

All that said, this might still be the best tradeoff.

thanks
-- PMM


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] meson: Add most 3rd-party includes as system includes
  2025-07-11 10:45 ` Peter Maydell
@ 2025-07-11 11:00   ` Daniel P. Berrangé
  2025-07-15 13:45     ` Daniel P. Berrangé
  2025-07-14 10:35   ` Bernhard Beschow
  1 sibling, 1 reply; 10+ messages in thread
From: Daniel P. Berrangé @ 2025-07-11 11:00 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Bernhard Beschow, qemu-devel, Paolo Bonzini,
	Philippe Mathieu-Daudé, Marc-André Lureau

On Fri, Jul 11, 2025 at 11:45:08AM +0100, Peter Maydell wrote:
> On Tue, 17 Jun 2025 at 21:35, Bernhard Beschow <shentey@gmail.com> wrote:
> >
> > When compiling QEMU against fuse3-3.17.1 with --enable-werror the build fails
> > with:
> >
> >   In file included from ../src/block/export/fuse.c:33:
> >   /usr/include/fuse3/fuse.h:959:5: error: redundant redeclaration of ‘fuse_main_real_versioned’ [-Werror=redundant-decls]
> >     959 | int fuse_main_real_versioned(int argc, char *argv[],
> >         |     ^~~~~~~~~~~~~~~~~~~~~~~~
> >   /usr/include/fuse3/fuse.h:885:5: note: previous declaration of ‘fuse_main_real_versioned’ with type ‘int(int,  char **, const struct fuse_operations *, size_t,  struct libfuse_version *, void *)’ {aka ‘int(int,  char **, const struct fuse_operations *, long unsigned int,  struct libfuse_version *, void *)’}
> >     885 | int fuse_main_real_versioned(int argc, char *argv[],
> >         |     ^~~~~~~~~~~~~~~~~~~~~~~~
> >   cc1: all warnings being treated as errors
> >
> > That is, a fuse header triggers a warning within itself. Since QEMU adds the
> > fuse3 include path via `-I`, the compiler thinks that the header is part of the
> > QEMU project, and thus raises a warning. The compiler can be told to ignore
> > warnings within 3rd party headers by adding these paths via `-isystem`. Fix the
> > above build failure by marking fuse as system dependency. While at it mark
> > every 3rd-party dependency as system dependency to prevent similar issues in the
> > future but skip glib since that results in glib include paths to be omitted from
> > bindgen in case of a Rust build.
> 
> The problem with this is that -isystem does not only do "suppress
> warnings in these headers" -- it also alters the search order
> for includes, in a way that can sometimes cause problems:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129
> So this isn't completely risk-free, though I think meson tries to
> avoid some of this by doing something a bit more complex than a
> pure 's/-I/-isystem/'.
> 
> We would also lose the warnings about e.g. use of deprecated
> functions in our dependencies.
> 
> All that said, this might still be the best tradeoff.

FWIW, the actual bug mentioned here is a clear regression & mistake in
libfuse3 3.17.1 only, that they really should fix. I've filed this:

  https://github.com/libfuse/libfuse/issues/1282

and will likely send a PR too later.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] meson: Add most 3rd-party includes as system includes
  2025-07-11 10:45 ` Peter Maydell
  2025-07-11 11:00   ` Daniel P. Berrangé
@ 2025-07-14 10:35   ` Bernhard Beschow
  1 sibling, 0 replies; 10+ messages in thread
From: Bernhard Beschow @ 2025-07-14 10:35 UTC (permalink / raw)
  To: Peter Maydell
  Cc: qemu-devel, Paolo Bonzini, Daniel P. Berrangé,
	Philippe Mathieu-Daudé, Marc-André Lureau



Am 11. Juli 2025 10:45:08 UTC schrieb Peter Maydell <peter.maydell@linaro.org>:
>On Tue, 17 Jun 2025 at 21:35, Bernhard Beschow <shentey@gmail.com> wrote:
>>
>> When compiling QEMU against fuse3-3.17.1 with --enable-werror the build fails
>> with:
>>
>>   In file included from ../src/block/export/fuse.c:33:
>>   /usr/include/fuse3/fuse.h:959:5: error: redundant redeclaration of ‘fuse_main_real_versioned’ [-Werror=redundant-decls]
>>     959 | int fuse_main_real_versioned(int argc, char *argv[],
>>         |     ^~~~~~~~~~~~~~~~~~~~~~~~
>>   /usr/include/fuse3/fuse.h:885:5: note: previous declaration of ‘fuse_main_real_versioned’ with type ‘int(int,  char **, const struct fuse_operations *, size_t,  struct libfuse_version *, void *)’ {aka ‘int(int,  char **, const struct fuse_operations *, long unsigned int,  struct libfuse_version *, void *)’}
>>     885 | int fuse_main_real_versioned(int argc, char *argv[],
>>         |     ^~~~~~~~~~~~~~~~~~~~~~~~
>>   cc1: all warnings being treated as errors
>>
>> That is, a fuse header triggers a warning within itself. Since QEMU adds the
>> fuse3 include path via `-I`, the compiler thinks that the header is part of the
>> QEMU project, and thus raises a warning. The compiler can be told to ignore
>> warnings within 3rd party headers by adding these paths via `-isystem`. Fix the
>> above build failure by marking fuse as system dependency. While at it mark
>> every 3rd-party dependency as system dependency to prevent similar issues in the
>> future but skip glib since that results in glib include paths to be omitted from
>> bindgen in case of a Rust build.
>
>The problem with this is that -isystem does not only do "suppress
>warnings in these headers" -- it also alters the search order
>for includes, in a way that can sometimes cause problems:
>https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129
>So this isn't completely risk-free, though I think meson tries to
>avoid some of this by doing something a bit more complex than a
>pure 's/-I/-isystem/'.
>
>We would also lose the warnings about e.g. use of deprecated
>functions in our dependencies.

AFAIU the include_type parameter only affects how QEMU itself is built but doesn't affect Meson subprojects. Therefore, we should still see deprecation warnings from dependencies in our own code.

Best regards,
Bernhard

>
>All that said, this might still be the best tradeoff.
>
>thanks
>-- PMM


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] meson: Add most 3rd-party includes as system includes
  2025-07-11 11:00   ` Daniel P. Berrangé
@ 2025-07-15 13:45     ` Daniel P. Berrangé
  2025-07-16  8:13       ` Bernhard Beschow
  0 siblings, 1 reply; 10+ messages in thread
From: Daniel P. Berrangé @ 2025-07-15 13:45 UTC (permalink / raw)
  To: Peter Maydell, Bernhard Beschow, qemu-devel, Paolo Bonzini,
	Philippe Mathieu-Daudé, Marc-André Lureau

On Fri, Jul 11, 2025 at 12:00:24PM +0100, Daniel P. Berrangé wrote:
> On Fri, Jul 11, 2025 at 11:45:08AM +0100, Peter Maydell wrote:
> > On Tue, 17 Jun 2025 at 21:35, Bernhard Beschow <shentey@gmail.com> wrote:
> > >
> > > When compiling QEMU against fuse3-3.17.1 with --enable-werror the build fails
> > > with:
> > >
> > >   In file included from ../src/block/export/fuse.c:33:
> > >   /usr/include/fuse3/fuse.h:959:5: error: redundant redeclaration of ‘fuse_main_real_versioned’ [-Werror=redundant-decls]
> > >     959 | int fuse_main_real_versioned(int argc, char *argv[],
> > >         |     ^~~~~~~~~~~~~~~~~~~~~~~~
> > >   /usr/include/fuse3/fuse.h:885:5: note: previous declaration of ‘fuse_main_real_versioned’ with type ‘int(int,  char **, const struct fuse_operations *, size_t,  struct libfuse_version *, void *)’ {aka ‘int(int,  char **, const struct fuse_operations *, long unsigned int,  struct libfuse_version *, void *)’}
> > >     885 | int fuse_main_real_versioned(int argc, char *argv[],
> > >         |     ^~~~~~~~~~~~~~~~~~~~~~~~
> > >   cc1: all warnings being treated as errors
> > >
> > > That is, a fuse header triggers a warning within itself. Since QEMU adds the
> > > fuse3 include path via `-I`, the compiler thinks that the header is part of the
> > > QEMU project, and thus raises a warning. The compiler can be told to ignore
> > > warnings within 3rd party headers by adding these paths via `-isystem`. Fix the
> > > above build failure by marking fuse as system dependency. While at it mark
> > > every 3rd-party dependency as system dependency to prevent similar issues in the
> > > future but skip glib since that results in glib include paths to be omitted from
> > > bindgen in case of a Rust build.
> > 
> > The problem with this is that -isystem does not only do "suppress
> > warnings in these headers" -- it also alters the search order
> > for includes, in a way that can sometimes cause problems:
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129
> > So this isn't completely risk-free, though I think meson tries to
> > avoid some of this by doing something a bit more complex than a
> > pure 's/-I/-isystem/'.
> > 
> > We would also lose the warnings about e.g. use of deprecated
> > functions in our dependencies.
> > 
> > All that said, this might still be the best tradeoff.
> 
> FWIW, the actual bug mentioned here is a clear regression & mistake in
> libfuse3 3.17.1 only, that they really should fix. I've filed this:
> 
>   https://github.com/libfuse/libfuse/issues/1282
> 
> and will likely send a PR too later.

The issue turned out to already be fixed in libfuse git master. So given
that the problem only appears in one single release, IMHO, the best thing
is to ignore it. Any distro which ships the broken libfuse should either
update it, or cherry-pick the trivial header file bugfix from git.


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] meson: Add most 3rd-party includes as system includes
  2025-07-15 13:45     ` Daniel P. Berrangé
@ 2025-07-16  8:13       ` Bernhard Beschow
  2025-07-16  9:17         ` Daniel P. Berrangé
  0 siblings, 1 reply; 10+ messages in thread
From: Bernhard Beschow @ 2025-07-16  8:13 UTC (permalink / raw)
  To: Daniel P. Berrangé, Peter Maydell, qemu-devel, Paolo Bonzini,
	Philippe Mathieu-Daudé, Marc-André Lureau



Am 15. Juli 2025 13:45:08 UTC schrieb "Daniel P. Berrangé" <berrange@redhat.com>:
>On Fri, Jul 11, 2025 at 12:00:24PM +0100, Daniel P. Berrangé wrote:
>> On Fri, Jul 11, 2025 at 11:45:08AM +0100, Peter Maydell wrote:
>> > On Tue, 17 Jun 2025 at 21:35, Bernhard Beschow <shentey@gmail.com> wrote:
>> > >
>> > > When compiling QEMU against fuse3-3.17.1 with --enable-werror the build fails
>> > > with:
>> > >
>> > >   In file included from ../src/block/export/fuse.c:33:
>> > >   /usr/include/fuse3/fuse.h:959:5: error: redundant redeclaration of ‘fuse_main_real_versioned’ [-Werror=redundant-decls]
>> > >     959 | int fuse_main_real_versioned(int argc, char *argv[],
>> > >         |     ^~~~~~~~~~~~~~~~~~~~~~~~
>> > >   /usr/include/fuse3/fuse.h:885:5: note: previous declaration of ‘fuse_main_real_versioned’ with type ‘int(int,  char **, const struct fuse_operations *, size_t,  struct libfuse_version *, void *)’ {aka ‘int(int,  char **, const struct fuse_operations *, long unsigned int,  struct libfuse_version *, void *)’}
>> > >     885 | int fuse_main_real_versioned(int argc, char *argv[],
>> > >         |     ^~~~~~~~~~~~~~~~~~~~~~~~
>> > >   cc1: all warnings being treated as errors
>> > >
>> > > That is, a fuse header triggers a warning within itself. Since QEMU adds the
>> > > fuse3 include path via `-I`, the compiler thinks that the header is part of the
>> > > QEMU project, and thus raises a warning. The compiler can be told to ignore
>> > > warnings within 3rd party headers by adding these paths via `-isystem`. Fix the
>> > > above build failure by marking fuse as system dependency. While at it mark
>> > > every 3rd-party dependency as system dependency to prevent similar issues in the
>> > > future but skip glib since that results in glib include paths to be omitted from
>> > > bindgen in case of a Rust build.
>> > 
>> > The problem with this is that -isystem does not only do "suppress
>> > warnings in these headers" -- it also alters the search order
>> > for includes, in a way that can sometimes cause problems:
>> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129
>> > So this isn't completely risk-free, though I think meson tries to
>> > avoid some of this by doing something a bit more complex than a
>> > pure 's/-I/-isystem/'.
>> > 
>> > We would also lose the warnings about e.g. use of deprecated
>> > functions in our dependencies.
>> > 
>> > All that said, this might still be the best tradeoff.
>> 
>> FWIW, the actual bug mentioned here is a clear regression & mistake in
>> libfuse3 3.17.1 only, that they really should fix. I've filed this:
>> 
>>   https://github.com/libfuse/libfuse/issues/1282
>> 
>> and will likely send a PR too later.
>
>The issue turned out to already be fixed in libfuse git master. So given
>that the problem only appears in one single release, IMHO, the best thing
>is to ignore it. Any distro which ships the broken libfuse should either
>update it, or cherry-pick the trivial header file bugfix from git.

The idea of this patch is also to insulate ourselves from similar issues in the future. Moreover,  `-isystem` might be helpful in other ways, such as for static analysis tools. For example, clang-tidy ignores any issues caused by headers included via -isystem. So IMO this patch is still worth for consideration (but I'm not attached to it).

Best regards,
Bernhard

>
>
>With regards,
>Daniel


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] meson: Add most 3rd-party includes as system includes
  2025-07-16  8:13       ` Bernhard Beschow
@ 2025-07-16  9:17         ` Daniel P. Berrangé
  0 siblings, 0 replies; 10+ messages in thread
From: Daniel P. Berrangé @ 2025-07-16  9:17 UTC (permalink / raw)
  To: Bernhard Beschow
  Cc: Peter Maydell, qemu-devel, Paolo Bonzini,
	Philippe Mathieu-Daudé, Marc-André Lureau

On Wed, Jul 16, 2025 at 08:13:09AM +0000, Bernhard Beschow wrote:
> 
> 
> Am 15. Juli 2025 13:45:08 UTC schrieb "Daniel P. Berrangé" <berrange@redhat.com>:
> >On Fri, Jul 11, 2025 at 12:00:24PM +0100, Daniel P. Berrangé wrote:
> >> On Fri, Jul 11, 2025 at 11:45:08AM +0100, Peter Maydell wrote:
> >> > On Tue, 17 Jun 2025 at 21:35, Bernhard Beschow <shentey@gmail.com> wrote:
> >> > >
> >> > > When compiling QEMU against fuse3-3.17.1 with --enable-werror the build fails
> >> > > with:
> >> > >
> >> > >   In file included from ../src/block/export/fuse.c:33:
> >> > >   /usr/include/fuse3/fuse.h:959:5: error: redundant redeclaration of ‘fuse_main_real_versioned’ [-Werror=redundant-decls]
> >> > >     959 | int fuse_main_real_versioned(int argc, char *argv[],
> >> > >         |     ^~~~~~~~~~~~~~~~~~~~~~~~
> >> > >   /usr/include/fuse3/fuse.h:885:5: note: previous declaration of ‘fuse_main_real_versioned’ with type ‘int(int,  char **, const struct fuse_operations *, size_t,  struct libfuse_version *, void *)’ {aka ‘int(int,  char **, const struct fuse_operations *, long unsigned int,  struct libfuse_version *, void *)’}
> >> > >     885 | int fuse_main_real_versioned(int argc, char *argv[],
> >> > >         |     ^~~~~~~~~~~~~~~~~~~~~~~~
> >> > >   cc1: all warnings being treated as errors
> >> > >
> >> > > That is, a fuse header triggers a warning within itself. Since QEMU adds the
> >> > > fuse3 include path via `-I`, the compiler thinks that the header is part of the
> >> > > QEMU project, and thus raises a warning. The compiler can be told to ignore
> >> > > warnings within 3rd party headers by adding these paths via `-isystem`. Fix the
> >> > > above build failure by marking fuse as system dependency. While at it mark
> >> > > every 3rd-party dependency as system dependency to prevent similar issues in the
> >> > > future but skip glib since that results in glib include paths to be omitted from
> >> > > bindgen in case of a Rust build.
> >> > 
> >> > The problem with this is that -isystem does not only do "suppress
> >> > warnings in these headers" -- it also alters the search order
> >> > for includes, in a way that can sometimes cause problems:
> >> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129
> >> > So this isn't completely risk-free, though I think meson tries to
> >> > avoid some of this by doing something a bit more complex than a
> >> > pure 's/-I/-isystem/'.
> >> > 
> >> > We would also lose the warnings about e.g. use of deprecated
> >> > functions in our dependencies.
> >> > 
> >> > All that said, this might still be the best tradeoff.
> >> 
> >> FWIW, the actual bug mentioned here is a clear regression & mistake in
> >> libfuse3 3.17.1 only, that they really should fix. I've filed this:
> >> 
> >>   https://github.com/libfuse/libfuse/issues/1282
> >> 
> >> and will likely send a PR too later.
> >
> >The issue turned out to already be fixed in libfuse git master. So given
> >that the problem only appears in one single release, IMHO, the best thing
> >is to ignore it. Any distro which ships the broken libfuse should either
> >update it, or cherry-pick the trivial header file bugfix from git.
> 
> The idea of this patch is also to insulate ourselves from similar
> issues in the future. Moreover,  `-isystem` might be helpful in
> other ways, such as for static analysis tools. For example,
> clang-tidy ignores any issues caused by headers included via
> -isystem. So IMO this patch is still worth for consideration
> (but I'm not attached to it).

I still feel like this is more trouble than is worth. You've already had to
special case exclude 'glib' from this conversion, which is our biggest dep
when it comes to external headers, to place bindgen & this sounds liable to
extend to other deps as we expand the use of rust.

The problems like the one we see with fuse are pretty infrequent and haven't
been a significant source of pain for QEMU historically IME.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-07-16  9:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-17 20:34 [PATCH] meson: Add most 3rd-party includes as system includes Bernhard Beschow
2025-07-03  6:25 ` Bernhard Beschow
2025-07-10 17:54   ` Bernhard Beschow
2025-07-11 10:26 ` Philippe Mathieu-Daudé
2025-07-11 10:45 ` Peter Maydell
2025-07-11 11:00   ` Daniel P. Berrangé
2025-07-15 13:45     ` Daniel P. Berrangé
2025-07-16  8:13       ` Bernhard Beschow
2025-07-16  9:17         ` Daniel P. Berrangé
2025-07-14 10:35   ` Bernhard Beschow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).