[PATCH] configure / meson: Fix building with --disable-system and virglrenderer

Thomas Huth posted 1 patch 3 years, 8 months ago
Test docker-quick@centos7 failed
Test docker-mingw@fedora failed
Test checkpatch failed
Test FreeBSD failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200825162628.182885-1-thuth@redhat.com
configure                          | 20 +++++++++++++-------
contrib/vhost-user-gpu/meson.build |  3 ++-
meson.build                        | 12 +++++++-----
3 files changed, 22 insertions(+), 13 deletions(-)
[PATCH] configure / meson: Fix building with --disable-system and virglrenderer
Posted by Thomas Huth 3 years, 8 months ago
When pixman is not installed (or too old), but virglrenderer is available
and "configure" has been run with "--disable-system", the build currently
aborts when trying to compile vhost-user-gpu (since it requires pixman).
Let's add a proper CONFIG_PIXMAN switch so we can skip the build of
vhost-user-gpu when pixman is not installed or too old.

Fixes: 9b52b17ba5 ("configure: Allow to build tools without pixman")
Reported-by: Rafael Kitover <rkitover@gmail.com>
Reported-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 configure                          | 20 +++++++++++++-------
 contrib/vhost-user-gpu/meson.build |  3 ++-
 meson.build                        | 12 +++++++-----
 3 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/configure b/configure
index b1e11397a8..bddda91477 100755
--- a/configure
+++ b/configure
@@ -3925,15 +3925,18 @@ fi
 ##########################################
 # pixman support probe
 
-if test "$softmmu" = "no"; then
-  pixman_cflags=
-  pixman_libs=
-elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
+if $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
+  pixman="yes"
   pixman_cflags=$($pkg_config --cflags pixman-1)
   pixman_libs=$($pkg_config --libs pixman-1)
 else
+  pixman="no"
+  pixman_cflags=
+  pixman_libs=
+fi
+if test "$softmmu" = "yes" && test "$pixman" = "no"; then
   error_exit "pixman >= 0.21.8 not present." \
-      "Please install the pixman devel package."
+      "Please install the pixman devel package or use --disable-system."
 fi
 
 ##########################################
@@ -8054,8 +8057,11 @@ fi
 
 done # for target in $targets
 
-echo "PIXMAN_CFLAGS=$pixman_cflags" >> $config_host_mak
-echo "PIXMAN_LIBS=$pixman_libs" >> $config_host_mak
+if test "$pixman" = "yes"; then
+  echo "CONFIG_PIXMAN=y" >> $config_host_mak
+  echo "PIXMAN_CFLAGS=$pixman_cflags" >> $config_host_mak
+  echo "PIXMAN_LIBS=$pixman_libs" >> $config_host_mak
+fi
 
 if [ "$fdt" = "git" ]; then
   subdirs="$subdirs dtc"
diff --git a/contrib/vhost-user-gpu/meson.build b/contrib/vhost-user-gpu/meson.build
index 6c1459f54a..142daebfd7 100644
--- a/contrib/vhost-user-gpu/meson.build
+++ b/contrib/vhost-user-gpu/meson.build
@@ -1,5 +1,6 @@
 if 'CONFIG_TOOLS' in config_host and 'CONFIG_VIRGL' in config_host \
