linux: workaround make-4.1 bug
PATCH 1/1 linux: workaround make-4.1 bug
On Ubuntu 18.04, make-4.1 emits spurious, incorrect "entering/leaving" messages, which end up in the LINUX_VERSION_PROBED variable:
printf 'probed linux version: "%s"\n' "$(LINUX_VERSION_PROBED)" probed linux version: "make[1]: Entering directory '/home/buildroot' 4.19.78-linux4sam-6.2
make[1]: Leaving directory '/home/buildroot/output/build/linux-linux4sam_6.2'"
First, the messages are displayed even though we do explicitly pass --no-print-directory -s.
Second, the entering and leaving messages are not about the same directory!
This *only* occurs in the following conditions:
- the user has the correct 0022 umask,
- top-level parallel is used (with or without PPD),
- initial -C is specified as well.
$ umask 0022
$ make -j16 -C $(pwd)
[...]
depmod: ERROR: Bad version passed make[1]:
[...](yes, 'make[1]:' is the string depmod is trying, and fails, to parse as a version string).
If any of the three conditions above is removed, the problem no longer occurs. Here's a table of the MAKEFLAGS:
| 0002 | 0022 |
----+-------+------------------------------------------------+--------------------------+
| no-j | --no-print-directory -- | |
noC | +------------------------------------------------+--------------------------+
| -j16 | -j --jobserver-fds=3,4 --no-print-directory -- | -j --jobserver-fds=3,4 |
----+-------+------------------------------------------------+--------------------------+
| no-j | --no-print-directory -- | w |
-C | +------------------------------------------------+--------------------------+
| -j16 | -j --jobserver-fds=3,4 --no-print-directory -- | w -j --jobserver-fds=3,4 |
----+-------+------------------------------------------------+--------------------------+
0002: umask == 0002
0022: umask == 0022
no-j: no -j flag
-j16: -j16 flag
noC: no -C flag
-C : -C /path/of/buildroot/Only the bottom-right-most case fails...
This behaviour goes against what is documented:
https://www.gnu.org/software/make/manual/make.html#g_t_002dw-Option
5.7.4 The ?--print-directory? Option
[...]
you do not need to specify this option because ?make? does it for
you: ?-w? is turned on automatically when you use the ?-C? option, and in sub-makes. make will not automatically turn on ?-w? if you also use ?-s?, which says to be silent, or if you use ?--no-print-directory? to explicitly disable it.
So this exactly describes our situation; yet 'w' is added to MAKEFLAGS.
Getting rid of the 'w' flag makes the build succeed again, so that's what we do here (bleark, icky)...
Furthermore, the documented way to override MAKEFLAGS is to do so as a make parameter:
https://www.gnu.org/software/make/manual/make.html#Options_002fRecursion
5.7.3 Communicating Options to a Sub-make
[...]
If you do not want to pass the other flags down, you must change the value of MAKEFLAGS, like this:
subsystem:
cd subdir && $(MAKE) MAKEFLAGS=
However, doing so does not fix the issue. So we resort to pass the modified MAKEFLAGS via the environment (bleark, icky)...
--- linux/linux.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
linux/linux.mk +2 -1
@@ -160,7 +160,8 @@ endif # Get the real Linux version, which tells us where kernel modules are # going to be installed in the target filesystem. -LINUX_VERSION_PROBED = `$(MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_DIR) --no-print-directory -s kernelrelease 2>/dev/null` +# Filter out 'w' from MAKEFLAGS, to workaround a bug in make 4.1 (#13141) +LINUX_VERSION_PROBED = `MAKEFLAGS='$(filter-out w,$(MAKEFLAGS))' $(MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_DIR) --no-print-directory -s kernelrelease 2>/dev/null` LINUX_DTS_NAME += $(call qstrip,$(BR2_LINUX_KERNEL_INTREE_DTS_NAME))
Signature · 1 line
2.20.1
PATCH 1/1 linux: workaround make-4.1 bug
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yann" == Yann E MORIN <[email protected]> writes:
On Ubuntu 18.04, make-4.1 emits spurious, incorrect "entering/leaving" messages, which end up in the
LINUX_VERSION_PROBEDvariable:printf 'probed linux version: "%s"\n' "$(LINUX_VERSION_PROBED)" probed linux version: "make[1]: Entering directory '
/home/buildroot' 4.19.78-linux4sam-6.2
make[1]: Leaving directory '/home/buildroot/output/build/linux-linux4sam_6.2'"
Funky. Do you know if this is caused by an Ubuntu specific patch or also happens with upstream 4.1? Is it fixed in later versions? I don't seem to see it in the list of fixes in 4.2:
https://savannah.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=106&set=custom
Anyway, committed - Thanks.
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 linux: workaround make-4.1 bug
In reply to Yann E. MORINQuoted 89 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yann" == Yann E MORIN <[email protected]> writes:
On Ubuntu 18.04, make-4.1 emits spurious, incorrect "entering/leaving" messages, which end up in the
LINUX_VERSION_PROBEDvariable:printf 'probed linux version: "%s"\n' "$(LINUX_VERSION_PROBED)" probed linux version: "make[1]: Entering directory '
/home/buildroot' 4.19.78-linux4sam-6.2
make[1]: Leaving directory '/home/buildroot/output/build/linux-linux4sam_6.2'"First, the messages are displayed even though we do explicitly pass --no-print-directory -s.
Second, the entering and leaving messages are not about the same directory!
This *only* occurs in the following conditions:
- the user has the correct 0022 umask,
- top-level parallel is used (with or without PPD),
- initial -C is specified as well.$ umask 0022 $ make -j16 -C $(pwd) [...] depmod: ERROR: Bad version passed make[1]: [...](yes, 'make[1]:' is the string depmod is trying, and fails, to parse as a version string).
If any of the three conditions above is removed, the problem no longer occurs. Here's a table of the MAKEFLAGS:
| 0002 | 0022 | ----+-------+------------------------------------------------+--------------------------+ | no-j | --no-print-directory -- | | noC | +------------------------------------------------+--------------------------+ | -j16 | -j --jobserver-fds=3,4 --no-print-directory -- | -j --jobserver-fds=3,4 | ----+-------+------------------------------------------------+--------------------------+ | no-j | --no-print-directory -- | w | -C | +------------------------------------------------+--------------------------+ | -j16 | -j --jobserver-fds=3,4 --no-print-directory -- | w -j --jobserver-fds=3,4 | ----+-------+------------------------------------------------+--------------------------+ 0002: umask == 0002 0022: umask == 0022 no-j: no -j flag -j16: -j16 flag noC: no -C flag -C : -C /path/of/buildroot/Only the bottom-right-most case fails...
This behaviour goes against what is documented:
https://www.gnu.org/software/make/manual/make.html#g_t_002dw-Option
5.7.4 The ?--print-directory? Option
[...]
you do not need to specify this option because ?make? does it for
you: ?-w? is turned on automatically when you use the ?-C? option, and in sub-makes. make will not automatically turn on ?-w? if you also use ?-s?, which says to be silent, or if you use ?--no-print-directory? to explicitly disable it.So this exactly describes our situation; yet 'w' is added to MAKEFLAGS.
Getting rid of the 'w' flag makes the build succeed again, so that's what we do here (bleark, icky)...
Furthermore, the documented way to override MAKEFLAGS is to do so as a make parameter:
https://www.gnu.org/software/make/manual/make.html#Options_002fRecursion
5.7.3 Communicating Options to a Sub-make
[...]
If you do not want to pass the other flags down, you must change the value of MAKEFLAGS, like this:subsystem:
cd subdir && $(MAKE) MAKEFLAGS=However, doing so does not fix the issue. So we resort to pass the modified MAKEFLAGS via the environment (bleark, icky)...
Quoted 6 lines
Fixes #13141Reported-by Laurent <[email protected]>Reported-by Asaf Kahlon <[email protected]>Signed-off-by Yann E. MORIN <[email protected]>Cc Thomas Petazzoni <[email protected]>
Committed to 2020.02.x and 2020.05.x, thanks.
Signature · 1 line
Bye, Peter Korsgaard