Skip to contentSkip to conversation

Compatibility make fixes for meson

PATCH Applied Roman Bolshakov 4 participants 12 messages Aug 25, 2020 – Dec 14, 2020 Kbuild

lore
Share & tools
lore
#0 lore raw

v2 cover Compatibility make fixes for meson

The set of changes addresses "Diagnose "make is too old" in configure (or in the makefile?)" from https://wiki.qemu.org/Features/Meson#Easy.
It also provides cleaner backwards compatible build invocation on macOS.

Changes since v1:
- Added explicit error for partially-completed configure (Eric B.)
- Added an empty rule for config-host.mak to avoid second call of recursive make (which happened because of implicit force rule)

Roman Bolshakov (4):
configure: Use discovered make for in-source build
Makefile: Require GNU make 3.82+
configure: Prefer gmake on darwin
configure: Test if $make actually exists

 Makefile  |  5 +++++
 configure | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)
Signature · 1 line
2.28.0
#1 lore raw

PATCH v2 1/4 configure: Use discovered make for in-source build

A recursive make is invoked if in-source build is used but $(MAKE) is the same as the one used in the original make invocation.

Some platforms have preference to use gmake, or a make passed as an option to "configure". Honor the choice.

---
 configure | 6 ++++++
 1 file changed, 6 insertions(+)
configure +6 -0
index b1e11397a8..07732bf011 100755
@@ -38,6 +38,11 @@ then
 # This file is auto-generated by configure to support in-source tree
 # 'make' command invocation
 
+ifeq ($(wildcard build/config-host.mak),)
+$(error Incomplete configuration. Please run `configure`)
+endif
+include build/config-host.mak
+
 ifeq ($(MAKECMDGOALS),)
 recurse: all
 endif
@@ -54,6 +59,7 @@ endif
 force: ;
 .PHONY: force
 GNUmakefile: ;
+build/config-host.mak: ;
 
 EOF
     cd build
Signature · 1 line
2.28.0
#2 lore raw

PATCH v2 2/4 Makefile: Require GNU make 3.82+

In reply to Roman Bolshakov

QEMU build fails with cryptic messages if make is too old:

Makefile.ninja:2655: *** multiple target patterns. Stop.

To avoid the confusion it's worth to fail the build right away and print a friendly error message.

---
 Makefile | 5 +++++
 1 file changed, 5 insertions(+)
Makefile +5 -0
index 81794d5c34..b4ebf3e30f 100644
@@ -4,6 +4,11 @@ ifneq ($(words $(subst :, ,$(CURDIR))), 1)
   $(error main directory cannot contain spaces nor colons)
 endif
 
+ifeq ($(filter undefine,$(value .FEATURES)),)
+$(error Unsupported Make version: $(MAKE_VERSION). \
+        Please use GNU Make 3.82 or above)
+endif
+
 # Always point to the root of the build tree (needs GNU make).
 BUILD_DIR=$(CURDIR)
 
Signature · 1 line
2.28.0
Reviewed-by on v2 2/4
#3 lore raw

Re: [PATCH v2 2/4] Makefile: Require GNU make 3.82+

Quoted 18 lines · Roman Bolshakov

QEMU build fails with cryptic messages if make is too old:

Makefile.ninja:2655: *** multiple target patterns. Stop.

To avoid the confusion it's worth to fail the build right away and print a friendly error message.

---
 Makefile | 5 +++++
 1 file changed, 5 insertions(+)
Makefile +0 -0
index 81794d5c34..b4ebf3e30f 100644

Makefile ifneq ($(words $(subst :, ,$(CURDIR))), 1) · line 13

Quoted 10 lines
Makefile +5 -0
@@ -4,6 +4,11 @@ ifneq ($(words $(subst :, ,$(CURDIR))), 1)
   $(error main directory cannot contain spaces nor colons)
 endif
 
+ifeq ($(filter undefine,$(value .FEATURES)),)
+$(error Unsupported Make version: $(MAKE_VERSION). \
+        Please use GNU Make 3.82 or above)
+endif
+
 # Always point to the root of the build tree (needs GNU make).
 BUILD_DIR=$(CURDIR)
#4 lore raw

Re: [PATCH v2 2/4] Makefile: Require GNU make 3.82+

Le 12/10/2020 à 11:47, Thomas Huth a écrit :

Quoted 22 lines · Roman Bolshakov
Quoted 21 lines

QEMU build fails with cryptic messages if make is too old:

Makefile.ninja:2655: *** multiple target patterns. Stop.

To avoid the confusion it's worth to fail the build right away and print a friendly error message.

---
 Makefile | 5 +++++
 1 file changed, 5 insertions(+)
