From: Johannes Berg <johannes@sipsolutions.net>
To: Hauke Mehrtens <hauke@hauke-m.de>,
"backports@vger.kernel.org" <backports@vger.kernel.org>
Subject: Re: kernel 4.18+ build problem "Recursive variable 'KBUILD_CFLAGS' "
Date: Sun, 23 Sep 2018 22:03:21 +0200 [thread overview]
Message-ID: <1537733001.1707.5.camel@sipsolutions.net> (raw)
In-Reply-To: <32c2c52e-d3a0-e961-6040-1a34997a7a1f@hauke-m.de> (sfid-20180923_161658_834557_1648CD51)
On Sun, 2018-09-23 at 16:16 +0200, Hauke Mehrtens wrote:
> Hi,
>
> I tried to compile backports against kernel 4.18 and 4.19-rc4 (header
> files from Ubuntu) and ran into this problem when it wants to link the
> kernel:
>
> LD [M]
> /home/hauke/compat-wireless/backports-4.19-rc4-1/drivers/net/wireless/realtek/rtlwifi/rtl_usb.o
> Building modules, stage 2.
> scripts/Makefile.lib:10: *** Recursive variable 'KBUILD_CFLAGS'
> references itself (eventually). Stop.
Hmm. I vaguely remember something like that with our driver, but can't
find it now? I also remember trying to fix it in the upstream kernel ...
Ah yes. This patch:
-subdir-ccflags-y = $(call cc-option,...)
+subdir-ccflags-y := $(call cc-option,...)
My commit log said:
In newer kernels, calling cc-option will use KBUILD_CFLAGS,
which itself gets subdir-ccflags-y added to it. Thus, we get
it referencing itself, since nothing here is evaluated until
KBUILD_CFLAGS is used: KBUILD_CFLAGS contains subdir-ccflags-y,
that in turn contains cc-option call, containing KBUILD_CFLAGS.
To avoid that, use := assignment to subdir-ccflags-y. This
causes make to also evaluate += immediately, cc-option calls
are done right away and we don't end up with KBUILD_CFLAGS
referencing itself.
This fixes build of the driver on kernels 4.15 and higher.
Really in our driver - and it was ChromeOS-specific code too - it was +=
but we had to start with := instead of =.
I don't see something like this in rtlwifi though?
Ah, but we have
subdir-ccflags-y += $(call cc-option, -fno-pie) $(call cc-option, -no-pie)
in backports, so I guess this would help:
--- a/backport/Makefile.kernel
+++ b/backport/Makefile.kernel
@@ -30,7 +30,7 @@ NOSTDINC_FLAGS := \
$(CFLAGS)
endif
-subdir-ccflags-y += $(call cc-option, -fno-pie) $(call cc-option, -no-pie)
+subdir-ccflags-y := $(call cc-option, -fno-pie) $(call cc-option, -no-pie)
ifeq ($(CPTCFG_KERNEL_4_3),y)
subdir-ccflags-y += -Wno-pointer-sign
endif
johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in
next prev parent reply other threads:[~2018-09-24 2:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-23 14:16 kernel 4.18+ build problem "Recursive variable 'KBUILD_CFLAGS' " Hauke Mehrtens
2018-09-23 20:03 ` Johannes Berg [this message]
2018-09-23 20:09 ` Johannes Berg
2018-09-23 20:48 ` Hauke Mehrtens
2018-09-23 20:49 ` Johannes Berg
2018-09-24 7:18 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1537733001.1707.5.camel@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=backports@vger.kernel.org \
--cc=hauke@hauke-m.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).