Re: arm32 tools/flask build failure

2020-12-17 Thread Jan Beulich
On 17.12.2020 02:54, Stefano Stabellini wrote:
> On Tue, 15 Dec 2020, Stefano Stabellini wrote:
>> Hi all,
>>
>> I am building Xen tools for ARM32 using qemu-user. I am getting the
>> following error building tools/flask. Everything else works fine. It is
>> worth noting that make -j1 works fine, it is only make -j4 that fails.
>>
>> I played with .NOTPARALLEL but couldn't get it to work. Anyone has any
>> ideas?
>>
>> Cheers,
>>
>> Stefano
>>
>>
>> make[2]: Leaving directory '/build/tools/flask/utils'
>> make[1]: Leaving directory '/build/tools/flask'
>> make[1]: Entering directory '/build/tools/flask'
>> /usr/bin/make -C policy all
>> make[2]: Entering directory '/build/tools/flask/policy'
>> make[2]: warning: jobserver unavailable: using -j1.  Add '+' to parent make 
>> rule.
>> /build/tools/flask/policy/Makefile.common:115: *** target pattern contains 
>> no '%'.  Stop.
>> make[2]: Leaving directory '/build/tools/flask/policy'
>> make[1]: *** [/build/tools/flask/../../tools/Rules.mk:160: 
>> subdir-all-policy] Error 2
>> make[1]: Leaving directory '/build/tools/flask'
>> make: *** [/build/tools/flask/../../tools/Rules.mk:155: subdirs-all] Error 2
> 
> 
> The fix seems to be turning the problematic variable:
> 
> POLICY_FILENAME = $(FLASK_BUILD_DIR)/xenpolicy-$(shell $(MAKE) -C 
> $(XEN_ROOT)/xen xenversion --no-print-directory)
> 
> into a rule.

At a first glance this looks like just papering over the issue. When
I had looked at it yesterday after seeing your mail, I didn't even
spot this "interesting" make recursion. What I'd like to understand
first is where the % is coming from - the error message clearly
suggests that there's a % in the filename. Yet

.PHONY: xenversion
xenversion:
@echo $(XEN_FULLVERSION)

doesn't make clear to me where the % might be coming from. Of course
there's nothing at all precluding e.g. $(XEN_VENDORVERSION) to
contain a % character, but I don't think that's what you're running
into.

> --- a/tools/flask/policy/Makefile.common
> +++ b/tools/flask/policy/Makefile.common
> @@ -35,7 +35,6 @@ OUTPUT_POLICY ?= $(BEST_POLICY_VER)
>  #
>  
>  
> -POLICY_FILENAME = $(FLASK_BUILD_DIR)/xenpolicy-$(shell $(MAKE) -C 
> $(XEN_ROOT)/xen xenversion --no-print-directory)
>  POLICY_LOADPATH = /boot
>  
>  # List of policy versions supported by the hypervisor
> @@ -112,17 +111,19 @@ POLICY_SECTIONS += $(USERS)
>  POLICY_SECTIONS += $(ALL_CONSTRAINTS)
>  POLICY_SECTIONS += $(ISID_DEFS) $(DEV_OCONS)
>  
> -all: $(POLICY_FILENAME)
> +policy:

This is a phony target, isn't it? It then also needs marking so.
However, ...

> -install: $(POLICY_FILENAME)
> +all: policy
> +
> +install: policy
>   $(INSTALL_DIR) $(DESTDIR)/$(POLICY_LOADPATH)
>   $(INSTALL_DATA) $^ $(DESTDIR)/$(POLICY_LOADPATH)
>  
>  uninstall:
>   rm -f $(DESTDIR)/$(POLICY_LOADPATH)/$(POLICY_FILENAME)
>  
> -$(POLICY_FILENAME): $(FLASK_BUILD_DIR)/policy.conf
> - $(CHECKPOLICY) $(CHECKPOLICY_PARAM) $^ -o $@
> +policy: $(FLASK_BUILD_DIR)/policy.conf
> + $(CHECKPOLICY) $(CHECKPOLICY_PARAM) $^ -o xenpolicy-"$$($(MAKE) -C 
> $(XEN_ROOT)/xen xenversion --no-print-directory)"

... wouldn't it make sense to latch the version into an output
file, and use that as the target? Along the lines of

xenversion:
$(MAKE) -C $(XEN_ROOT)/xen --no-print-directory $@ >$@

but possibly utilizing move-if-changed. This would then result in
more "conventional" make recursion.

Jan



Re: arm32 tools/flask build failure

