Source: gcc-16
Version: 16.2.0-7
Severity: minor
Tags: patch



Dear Maintainers,

debian/rules2 builds CFLAGS_FOR_TARGET with "+=" from CFLAGS_SECURE and
CFLAGS_FRAME_POINTER. Where dpkg-buildflags gives neither, as with dpkg
before 1.22 (bookworm), the variable is a single blank. pass_vars only
checks whether a variable is non-empty, so it passes
CFLAGS_FOR_TARGET=" " to configure, which takes it as the target's
CFLAGS. libatomic's configure then stops with "CFLAGS must be set".

I ran into this building gcc-16-cross (stage0, arm64) on Devuan
daedalus, which has bookworm's dpkg.

The attached patch makes pass_vars ignore values that are only blanks
($(strip ...)), so configure's default applies, as it does without the
additions. Builds with current dpkg are not affected: there the
variables are either set or empty.

This was found and written with the help of Claude.
I reviewed and tested it.
Description: pass no flags that are only blanks
 CFLAGS_FOR_TARGET is built with "+=" from CFLAGS_SECURE and
 CFLAGS_FRAME_POINTER; where dpkg-buildflags gives neither (dpkg before
 1.22, e.g. Debian bookworm or Devuan daedalus), it is a blank, which
 pass_vars passed on: configure took it for the target's CFLAGS and
 libatomic's configure stops with "CFLAGS must be set".  A blank now
 counts as not set, and configure's default applies, as without the
 additions.
Author: Daemonratte <[email protected]>
Forwarded: no
Last-Update: 2026-11-22

--- a/debian/rules2
+++ b/debian/rules2
@@ -268,7 +268,7 @@
 
 # set CFLAGS/LDFLAGS for the configure step only, maybe be modifed for some target
 # all other flags are passed to the make step.
-pass_vars = $(foreach v,$(1),$(if $($(v)),$(v)="$($(v))"))
+pass_vars = $(foreach v,$(1),$(if $(strip $($(v))),$(v)="$($(v))"))
 flags_to_pass := CFLAGS CXXFLAGS LIBCFLAGS LIBCXXFLAGS LDFLAGS FCFLAGS
 
 docdir		= usr/share/doc

Reply via email to