[Pkg-rust-maintainers] Bug#1050975: rustc FTCBF amd64 -> arm64: error: unrecognized command-line option ‘-mbranch-protection=standard’

Helmut Grohne helmut at subdivi.de
Thu Aug 31 23:29:08 BST 2023


Source: rustc
Version: 1.66.0+dfsg1-1
Tags: patch
User: debian-cross at lists.debian.org
Usertags: ftcbfs

rustc fails to cross build from source, because it frowards CFLAGS meant
for the host compiler to the build compiler. When cross compiling on
amd64 for arm64, CFLAGS now contain -mbranch-protection=standard. This
is not understood by an amd64 compiler. I'm attaching a patch to address
the matter.

Helmut
-------------- next part --------------
diff --minimal -Nru rustc-1.66.0+dfsg1/debian/changelog rustc-1.66.0+dfsg1/debian/changelog
--- rustc-1.66.0+dfsg1/debian/changelog	2023-06-27 17:12:20.000000000 +0200
+++ rustc-1.66.0+dfsg1/debian/changelog	2023-08-31 21:40:47.000000000 +0200
@@ -1,3 +1,10 @@
+rustc (1.66.0+dfsg1-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: Do not pass host CFLAGS to the build compiler. (Closes: #-1)
+
+ -- Helmut Grohne <helmut at subdivi.de>  Thu, 31 Aug 2023 21:40:47 +0200
+
 rustc (1.66.0+dfsg1-1) unstable; urgency=medium
 
   * Upload to unstable
diff --minimal -Nru rustc-1.66.0+dfsg1/debian/rules rustc-1.66.0+dfsg1/debian/rules
--- rustc-1.66.0+dfsg1/debian/rules	2023-06-20 20:22:34.000000000 +0200
+++ rustc-1.66.0+dfsg1/debian/rules	2023-08-31 21:40:47.000000000 +0200
@@ -14,7 +14,11 @@
 LOCAL_RUST_VERSION := $(shell rustc --version --verbose | sed -ne 's/^release: //p')
 
 include /usr/share/dpkg/buildflags.mk
-export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
+export TARGET_CFLAGS = $(CFLAGS)
+export TARGET_CXXFLAGS = $(CXXFLAGS)
+export TARGET_CPPFLAGS = $(CPPFLAGS)
+export TARGET_LDFLAGS = $(LDFLAGS)
+unexport CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
 export CARGO_HOME = $(CURDIR)/debian/cargo
 
 # Defines DEB_*_RUST_TYPE triples


More information about the Pkg-rust-maintainers mailing list