2020-12-16 Thread Stefano Stabellini
On Tue, 15 Dec 2020, Stefano Stabellini wrote:
> Hi all,
> 
> I am building Xen tools for ARM32 using qemu-user. I am getting the
> following error building tools/flask. Everything else works fine. It is
> worth noting that make -j1 works fine, it is only make -j4 that fails.
> 
> I played with .NOTPARALLEL but couldn't get it to work. Anyone has any
> ideas?
> 
> Cheers,
> 
> Stefano
> 
> 
> make[2]: Leaving directory '/build/tools/flask/utils'
> make[1]: Leaving directory '/build/tools/flask'
> make[1]: Entering directory '/build/tools/flask'
> /usr/bin/make -C policy all
> make[2]: Entering directory '/build/tools/flask/policy'
> make[2]: warning: jobserver unavailable: using -j1.  Add '+' to parent make 
> rule.
> /build/tools/flask/policy/Makefile.common:115: *** target pattern contains no 
> '%'.  Stop.
> make[2]: Leaving directory '/build/tools/flask/policy'
> make[1]: *** [/build/tools/flask/../../tools/Rules.mk:160: subdir-all-policy] 
> Error 2
> make[1]: Leaving directory '/build/tools/flask'
> make: *** [/build/tools/flask/../../tools/Rules.mk:155: subdirs-all] Error 2


The fix seems to be turning the problematic variable:

POLICY_FILENAME = $(FLASK_BUILD_DIR)/xenpolicy-$(shell $(MAKE) -C 
$(XEN_ROOT)/xen xenversion --no-print-directory)

into a rule.


diff --git a/tools/flask/policy/Makefile.common 
b/tools/flask/policy/Makefile.common
index bea5ba4b6a..9a086d8acd 100644
--- a/tools/flask/policy/Makefile.common
+++ b/tools/flask/policy/Makefile.common
@@ -35,7 +35,6 @@ OUTPUT_POLICY ?= $(BEST_POLICY_VER)
 #
 
 
-POLICY_FILENAME = $(FLASK_BUILD_DIR)/xenpolicy-$(shell $(MAKE) -C 
$(XEN_ROOT)/xen xenversion --no-print-directory)
 POLICY_LOADPATH = /boot
 
 # List of policy versions supported by the hypervisor
@@ -112,17 +111,19 @@ POLICY_SECTIONS += $(USERS)
 POLICY_SECTIONS += $(ALL_CONSTRAINTS)
 POLICY_SECTIONS += $(ISID_DEFS) $(DEV_OCONS)
 
-all: $(POLICY_FILENAME)
+policy:
 
-install: $(POLICY_FILENAME)
+all: policy
+
+install: policy
$(INSTALL_DIR) $(DESTDIR)/$(POLICY_LOADPATH)
$(INSTALL_DATA) $^ $(DESTDIR)/$(POLICY_LOADPATH)
 
 uninstall:
rm -f $(DESTDIR)/$(POLICY_LOADPATH)/$(POLICY_FILENAME)
 
-$(POLICY_FILENAME): $(FLASK_BUILD_DIR)/policy.conf
-   $(CHECKPOLICY) $(CHECKPOLICY_PARAM) $^ -o $@
+policy: $(FLASK_BUILD_DIR)/policy.conf
+   $(CHECKPOLICY) $(CHECKPOLICY_PARAM) $^ -o xenpolicy-"$$($(MAKE) -C 
$(XEN_ROOT)/xen xenversion --no-print-directory)"
 
 $(FLASK_BUILD_DIR)/policy.conf: $(POLICY_SECTIONS) $(MOD_CONF)
$(M4) $(M4PARAM) $(POLICY_SECTIONS) > $@



arm32 tools/flask build failure

2020-12-15 Thread Stefano Stabellini
Hi all,

I am building Xen tools for ARM32 using qemu-user. I am getting the
following error building tools/flask. Everything else works fine. It is
worth noting that make -j1 works fine, it is only make -j4 that fails.

I played with .NOTPARALLEL but couldn't get it to work. Anyone has any
ideas?

Cheers,

Stefano


make[2]: Leaving directory '/build/tools/flask/utils'
make[1]: Leaving directory '/build/tools/flask'
make[1]: Entering directory '/build/tools/flask'
/usr/bin/make -C policy all
make[2]: Entering directory '/build/tools/flask/policy'
make[2]: warning: jobserver unavailable: using -j1.  Add '+' to parent make 
rule.
/build/tools/flask/policy/Makefile.common:115: *** target pattern contains no 
'%'.  Stop.
make[2]: Leaving directory '/build/tools/flask/policy'
make[1]: *** [/build/tools/flask/../../tools/Rules.mk:160: subdir-all-policy] 
Error 2
make[1]: Leaving directory '/build/tools/flask'
make: *** [/build/tools/flask/../../tools/Rules.mk:155: subdirs-all] Error 2