Skip to contentSkip to conversation

Makefile: disable 'printvars' and 'show-vars' recipes for Make 4.3

PATCH Applied Giulio Benetti 4 participants 6 messages Jan 1, 2022 – Jul 30, 2022 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: disable 'printvars' and 'show-vars' recipes for Make 4.3

Make 4.3 is buggy and leads to a "Segmentation fault (core dumped)" when calling 'make printvars' or 'make show-vars', so let's refuse to execute those recipes if Make 4.3 by adding 'check-make-version' recipe as depedendency of 'printvars' and 'show-vars' as suggested by Yann E. Morin.

---
 Makefile | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
Makefile +9 -2
index 0b8c7b2867..ac98b84425 100644
@@ -1058,13 +1058,20 @@ ifeq ($(NEED_WRAPPER),y)
 	$(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O)
 endif
 
+.PHONY: check-make-version
+check-make-version:
+ifneq ($(filter $(RUNNING_MAKE_VERSION),4.3),)
+	@echo "Make 4.3 doesn't support 'printvars' and 'show-vars' recipes"
+	@exit 1
+endif
+
 # printvars prints all the variables currently defined in our
 # Makefiles. Alternatively, if a non-empty VARS variable is passed,
 # only the variables matching the make pattern passed in VARS are
 # displayed.
 # show-vars does the same, but as a JSON dictionnary.
 .PHONY: printvars
