Source: r-base
Version: 4.5.3-1
Tags: patch
User: [email protected]
Usertags: cross-satisfiability ftcbfs
r-base fails to cross build from source for a pile of reasons.
Initially, its Build-Depends cannot be satisfied. This is due to "gcc",
"g++" and "gfortran". For supporting cross compilation, toolchain
dependencies need to be translated and declare what architecture they
are being used for. In case of gcc and g++, both the build and host
architecture toolchain is implied in build-essential. The version
constraint is satisfied in oldoldstable. I suggest dropping them.
gfortran is used to compile Fortran code for the host architecture.
Hence, it should be suffixed -for-host. Once doing so, you may no longer
assume presence of unprefixed tools such as "gfortran". Instead,
${DEB_HOST_GNU_TYPE}-gfortran must be used. This leads to the second
problem.
Use of bare tools. debian/rules uses bare tool names such as gcc, g++
and gfortran in several places. Those compile for the build
architecture, but the package is supposed to be built for the host
architecture. Those tools all need to be prefixed with a host
architecture triplet. Fortunately, dpkg has a buildtools.mk file that
can be included to supply all those tools.
In the attached patch, I opt for replacing the variable names for tools
with those used by buildtools.mk. For instance, compiler becomes CC and
cxxcompiler becomes CXX. This also happens to match what the upstream
build system expects.
Last but not least, for cross building an autotools project one needs to
pass --build and --host to configure. Since the package does not use
dh_auto_configure, this must be done explicitly.
You can find all of the necessary changes in the attached patch. Once
applying it, r-base will not cross build. The upstream build system uses
a pile of AC_RUN_IFELSE checks and any of them makes a cross build fail.
most of them are cached, so a cross builder may supply a result via the
environment. Going from there to a full cross build is another piece,
but the attached patch at least makes Build-Depends satisfiable and
proceeds to the configure step.
Helmut
diff -Nru r-base-4.5.3/debian/changelog r-base-4.5.3/debian/changelog
--- r-base-4.5.3/debian/changelog 2026-03-11 12:42:01.000000000 +0100
+++ r-base-4.5.3/debian/changelog 2026-03-30 13:25:49.000000000 +0200
@@ -1,3 +1,14 @@
+r-base (4.5.3-1.1) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+ * Improve cross building: (Closes: #-1)
+ + Drop toolchain dependencies satisfied in oldoldstable.
+ + Let dpkg's buildtools.mk initialize tool variables.
+ + Prefer standard tool variable names over custom ones.
+ + Pass --build/--host to configure.
+
+ -- Helmut Grohne <[email protected]> Mon, 30 Mar 2026 13:25:49 +0200
+
r-base (4.5.3-1) unstable; urgency=medium
* New upstream release
diff -Nru r-base-4.5.3/debian/control r-base-4.5.3/debian/control
--- r-base-4.5.3/debian/control 2026-03-11 12:42:01.000000000 +0100
+++ r-base-4.5.3/debian/control 2026-03-30 13:25:47.000000000 +0200
@@ -3,7 +3,7 @@
Priority: optional
Maintainer: Dirk Eddelbuettel <[email protected]>
Standards-Version: 4.7.3
-Build-Depends: gcc (>= 4:4.9.2-2), g++ (>= 4:4.9.2-2), gfortran (>=
4:4.9.2-2), libblas-dev, liblapack-dev, tcl8.6-dev, tk8.6-dev, bison,
groff-base, libncurses-dev, libreadline-dev, debhelper-compat (= 13), texinfo,
libbz2-dev, liblzma-dev, libpcre2-dev, libcurl4-openssl-dev | libcurl4-dev,
xdg-utils, zlib1g-dev, libpng-dev, libjpeg-dev, libx11-dev, libxt-dev,
x11proto-core-dev, libpango1.0-dev, libcairo2-dev, libtiff-dev, xvfb, xauth,
xfonts-base, texlive-base, texlive-latex-base, texlive-plain-generic,
texlive-fonts-recommended, texlive-fonts-extra, texlive-extra-utils,
texlive-latex-recommended, texlive-latex-extra, default-jdk [!arm !hppa
!hurd-any] | openjdk-10-jdk [!arm !hppa !hurd-any], mpack, bash-completion,
libtirpc-dev
+Build-Depends: gfortran-for-host (>= 4:4.9.2-2), libblas-dev, liblapack-dev,
tcl8.6-dev, tk8.6-dev, bison, groff-base, libncurses-dev, libreadline-dev,
debhelper-compat (= 13), texinfo, libbz2-dev, liblzma-dev, libpcre2-dev,
libcurl4-openssl-dev | libcurl4-dev, xdg-utils, zlib1g-dev, libpng-dev,
libjpeg-dev, libx11-dev, libxt-dev, x11proto-core-dev, libpango1.0-dev,
libcairo2-dev, libtiff-dev, xvfb, xauth, xfonts-base, texlive-base,
texlive-latex-base, texlive-plain-generic, texlive-fonts-recommended,
texlive-fonts-extra, texlive-extra-utils, texlive-latex-recommended,
texlive-latex-extra, default-jdk [!arm !hppa !hurd-any] | openjdk-10-jdk [!arm
!hppa !hurd-any], mpack, bash-completion, libtirpc-dev
Vcs-Browser: https://salsa.debian.org/edd/r-base
Vcs-Git: https://salsa.debian.org/edd/r-base.git
Homepage: https://www.R-project.org/
diff -Nru r-base-4.5.3/debian/rules r-base-4.5.3/debian/rules
--- r-base-4.5.3/debian/rules 2025-10-31 11:59:40.000000000 +0100
+++ r-base-4.5.3/debian/rules 2026-03-30 13:25:49.000000000 +0200
@@ -5,6 +5,8 @@
#
# $Id: rules,v 1.3 2007/05/06 17:13:23 edd Exp edd $
+include /usr/share/dpkg/buildtools.mk
+
corepackage = r-base-core
devpackage = r-base-dev
#latexpackage = r-base-latex
@@ -73,17 +75,13 @@
# edd 26 Jun 2007 need 4.2 for fortran linking
# edd 26 Nov 2007 4.2 is now default, so no longer set -4.2 explictly; also
add f95compiler
# edd 11 Oct 2011 setting -std=gnu99 with compiler (thanks, Kurt Hornik)
-fortrancompiler = F77=gfortran
-f95compiler = gfortran
+fortrancompiler = F77=$(F77)
# edd 10 Jan 2016 mips currently needs gcc-4.9 (cf #810357) and big thanks to
Sébastien Villemot
# edd 12 Apr 2016 mips treatment removed again after kernel fix on
# edd 11 Nov 2021 undo -std=gnu99
#ifeq ($(arch),mips)
-#compiler = "gcc-4.9 -std=gnu99"
-#else
-compiler = gcc
+#CC = "gcc-4.9 -std=gnu99"
#endif
-cxxcompiler = g++
## Adrian Bunk 20 Jan 2023 workaround excess precision of x87
ifneq (,$(filter $(DEB_HOST_ARCH), i386))
@@ -129,8 +127,8 @@
## edd 09 Nov 2001 ia64 needs gcc-3.0, hppa gets it by default
#ifeq ($(arch),ia64)
#fortrancompiler = F77=g77-3.0
-#compiler = gcc-3.0
-#cxxcompiler = g++-3.0
+#CC = gcc-3.0
+#CXX = g++-3.0
#compilerflags = -O2
#endif
@@ -287,10 +285,10 @@
EGREP="/bin/grep -E" \
SED=/bin/sed \
GETWD="/bin/pwd" \
- CC=$(compiler) \
- CXX=${cxxcompiler} \
+ CC=${CC} \
+ CXX=${CXX} \
${fortrancompiler} \
- FC=${f95compiler} \
+ FC=${FC} \
CFLAGS="$(cflags)" \
CXXFLAGS="$(cxxflags)" \
FFLAGS="$(fcflags)" \
@@ -302,6 +300,8 @@
rincludedir=/usr/share/R/include \
rdocdir=/usr/share/R/doc \
./configure --prefix=/usr \
+ --build=$(DEB_BUILD_GNU_TYPE) \
+ --host=$(DEB_HOST_GNU_TYPE) \
--with-cairo \
--with-jpeglib \
--with-readline \
@@ -330,8 +330,8 @@
CXXFLAGS="$(cxxflags)" \
FFLAGS="$(fcflags)" \
FCFLAGS="$(fcflags)" \
- CC=${compiler} \
- CXX=${cxxcompiler} \
+ CC=${CC} \
+ CXX=${CXX} \
${fortrancompiler} \
LDFLAGS="$(ldflags)" \
PKG_BUILT_STAMP="$(buildtimestamp)" \
@@ -344,8 +344,8 @@
# $(MAKE) CFLAGS="$(compilerflags)" \
# CXXFLAGS="$(compilerflags)" \
# FFLAGS="$(compilerflags)" \
-# CC=${compiler} \
-# CXX=${cxxcompiler} \
+# CC=${CC} \
+# CXX=${CXX} \
# ${fortrancompiler} \
# stamp-recommended
@@ -354,8 +354,8 @@
$(MAKE) CFLAGS="$(cflags) -D_REENTRANT" \
CXXFLAGS="$(cxxflags) -D_REENTRANT" \
FFLAGS="$(fcflags) -D_REENTRANT" \
- CC=${compiler} \
- CXX=${cxxcompiler} \
+ CC=${CC} \
+ CXX=${CXX} \
${fortrancompiler} \
R_GZIPCMD="/bin/gzip -n" \
libRmath_la_LDFLAGS=-Wl,-soname,libRmath.so.$(somaj) \
@@ -458,8 +458,8 @@
$(MAKE) CFLAGS="$(cflags) -D_REENTRANT" \
CXXFLAGS="$(cxxflags) -D_REENTRANT" \
FFLAGS="$(fcflags) -D_REENTRANT" \
- CC=${compiler} \
- CXX=${cxxcompiler} \
+ CC=${CC} \
+ CXX=${CXX} \
${fortrancompiler} \
RHOME=/usr/lib/R \
DESTDIR=$(debtmp) \