-    and 'CONFIG_GBM' in config_host and 'CONFIG_LINUX' in config_host
+    and 'CONFIG_GBM' in config_host and 'CONFIG_LINUX' in config_host \
+    and 'CONFIG_PIXMAN' in config_host
   executable('vhost-user-gpu', files('vhost-user-gpu.c', 'virgl.c', 'vugbm.c'),
              link_with: libvhost_user,
              dependencies: [qemuutil, pixman, gbm, virgl],
diff --git a/meson.build b/meson.build
index 7fbb7ab2fb..9eecea549c 100644
--- a/meson.build
+++ b/meson.build
@@ -113,8 +113,11 @@ if 'CONFIG_GNUTLS' in config_host
   gnutls = declare_dependency(compile_args: config_host['GNUTLS_CFLAGS'].split(),
                               link_args: config_host['GNUTLS_LIBS'].split())
 endif
-pixman = declare_dependency(compile_args: config_host['PIXMAN_CFLAGS'].split(),
-                            link_args: config_host['PIXMAN_LIBS'].split())
+pixman = not_found
+if 'CONFIG_PIXMAN' in config_host
+  pixman = declare_dependency(compile_args: config_host['PIXMAN_CFLAGS'].split(),
+                              link_args: config_host['PIXMAN_LIBS'].split())
+endif
 pam = not_found
 if 'CONFIG_AUTH_PAM' in config_host
   pam = cc.find_library('pam')
@@ -1095,9 +1098,7 @@ if have_tools
   if 'CONFIG_VHOST_USER' in config_host
     subdir('contrib/libvhost-user')
     subdir('contrib/vhost-user-blk')
-    if 'CONFIG_LINUX' in config_host
-      subdir('contrib/vhost-user-gpu')
-    endif
+    subdir('contrib/vhost-user-gpu')
     subdir('contrib/vhost-user-input')
     subdir('contrib/vhost-user-scsi')
   endif
@@ -1278,6 +1279,7 @@ summary_info += {'SDL image support': sdl_image.found()}
 # TODO: add back version
 summary_info += {'GTK support':       config_host.has_key('CONFIG_GTK')}
 summary_info += {'GTK GL support':    config_host.has_key('CONFIG_GTK_GL')}
+summary_info += {'pixman support':    config_host.has_key('CONFIG_PIXMAN')}
 # TODO: add back version
 summary_info += {'VTE support':       config_host.has_key('CONFIG_VTE')}
 summary_info += {'TLS priority':      config_host['CONFIG_TLS_PRIORITY']}
-- 
2.18.2


Re: [PATCH] configure / meson: Fix building with --disable-system and virglrenderer
Posted by Paolo Bonzini 3 years, 8 months ago
Sorry, I wrote all this thinking that pixman was mandatory. We could
already move the code to detect pixman to meson.build (see
docs/devel/build-system.rst), but unless I see a patch for that in 1-2 days
I will queue this one.

Paolo

Il mar 25 ago 2020, 18:26 Thomas Huth <thuth@redhat.com> ha scritto:

> When pixman is not installed (or too old), but virglrenderer is available
> and "configure" has been run with "--disable-system", the build currently
> aborts when trying to compile vhost-user-gpu (since it requires pixman).
> Let's add a proper CONFIG_PIXMAN switch so we can skip the build of
> vhost-user-gpu when pixman is not installed or too old.
>
> Fixes: 9b52b17ba5 ("configure: Allow to build tools without pixman")
> Reported-by: Rafael Kitover <rkitover@gmail.com>
> Reported-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  configure                          | 20 +++++++++++++-------
>  contrib/vhost-user-gpu/meson.build |  3 ++-
>  meson.build                        | 12 +++++++-----
>  3 files changed, 22 insertions(+), 13 deletions(-)
>
> diff --git a/configure b/configure
> index b1e11397a8..bddda91477 100755
> --- a/configure
> +++ b/configure
> @@ -3925,15 +3925,18 @@ fi
>  ##########################################
>  # pixman support probe
>
> -if test "$softmmu" = "no"; then
> -  pixman_cflags=
> -  pixman_libs=
> -elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
> +if $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
> +  pixman="yes"
>    pixman_cflags=$($pkg_config --cflags pixman-1)
>    pixman_libs=$($pkg_config --libs pixman-1)
>  else
> +  pixman="no"
> +  pixman_cflags=
> +  pixman_libs=
> +fi
> +if test "$softmmu" = "yes" && test "$pixman" = "no"; then
>    error_exit "pixman >= 0.21.8 not present." \
> -      "Please install the pixman devel package."
> +      "Please install the pixman devel package or use --disable-system."
>  fi
>
>  ##########################################
> @@ -8054,8 +8057,11 @@ fi
>
>  done # for target in $targets
>
> -echo "PIXMAN_CFLAGS=$pixman_cflags" >> $config_host_mak
> -echo "PIXMAN_LIBS=$pixman_libs" >> $config_host_mak
> +if test "$pixman" = "yes"; then
> +  echo "CONFIG_PIXMAN=y" >> $config_host_mak
> +  echo "PIXMAN_CFLAGS=$pixman_cflags" >> $config_host_mak
> +  echo "PIXMAN_LIBS=$pixman_libs" >> $config_host_mak
> +fi
>
>  if [ "$fdt" = "git" ]; then
>    subdirs="$subdirs dtc"
> diff --git a/contrib/vhost-user-gpu/meson.build
> b/contrib/vhost-user-gpu/meson.build
> index 6c1459f54a..142daebfd7 100644
> --- a/contrib/vhost-user-gpu/meson.build
> +++ b/contrib/vhost-user-gpu/meson.build
> @@ -1,5 +1,6 @@
>  if 'CONFIG_TOOLS' in config_host and 'CONFIG_VIRGL' in config_host \
> -    and 'CONFIG_GBM' in config_host and 'CONFIG_LINUX' in config_host
> +    and 'CONFIG_GBM' in config_host and 'CONFIG_LINUX' in config_host \
> +    and 'CONFIG_PIXMAN' in config_host
>    executable('vhost-user-gpu', files('vhost-user-gpu.c', 'virgl.c',
> 'vugbm.c'),
>               link_with: libvhost_user,
>               dependencies: [qemuutil, pixman, gbm, virgl],
> diff --git a/meson.build b/meson.build
> index 7fbb7ab2fb..9eecea549c 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -113,8 +113,11 @@ if 'CONFIG_GNUTLS' in config_host
>    gnutls = declare_dependency(compile_args:
> config_host['GNUTLS_CFLAGS'].split(),
>                                link_args:
> config_host['GNUTLS_LIBS'].split())
>  endif
> -pixman = declare_dependency(compile_args:
> config_host['PIXMAN_CFLAGS'].split(),
> -                            link_args: config_host['PIXMAN_LIBS'].split())
> +pixman = not_found
> +if 'CONFIG_PIXMAN' in config_host
> +  pixman = declare_dependency(compile_args:
> config_host['PIXMAN_CFLAGS'].split(),
> +                              link_args:
> config_host['PIXMAN_LIBS'].split())
> +endif
>  pam = not_found
>  if 'CONFIG_AUTH_PAM' in config_host
>    pam = cc.find_library('pam')
> @@ -1095,9 +1098,7 @@ if have_tools
>    if 'CONFIG_VHOST_USER' in config_host
>      subdir('contrib/libvhost-user')
>      subdir('contrib/vhost-user-blk')
> -    if 'CONFIG_LINUX' in config_host
> -      subdir('contrib/vhost-user-gpu')
> -    endif
> +    subdir('contrib/vhost-user-gpu')
>      subdir('contrib/vhost-user-input')
>      subdir('contrib/vhost-user-scsi')
>    endif
> @@ -1278,6 +1279,7 @@ summary_info += {'SDL image support':
> sdl_image.found()}
>  # TODO: add back version
>  summary_info += {'GTK support':       config_host.has_key('CONFIG_GTK')}
>  summary_info += {'GTK GL support':
> config_host.has_key('CONFIG_GTK_GL')}
> +summary_info += {'pixman support':
> config_host.has_key('CONFIG_PIXMAN')}
>  # TODO: add back version
>  summary_info += {'VTE support':       config_host.has_key('CONFIG_VTE')}
>  summary_info += {'TLS priority':      config_host['CONFIG_TLS_PRIORITY']}
> --
> 2.18.2
>
>