-printvars:
+printvars: check-make-version
 	@:
 	$(foreach V, \
 		$(sort $(filter $(VARS),$(.VARIABLES))), \
@@ -1077,7 +1084,7 @@ printvars:
 
 .PHONY: show-vars
 show-vars: VARS?=%
-show-vars:
+show-vars: check-make-version
 	@:
 	$(info $(call clean-json, { \
 			$(foreach V, \
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 6 lines · Giulio Benetti

Make 4.3 is buggy and leads to a "Segmentation fault (core dumped)" when calling 'make printvars' or 'make show-vars', so let's refuse to execute those recipes if Make 4.3 by adding 'check-make-version' recipe as depedendency of 'printvars' and 'show-vars' as suggested by Yann E. Morin.

Yeah, this has been bothering me for ages... I hope this gets fixed soon.

Applied to master, thanks.

Regards,
Arnout

Quoted 32 lines
---
  Makefile | 11 +++++++++--
  1 file changed, 9 insertions(+), 2 deletions(-)
Makefile +8 -1
index 0b8c7b2867..ac98b84425 100644
@@ -1058,13 +1058,20 @@ ifeq ($(NEED_WRAPPER),y)
  	$(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O)
  endif
 
+.PHONY: check-make-version
+check-make-version:
+ifneq ($(filter $(RUNNING_MAKE_VERSION),4.3),)
+	@echo "Make 4.3 doesn't support 'printvars' and 'show-vars' recipes"
+	@exit 1
+endif
+
  # printvars prints all the variables currently defined in our
  # Makefiles. Alternatively, if a non-empty VARS variable is passed,
  # only the variables matching the make pattern passed in VARS are
  # displayed.
  # show-vars does the same, but as a JSON dictionnary.
  .PHONY: printvars
-printvars:
+printvars: check-make-version
  	@:
  	$(foreach V, \
  		$(sort $(filter $(VARS),$(.VARIABLES))), \

Makefile printvars: · line 1090

Quoted 8 lines
Makefile +1 -1
@@ -1077,7 +1084,7 @@ printvars:
 
  .PHONY: show-vars
  show-vars: VARS?=%
-show-vars:
+show-vars: check-make-version
  	@:
  	$(info $(call clean-json, { \
  			$(foreach V, \

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
In reply to Giulio Benetti
Quoted 5 lines · Giulio Benetti

Make 4.3 is buggy and leads to a "Segmentation fault (core dumped)" when calling 'make printvars' or 'make show-vars', so let's refuse to execute those recipes if Make 4.3 by adding 'check-make-version' recipe as depedendency of 'printvars' and 'show-vars' as suggested by Yann E. Morin.

FYI autobuilder threads seem to die when this gets hit:
make: *** [Makefile:1056: check-make-version] Error 1
Process Process-12:
Traceback (most recent call last):
File "/usr/lib/python3.10/multiprocessing/process.py", line 315, in _bootstrap

    self.run()
  File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)

File "/home/autobuild/buildroot-test/scripts/autobuild-run", line
748, in run_instance
self.run_one_build()
File "/home/autobuild/buildroot-test/scripts/autobuild-run", line
731, in run_one_build
ret = self.do_reproducible_build()
File "/home/autobuild/buildroot-test/scripts/autobuild-run", line
524, in do_reproducible_build
ret = self.check_reproducibility()
File "/home/autobuild/buildroot-test/scripts/autobuild-run", line
416, in check_reproducibility
prefix = subprocess.check_output(["make", "--no-print-directory",
"O=%s" % self.outputdir,
File "/usr/lib/python3.10/subprocess.py", line 420, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.10/subprocess.py", line 524, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['make', '--no-print-directory', 'O=/home/autobuild/autobuild/instance-11/output-1', '-C', 'instance-11/buildroot', 'printvars', 'VARS=TARGET_CROSS']' returned non-zero exit status 2.

Quoted 44 lines
---
 Makefile | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
Makefile +9 -3
index 0b8c7b2867..ac98b84425 100644
@@ -1058,13 +1058,20 @@ ifeq ($(NEED_WRAPPER),y)
        $(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O)
 endif
 
+.PHONY: check-make-version
+check-make-version:
+ifneq ($(filter $(RUNNING_MAKE_VERSION),4.3),)
+       @echo "Make 4.3 doesn't support 'printvars' and 'show-vars' recipes"
+       @exit 1
+endif
+
 # printvars prints all the variables currently defined in our
 # Makefiles. Alternatively, if a non-empty VARS variable is passed,
 # only the variables matching the make pattern passed in VARS are
 # displayed.
 # show-vars does the same, but as a JSON dictionnary.
 .PHONY: printvars
-printvars:
+printvars: check-make-version
        @:
        $(foreach V, \
                $(sort $(filter $(VARS),$(.VARIABLES))), \
@@ -1077,7 +1084,7 @@ printvars:
 
 .PHONY: show-vars
 show-vars: VARS?=%
-show-vars:
+show-vars: check-make-version
        @:
        $(info $(call clean-json, { \
                        $(foreach V, \
--

2.25.1

Quoted 4 lines

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

Hi James,

Quoted 30 lines · James Hilliard
Quoted 5 lines · Giulio Benetti

Make 4.3 is buggy and leads to a "Segmentation fault (core dumped)" when calling 'make printvars' or 'make show-vars', so let's refuse to execute those recipes if Make 4.3 by adding 'check-make-version' recipe as depedendency of 'printvars' and 'show-vars' as suggested by Yann E. Morin.

FYI autobuilder threads seem to die when this gets hit:
make: *** [Makefile:1056: check-make-version] Error 1
Process Process-12:
Traceback (most recent call last):
File "/usr/lib/python3.10/multiprocessing/process.py", line 315, in _bootstrap

     self.run()
   File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run
     self._target(*self._args, **self._kwargs)

File "/home/autobuild/buildroot-test/scripts/autobuild-run", line
748, in run_instance
self.run_one_build()
File "/home/autobuild/buildroot-test/scripts/autobuild-run", line
731, in run_one_build
ret = self.do_reproducible_build()
File "/home/autobuild/buildroot-test/scripts/autobuild-run", line
524, in do_reproducible_build
ret = self.check_reproducibility()
File "/home/autobuild/buildroot-test/scripts/autobuild-run", line
416, in check_reproducibility
prefix = subprocess.check_output(["make", "--no-print-directory",
"O=%s" % self.outputdir,
File "/usr/lib/python3.10/subprocess.py", line 420, in check_output

Quoted 8 lines

return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.10/subprocess.py", line 524, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['make', '--no-print-directory', 'O=/home/autobuild/autobuild/instance-11/output-1', '-C', 'instance-11/buildroot', 'printvars', 'VARS=TARGET_CROSS']' returned non-zero exit status 2.

Do you have an autobuilder failure link?
So I can reproduce it here and find a work-around for it.

Thank you!
Best regards

Signature · 2 lines
Giulio Benetti
Benetti Engineering sas
Quoted 45 lines
Quoted 45 lines
---
  Makefile | 11 +++++++++--
  1 file changed, 9 insertions(+), 2 deletions(-)
Makefile +9 -3
index 0b8c7b2867..ac98b84425 100644
@@ -1058,13 +1058,20 @@ ifeq ($(NEED_WRAPPER),y)
         $(Q)$(TOPDIR)/support/scripts/mkmakefile $(TOPDIR) $(O)
  endif
 
+.PHONY: check-make-version
+check-make-version:
+ifneq ($(filter $(RUNNING_MAKE_VERSION),4.3),)
+       @echo "Make 4.3 doesn't support 'printvars' and 'show-vars' recipes"
+       @exit 1
+endif
+
  # printvars prints all the variables currently defined in our
  # Makefiles. Alternatively, if a non-empty VARS variable is passed,
  # only the variables matching the make pattern passed in VARS are
  # displayed.
  # show-vars does the same, but as a JSON dictionnary.
  .PHONY: printvars
-printvars:
+printvars: check-make-version
         @:
         $(foreach V, \
                 $(sort $(filter $(VARS),$(.VARIABLES))), \
@@ -1077,7 +1084,7 @@ printvars:
 
  .PHONY: show-vars
  show-vars: VARS?=%
-show-vars:
+show-vars: check-make-version
         @:
         $(info $(call clean-json, { \
                         $(foreach V, \
--

2.25.1

Quoted 4 lines
Quoted 4 lines

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw
Quoted 42 lines · Giulio Benetti

Hi James,

Quoted 30 lines · James Hilliard
Quoted 5 lines · Giulio Benetti

Make 4.3 is buggy and leads to a "Segmentation fault (core dumped)" when calling 'make printvars' or 'make show-vars', so let's refuse to execute those recipes if Make 4.3 by adding 'check-make-version' recipe as depedendency of 'printvars' and 'show-vars' as suggested by Yann E. Morin.

FYI autobuilder threads seem to die when this gets hit:
make: *** [Makefile:1056: check-make-version] Error 1
Process Process-12:
Traceback (most recent call last):
   File "/usr/lib/python3.10/multiprocessing/process.py", line 315, in _bootstrap self.run()
   File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs)
   File "/home/autobuild/buildroot-test/scripts/autobuild-run", line 748, in run_instance
     self.run_one_build()
   File "/home/autobuild/buildroot-test/scripts/autobuild-run", line 731, in run_one_build
     ret = self.do_reproducible_build()
   File "/home/autobuild/buildroot-test/scripts/autobuild-run", line 524, in do_reproducible_build
     ret = self.check_reproducibility()
   File "/home/autobuild/buildroot-test/scripts/autobuild-run", line 416, in check_reproducibility
     prefix = subprocess.check_output(["make", "--no-print-directory", "O=%s" % self.outputdir,
   File "/usr/lib/python3.10/subprocess.py", line 420, in check_output

Quoted 8 lines

     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib/python3.10/subprocess.py", line 524, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['make', '--no-print-directory', 'O=/home/autobuild/autobuild/instance-11/output-1', '-C', 'instance-11/buildroot', 'printvars', 'VARS=TARGET_CROSS']' returned non-zero exit status 2.

Quoted 2 lines

Do you have an autobuilder failure link?
So I can reproduce it here and find a work-around for it.

It's the autobuilder script (from the buildroot-test repository) itself that
crashes. I suspect it isn't able to send in its results after that. There is a separate process for each autobuilder instance, but I don't think they are restarted when they crash so eventually all instances will die.

Note that this is only invoked if a reproducibility error was detected.

@James: do like Thomas, install an earlier make on your system :-)

Regards,
Arnout
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw

Arnout, Giulio, James, All,

On 2022-07-27 10:38 +0200, Arnout Vandecappelle spake thusly:

Quoted 9 lines · Giulio Benetti
Quoted 8 lines · James Hilliard
Quoted 7 lines
Quoted 4 lines · Giulio Benetti

Make 4.3 is buggy and leads to a "Segmentation fault (core dumped)" when calling 'make printvars' or 'make show-vars', so let's refuse to execute those recipes if Make 4.3 by adding 'check-make-version' recipe as depedendency of 'printvars' and 'show-vars' as suggested by Yann E. Morin.

FYI autobuilder threads seem to die when this gets hit:

[--SNIP--]

Quoted 10 lines
Quoted 2 lines

Do you have an autobuilder failure link?
So I can reproduce it here and find a work-around for it.

It's the autobuilder script (from the buildroot-test repository) itself
that crashes. I suspect it isn't able to send in its results after that. There is a separate process for each autobuilder instance, but I don't think they are restarted when they crash so eventually all instances will die.

Note that this is only invoked if a reproducibility error was detected.

@James: do like Thomas, install an earlier make on your system :-)

That will no longer ne necessary, as we now have a working workaround for that, that I just pushed:

5c54c3ef3db2 Makefile: workaround make 4.3 issue for 'printvars and 'show-vars'

Regards,
Yann E. MORIN.

Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot