Bug#933560: glib2.0 FTCBFS: dh_dwz fails, builds without -g, outdated debcrossgen fork

Helmut Grohne helmut at subdivi.de
Wed Jul 31 16:55:15 BST 2019


Source: glib2.0
Version: 2.60.6-1
Tags: patch
User: debian-cross at lists.debian.org
Usertags: ftcbfs

glib2.0 fails to cross build from source. The immediate reason is that
the toolchain dependency is not satisfiable. Since we don't have
toolchain dependency translation, we must revert that for now to cross
build it, but this is not the topic of this bug.

dh_dwz fails with a strange error. After some digging, it turns out that
this is the usual behaviour when debug symbols are missing. As it
happens, the build somehow lacked -g. It turns out that meson recently
changed its behaviour wrt. CFLAGS and no longer honours the environment
variable for cross builds. This regressed many packages and it was fixed
in debcrossgen. Now debcrossgen inserts CFLAGS into the cross file.
However glib2.0 uses a fork of debcrossgen and it wasn't updated yet.

The attached patch updates the debcrossgen fork from meson. Please
consider applying it.

Helmut
-------------- next part --------------
diff --minimal -Nru glib2.0-2.60.6/debian/changelog glib2.0-2.60.6/debian/changelog
--- glib2.0-2.60.6/debian/changelog	2019-07-27 17:57:55.000000000 +0200
+++ glib2.0-2.60.6/debian/changelog	2019-07-31 16:42:54.000000000 +0200
@@ -1,3 +1,10 @@
+glib2.0 (2.60.6-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Sync debcrossgen from meson to handle CFLAGS. (Closes: #-1)
+
+ -- Helmut Grohne <helmut at subdivi.de>  Wed, 31 Jul 2019 16:42:54 +0200
+
 glib2.0 (2.60.6-1) unstable; urgency=medium
 
   * Team upload
diff --minimal -Nru glib2.0-2.60.6/debian/debcrossgen glib2.0-2.60.6/debian/debcrossgen
--- glib2.0-2.60.6/debian/debcrossgen	2019-07-27 17:57:55.000000000 +0200
+++ glib2.0-2.60.6/debian/debcrossgen	2019-07-31 16:42:51.000000000 +0200
@@ -26,6 +26,9 @@
 If you do not specify the --arch argument, Meson assumes that running
 plain 'dpkg-architecture' will return correct information for the
 host system.
+
+This script must be run in an environment where CPPFLAGS et al are set to the
+same values used in the actual compilation.
 '''
 )
 
@@ -47,6 +50,36 @@
             return f
     raise ValueError("%s not found on $PATH" % program)
 
+def write_args_line(ofile, name, args):
+    if len(args) == 0:
+        return
+    ostr = name + ' = ['
+    ostr += ', '.join("'" + i + "'" for i in args)
+    ostr += ']\n'
+    ofile.write(ostr)
+
+def write_args_from_envvars(ofile):
+    import shlex
+    cppflags = shlex.split(os.environ.get('CPPFLAGS', ''))
+    cflags = shlex.split(os.environ.get('CFLAGS', ''))
+    cxxflags = shlex.split(os.environ.get('CXXFLAGS', ''))
+    ldflags = shlex.split(os.environ.get('LDFLAGS', ''))
+
+    c_args = cppflags + cflags
+    cpp_args = cppflags + cxxflags
+    c_link_args = cflags + ldflags
+    cpp_link_args = cxxflags + ldflags
+
+    write_args_line(ofile, 'c_args', c_args)
+    write_args_line(ofile, 'cpp_args', cpp_args)
+    write_args_line(ofile, 'c_link_args', c_link_args)
+    write_args_line(ofile, 'cpp_link_args', cpp_link_args)
+
+cpu_family_map = dict(mips64el="mips64",
+                      i686='x86')
+cpu_map = dict(armhf="arm7hlf",
+               mips64el="mips64",)
+
 def run(options):
     if options.arch is None:
         cmd = ['dpkg-architecture']
@@ -62,8 +95,10 @@
         data[k] = v
     host_arch = data['DEB_HOST_GNU_TYPE']
     host_os = data['DEB_HOST_ARCH_OS']
-    host_cpu_family = data['DEB_HOST_GNU_CPU']
-    host_cpu = data['DEB_HOST_ARCH'] # Not really correct, should be arm7hlf etc but it is not exposed.
+    host_cpu_family = cpu_family_map.get(data['DEB_HOST_GNU_CPU'],
+                                         data['DEB_HOST_GNU_CPU'])
+    host_cpu = cpu_map.get(data['DEB_HOST_ARCH'],
+                           data['DEB_HOST_ARCH'])
     host_endian = data['DEB_HOST_ARCH_ENDIAN']
     with open(options.outfile, "w") as ofile:
         ofile.write('[binaries]\n')
@@ -80,6 +115,7 @@
         except ValueError:
             pass # pkg-config is optional
         ofile.write('\n[properties]\n')
+        write_args_from_envvars(ofile)
         for prop in options.set:
             assert '=' in prop
             key, value = prop.split('=', 1)


More information about the pkg-gnome-maintainers mailing list