Makefile +0 -0
index 81794d5c34..b4ebf3e30f 100644
@@ -4,6 +4,11 @@ ifneq ($(words $(subst :, ,$(CURDIR))), 1)
   $(error main directory cannot contain spaces nor colons)
 endif
 
Quoted 11 lines

Makefile ifneq ($(words $(subst :, ,$(CURDIR))), 1) · line 13

Quoted 7 lines
Makefile +5 -0
+ifeq ($(filter undefine,$(value .FEATURES)),)
+$(error Unsupported Make version: $(MAKE_VERSION). \
+        Please use GNU Make 3.82 or above)
+endif
+
 # Always point to the root of the build tree (needs GNU make).
 BUILD_DIR=$(CURDIR)

Applied to my trivial-patches branch.

Thanks,
Laurent

#5 lore raw

Re: [PATCH v2 2/4] Makefile: Require GNU make 3.82+

Quoted 22 lines · Laurent Vivier
Quoted 8 lines · Thomas Huth
Quoted 7 lines · Roman Bolshakov

QEMU build fails with cryptic messages if make is too old:

Makefile.ninja:2655: *** multiple target patterns. Stop.

To avoid the confusion it's worth to fail the build right away and print a friendly error message.

Quoted 11 lines

Makefile ifneq ($(words $(subst :, ,$(CURDIR))), 1) · line 13

Quoted 7 lines
Makefile +5 -0
+ifeq ($(filter undefine,$(value .FEATURES)),)
+$(error Unsupported Make version: $(MAKE_VERSION). \
+        Please use GNU Make 3.82 or above)
+endif
+
 # Always point to the root of the build tree (needs GNU make).
 BUILD_DIR=$(CURDIR)
Quoted 1 line

Applied to my trivial-patches branch.

Commit 09e93326e448ab4 says that the switch to ninja from ninjatool removed the requirement for Make 3.82. Is this change still required?

thanks
-- PMM

#6 lore raw

Re: [PATCH v2 2/4] Makefile: Require GNU make 3.82+

Le 13/12/2020 à 20:04, Peter Maydell a écrit :

Quoted 23 lines · Laurent Vivier
Quoted 22 lines · Thomas Huth
Quoted 19 lines · Roman Bolshakov
Quoted 7 lines

QEMU build fails with cryptic messages if make is too old:

Makefile.ninja:2655: *** multiple target patterns. Stop.

To avoid the confusion it's worth to fail the build right away and print a friendly error message.

Makefile ifneq ($(words $(subst :, ,$(CURDIR))), 1) · line 13

Quoted 7 lines
Makefile +5 -0
+ifeq ($(filter undefine,$(value .FEATURES)),)
+$(error Unsupported Make version: $(MAKE_VERSION). \
+        Please use GNU Make 3.82 or above)
+endif
+
 # Always point to the root of the build tree (needs GNU make).
 BUILD_DIR=$(CURDIR)
Quoted 6 lines
Quoted 1 line

Applied to my trivial-patches branch.

Commit 09e93326e448ab4 says that the switch to ninja from ninjatool removed the requirement for Make 3.82. Is this change still required?

It seems 09e93326e448ab4 has been committed on 17th of October, so after Thomas' review. I remove it from my queue.

Thanks,
Laurent

#7 lore raw

Re: [PATCH v2 2/4] Makefile: Require GNU make 3.82+

Quoted 26 lines · Laurent Vivier

Le 13/12/2020 à 20:04, Peter Maydell a écrit :

Quoted 25 lines · Laurent Vivier
Quoted 23 lines · Thomas Huth
Quoted 8 lines · Roman Bolshakov
Quoted 7 lines

QEMU build fails with cryptic messages if make is too old:

Makefile.ninja:2655: *** multiple target patterns. Stop.

To avoid the confusion it's worth to fail the build right away and print a friendly error message.

Quoted 11 lines

Makefile ifneq ($(words $(subst :, ,$(CURDIR))), 1) · line 13

Quoted 7 lines
Makefile +5 -0
+ifeq ($(filter undefine,$(value .FEATURES)),)
+$(error Unsupported Make version: $(MAKE_VERSION). \
+        Please use GNU Make 3.82 or above)
+endif
+
 # Always point to the root of the build tree (needs GNU make).
 BUILD_DIR=$(CURDIR)

Applied to my trivial-patches branch.

Quoted 8 lines
Quoted 4 lines

Commit 09e93326e448ab4 says that the switch to ninja from ninjatool removed the requirement for Make 3.82. Is this change still required?

It seems 09e93326e448ab4 has been committed on 17th of October, so after Thomas' review. I remove it from my queue.

