Bug#1022966: grub2 FTCBFS: it's complicated

Helmut Grohne helmut at subdivi.de
Fri Oct 28 11:57:35 BST 2022


Source: grub2
Version: 2.06-4
Tags: patch
User: debian-cross at lists.debian.org
Usertags: ftcbfs

grub2 cannot presently be cross built. There are many reasons for this,
so let's break it down into pieces.

You cannot even start doing it as its Build-Depends are not satisfiable.
For one thing, a foreign python3 cannot be installed (postinst failure),
but grub2 really doesn't want a foreign python3, so it should be
annotated :native.

On the same level, a foreign gcc-10 cannot be installed. This one is
probably unfixable for the time being. When we say "gcc-10", what we get
is a host architecture compiler running on the host architecture, but we
actually want a compiler running on the build architecture. We cannot
currently express that in a sane way. In a distant future, we shall be
able to say "gcc-10-for-host", but that's not where we are. For the time
being, we can emulate this for individual architectures, e.g. for armhf
it becomes gcc-10-arm-linux-gnueabihf. For the purpose of demonstration,
I've done this for armhf only. If you don't like this change, skip it.
Keeping it would make the package testable on crossqa.debian.net.

Of course we also need to tell configure to use the cross compiler, so
we need to pass a triplet-prefixed CC.

Then we notice that generated font files end up missing. When grub
detects a cross build, it knows that it cannot run the built grub-mkfont
and thus skips generating fonts. We can tell it to build another
grub-mkfont using --enable-build-grub-mkfont and doing so requires a
native libfreetype6-dev.

We also face help2man. grub kindly disables generation of manual pages
and thus trips dh_install missing files. I don't have a good answer for
help2man. Options:
1. Generate manual pages when creating a source package.
2. Move manual pages to an Arch:all package.
3. Stop using help2man.
4. Run help2man on the system binaries (and b-d: grub-common <cross>).

None of these options is particularly attractive, so I left the help2man
issue unsolved. Do you have a preference here? Can you accept the other
changes into the grub2 package?

Helmut
-------------- next part --------------
diff --minimal -Nru grub2-2.06/debian/changelog grub2-2.06/debian/changelog
--- grub2-2.06/debian/changelog	2022-09-14 23:35:49.000000000 +0200
+++ grub2-2.06/debian/changelog	2022-10-28 11:45:20.000000000 +0200
@@ -1,3 +1,10 @@
+grub2 (2.06-4.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Improve cross building. (Closes: #-1)
+
+ -- Helmut Grohne <helmut at subdivi.de>  Fri, 28 Oct 2022 11:45:20 +0200
+
 grub2 (2.06-4) unstable; urgency=high
 
   [ Steve McIntyre ]
diff --minimal -Nru grub2-2.06/debian/control grub2-2.06/debian/control
--- grub2-2.06/debian/control	2022-09-14 23:35:49.000000000 +0200
+++ grub2-2.06/debian/control	2022-10-28 11:45:20.000000000 +0200
@@ -5,16 +5,18 @@
 Uploaders: Felix Zielcke <fzielcke at z-51.de>, Jordi Mallach <jordi at debian.org>, Colin Watson <cjwatson at debian.org>, Steve McIntyre <93sam at debian.org>, Julian Andres Klode <jak at debian.org>
 Build-Depends: debhelper-compat (= 13),
  patchutils,
- python3,
+ python3:native,
  flex,
  bison,
  po-debconf,
  help2man,
  texinfo,
- gcc-10,
+ gcc-10 [!armhf] <!cross>,
+ gcc-10-arm-linux-gnueabihf [armhf] <cross>,
  gcc-10-multilib [i386 kopensolaris-i386 any-amd64 any-ppc64 any-sparc],
  xfonts-unifont,
  libfreetype6-dev,
+ libfreetype6-dev:native,
  gettext,
  libdevmapper-dev [linux-any],
  libgeom-dev (>= 8.2+ds1-1~) [kfreebsd-any] | libgeom-dev (<< 8.2) [kfreebsd-any],
diff --minimal -Nru grub2-2.06/debian/rules grub2-2.06/debian/rules
--- grub2-2.06/debian/rules	2022-09-14 23:35:49.000000000 +0200
+++ grub2-2.06/debian/rules	2022-10-28 11:45:20.000000000 +0200
@@ -37,7 +37,7 @@
 with_check := yes
 endif
 
-CC := gcc-10
+CC := $(DEB_HOST_GNU_TYPE)-gcc-10
 
 confflags = \
 	PACKAGE_VERSION="$(deb_version)" PACKAGE_STRING="GRUB $(deb_version)" \
@@ -45,6 +45,9 @@
 	--libdir=\$${prefix}/lib --libexecdir=\$${prefix}/lib \
 	--enable-grub-mkfont \
 	--disable-grub-emu-usb
+ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
+	confflags += --enable-build-grub-mkfont
+endif
 substvars =
 
 AUTOGEN_DEB_FILES = config templates preinst postinst postrm dirs install links maintscript bash-completion


More information about the Pkg-grub-devel mailing list