Source: skiboot
Version: 7.0+dfsg-1
Tags: patch
User: [email protected]
Usertags: ftcbfs

skiboot fails to cross build from source, because it generally uses the 
build architecture toolchain. There are three sub-problems that I 
identified here:
 * The upstream Makefiles support the CROSS_COMPILE environment variable 
   and setting it affects the choice of e.g. ld, which is relevant here.
 * Unfortunately, CROSS_COMPILE does not affect CC as it has a default 
   and is assigned with ?=. Hence it needs to be set explicitly.
 * debian/rules uses DEB_TARGET_ARCH, but that's only relevant to 
   compilers and skiboot is not a compiler. Changed to host.

Fixing all of these makes skiboot cross buildable. I'm attaching the 
combined patch for your convenience.

Helmut
diff -Nru skiboot-7.0+dfsg/debian/changelog skiboot-7.0+dfsg/debian/changelog
--- skiboot-7.0+dfsg/debian/changelog   2021-10-29 15:32:03.000000000 +0200
+++ skiboot-7.0+dfsg/debian/changelog   2025-09-30 21:10:19.000000000 +0200
@@ -1,3 +1,13 @@
+skiboot (7.0+dfsg-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + Export CROSS_COMPILE for tools such as LD.
+    + As CROSS_COMPILE does not apply to CC, let dpkg export tools.
+    + Fix host vs target confusion.
+
+ -- Helmut Grohne <[email protected]>  Tue, 30 Sep 2025 21:10:19 +0200
+
 skiboot (7.0+dfsg-1) unstable; urgency=medium
 
   * Update to new upstream version 7.0+dfsg.
diff -Nru skiboot-7.0+dfsg/debian/rules skiboot-7.0+dfsg/debian/rules
--- skiboot-7.0+dfsg/debian/rules       2021-10-29 15:32:03.000000000 +0200
+++ skiboot-7.0+dfsg/debian/rules       2025-09-30 21:10:19.000000000 +0200
@@ -1,7 +1,5 @@
 #!/usr/bin/make -f
 
-include /usr/share/dpkg/default.mk
-
 # Uncomment this to turn on verbose mode.
 export DH_VERBOSE=1
 # Disable PIE flag has it makes opal-prd segfault
@@ -11,12 +9,20 @@
 # configured this way for s390x in Ubuntu 16.04 LTS).
 export DEB_LDFLAGS_MAINT_APPEND = -no-pie
 
+include /usr/share/dpkg/default.mk
+DPKG_EXPORT_BUILDTOOLS=1
+include /usr/share/dpkg/buildtools.mk
+
+ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
+export CROSS_COMPILE := $(DEB_HOST_GNU_TYPE)-
+endif
+
 
 %:
        dh $@
 
 override_dh_auto_build-arch:
-ifneq (,$(filter $(DEB_TARGET_ARCH), ppc64 ppc64el))
+ifneq (,$(filter $(DEB_HOST_ARCH), ppc64 ppc64el))
        OPAL_PRD_VERSION=opal-prd-$(DEB_VERSION_UPSTREAM) make V=1 -C 
external/opal-prd/
 endif
        GARD_VERSION=gard-$(DEB_VERSION_UPSTREAM) make V=1 -C external/gard/

Reply via email to