I can confirm:

./configure --target-list=x86_64-softmmu --enable-trace-backends=dtrace && make -j$(nproc)

Works fine on macOS with the latest qemu HEAD. The patch can be discarded.

Regards,
Roman

#8 lore raw

PATCH v2 3/4 configure: Prefer gmake on darwin

In reply to Roman Bolshakov

New meson/make build requires GNU make 3.82+ but macOS ships 3.81 even on Big Sur while homebrew provides GNU make 4.3 as 'gmake' in $PATH.

With the change, 'make' switches over to gmake implicitly.

---
 configure | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
configure +26 -0
index 07732bf011..664084992b 100755
@@ -907,6 +907,7 @@ Darwin)
   darwin="yes"
   hax="yes"
   hvf="yes"
+  make="${MAKE-gmake}"
   LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
   if [ "$cpu" = "x86_64" ] ; then
     QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
@@ -920,6 +921,31 @@ Darwin)
   # won't work when we're compiling with gcc as a C compiler.
   QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
   HOST_VARIANT_DIR="darwin"
+  cat > GNUmakefile <<'EOF'
+# This file is auto-generated by configure to implicitly switch from a 'make'
+# invocation to 'gmake'
+
+OLD_MAKE := $(MAKE)
+
+ifeq ($(wildcard config-host.mak),)
+$(error Incomplete configuration. Please run `configure`)
+endif
+include config-host.mak
+
+ifeq ($(MAKECMDGOALS),)
+recurse: all
+endif
+
+.NOTPARALLEL: %
+%: force
+	@echo 'Switch from $(OLD_MAKE) to $(MAKE)'
+	@$(MAKE) -f Makefile $(MAKECMDGOALS)
+force: ;
+.PHONY: force
+GNUmakefile: ;
+config-host.mak: ;
+
+EOF
 ;;
 SunOS)
   solaris="yes"
Signature · 1 line
2.28.0
#9 lore raw

PATCH v2 4/4 configure: Test if $make actually exists

In reply to Roman Bolshakov

configure doesn't detect if $make is installed on the build host. This is also helpful for hosts where an alias for make is used, i.e. configure would fail if gmake is not present on macOS.

---
 configure | 4 ++++
 1 file changed, 4 insertions(+)
configure +4 -0
index 664084992b..9230832da2 100755
@@ -2029,6 +2029,10 @@ if test -z "$python"
 then
     error_exit "Python not found. Use --python=/path/to/python"
 fi
+if ! has "$make"
+then
+    error_exit "GNU make ($make) not found"
+fi
 
 # Note that if the Python conditional here evaluates True we will exit
 # with status 1 which is a shell 'false' value.
Signature · 1 line
2.28.0
Reviewed-by on v2 4/4
#10 lore raw

Re: [PATCH v2 4/4] configure: Test if $make actually exists

Quoted 16 lines · Roman Bolshakov

configure doesn't detect if $make is installed on the build host. This is also helpful for hosts where an alias for make is used, i.e. configure would fail if gmake is not present on macOS.

---
 configure | 4 ++++
 1 file changed, 4 insertions(+)
configure +0 -0
index 664084992b..9230832da2 100755

configure if test -z "$python" · line 2038

Quoted 10 lines
configure +4 -0
@@ -2029,6 +2029,10 @@ if test -z "$python"
 then
     error_exit "Python not found. Use --python=/path/to/python"
 fi
+if ! has "$make"
+then
+    error_exit "GNU make ($make) not found"
+fi
 
 # Note that if the Python conditional here evaluates True we will exit
 # with status 1 which is a shell 'false' value.
#11 lore raw

Re: [PATCH v2 4/4] configure: Test if $make actually exists

Le 12/10/2020 à 11:49, Thomas Huth a écrit :

Quoted 24 lines · Roman Bolshakov
Quoted 23 lines

configure doesn't detect if $make is installed on the build host. This is also helpful for hosts where an alias for make is used, i.e. configure would fail if gmake is not present on macOS.

---
 configure | 4 ++++
 1 file changed, 4 insertions(+)
configure +4 -0
index 664084992b..9230832da2 100755
@@ -2029,6 +2029,10 @@ if test -z "$python"
 then
     error_exit "Python not found. Use --python=/path/to/python"
 fi
+if ! has "$make"
+then
+    error_exit "GNU make ($make) not found"
+fi
 
Quoted 7 lines

configure if test -z "$python" · line 2038

Quoted 3 lines
configure +0 -0
 # Note that if the Python conditional here evaluates True we will exit
 # with status 1 which is a shell 'false' value.

Applied to my trivial-patches branch.

Thanks,
Laurent