Fix some build errors on Ubuntu 24.04. 47/314547/2
authorxuhy <huayong.xu@samsung.com>
Mon, 24 Jun 2024 01:54:02 +0000 (09:54 +0800)
committerxuhy <huayong.xu@samsung.com>
Mon, 15 Jul 2024 06:53:04 +0000 (14:53 +0800)
dpatch package is not available on ubuntu 24.04.
glib version need be checked in configure, please refer to
https://github.com/qemu/qemu/commit/e3feb2cc224f61149a27f021042f5a4230bb1008

Change-Id: If91d45ed0332eaf8744861ebd45d61fd3f5ff7e9
Signed-off-by: xuhy <huayong.xu@samsung.com>
configure
debian/control
debian/rules
include/qemu/qtree.h
meson.build
util/meson.build

index 2ed5366e82a194946a5a2ca12bace68074b6985d..74526e01955f9981932df5ac213d0fbf2ecdd2c5 100755 (executable)
--- a/configure
+++ b/configure
@@ -246,6 +246,7 @@ stack_protector=""
 safe_stack=""
 use_containers="yes"
 gdb_bin=$(command -v "gdb-multiarch" || command -v "gdb")
+glib_has_gslice="no"
 
 if test -e "$source_path/.git"
 then
@@ -3483,6 +3484,17 @@ for i in $glib_modules; do
     fi
 done
 
+# Check whether glib has gslice, which we have to avoid for correctness.
+# TODO: remove this check and the corresponding workaround (qtree) when
+# the minimum supported glib is >= $glib_dropped_gslice_version.
+glib_dropped_gslice_version=2.75.3
+for i in $glib_modules; do
+    if ! $pkg_config --atleast-version=$glib_dropped_gslice_version $i; then
+        glib_has_gslice="yes"
+       break
+    fi
+done
+
 # This workaround is required due to a bug in pkg-config file for glib as it
 # doesn't define GLIB_STATIC_COMPILATION for pkg-config --static
 
@@ -6753,6 +6765,9 @@ echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
 echo "QEMU_CXXFLAGS=$QEMU_CXXFLAGS" >> $config_host_mak
 echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
 echo "GLIB_LIBS=$glib_libs" >> $config_host_mak
+if test "$glib_has_gslice" = "yes" ; then
+    echo "HAVE_GLIB_WITH_SLICE_ALLOCATOR=y" >> $config_host_mak
+fi
 echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
 echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
 echo "EXESUF=$EXESUF" >> $config_host_mak
index 942bcb9b404a95f7fb193cbe4b917c3698b9d27e..817e3660ca98f119c3d58bfb47860a17d3ecc993 100644 (file)
@@ -4,7 +4,7 @@ Priority: extra
 Maintainer: Gui Chen <gui.chen@intel.com>
 Homepage: http://wiki.qemu.org/Index.html
 Standards-Version: 3.7.0
-Build-Depends: debhelper (>= 4.0.0), dpatch, pkg-config, libglib2.0-dev, python3:any, ninja-build, meson
+Build-Depends: debhelper (>= 4.0.0), pkg-config, libglib2.0-dev, python3:any, ninja-build, meson
 
 Package: qemu-arm-static
 Architecture: i386 amd64
index ec57f7e011acf20a86de84d1b15cfece92e300cc..c496bbe28bfdd3bfbac41ba542bf2dbf3d0d3e5b 100644 (file)
@@ -3,11 +3,10 @@
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
-include /usr/share/dpatch/dpatch.make
 unexport LDFLAGS
 
 build: build-stamp
-build-stamp: patch-stamp
+build-stamp:
        dh_testdir
        ./configure \
        --prefix=/usr \
@@ -69,7 +68,7 @@ build-stamp: patch-stamp
     --disable-xkbcommon
        dh_auto_build
 
-clean: unpatch
+clean:
        dh_testdir
        dh_testroot
        rm -f build-stamp
index 156aac449670b2387c251cca7d0c7ebc90aed5e6..d65f35350dfda2b27aeb6c08c3cb5d6de7d1b53f 100644 (file)
 
 #include "qemu/osdep.h"
 
-#if GLIB_CHECK_VERSION(2,75,3)
-// USE GTree
-#else
-#define HAVE_GLIB_WITH_SLICE_ALLOCATOR
-#endif
-
 #ifdef HAVE_GLIB_WITH_SLICE_ALLOCATOR
 
 typedef struct _QTree  QTree;
index a4743a83ae82bbe57e8dfeec3da4988fcab74bdf..cb0ff130331c502a023a389ed22a9d0721b9ec3e 100644 (file)
@@ -269,6 +269,12 @@ endif
 add_project_arguments(config_host['GLIB_CFLAGS'].split(),
                       native: false, language: ['c', 'cpp', 'objc'])
 glib = declare_dependency(link_args: config_host['GLIB_LIBS'].split())
+
+# pass down whether Glib has the slice allocator
+if config_host.has_key('HAVE_GLIB_WITH_SLICE_ALLOCATOR')
+  config_host_data.set('HAVE_GLIB_WITH_SLICE_ALLOCATOR', true)
+endif
+
 gio = not_found
 if 'CONFIG_GIO' in config_host
   gio = declare_dependency(compile_args: config_host['GIO_CFLAGS'].split(),
index 42ad3049f18067225284494b679b73bfb91a7013..39ae83b1d6be03c1af36ad5e969117ae327c2217 100644 (file)
@@ -17,7 +17,7 @@ util_ss.add(when: 'CONFIG_WIN32', if_true: files('event_notifier-win32.c'))
 util_ss.add(when: 'CONFIG_WIN32', if_true: files('oslib-win32.c'))
 util_ss.add(when: 'CONFIG_WIN32', if_true: files('qemu-thread-win32.c'))
 util_ss.add(when: 'CONFIG_WIN32', if_true: winmm)
-util_ss.add(files('qtree.c'))
+util_ss.add(when: 'HAVE_GLIB_WITH_SLICE_ALLOCATOR', if_true: files('qtree.c'))
 util_ss.add(files('envlist.c', 'path.c', 'module.c'))
 util_ss.add(files('host-utils.c'))
 util_ss.add(files('bitmap.c', 'bitops.c'))