Skip to contentSkip to conversation

build: fix tools and stubdom build

PATCH In review Wei Liu 4 participants 9 messages May 16, 2017 – May 17, 2017

lore
Share & tools
lore
author
#1 lore raw

PATCH 1/2 tools/Rules.mk: honour CPPFLAGS in header check

In reply to Wei Liu

It could contain vital information about header location in a cross-build environment like stubdom.

---
Cc: Steven Haigh <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Julien Grall <[email protected]>

---
 tools/Rules.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/Rules.mk +1 -1
index 7cb28f5c4e..f592241c81 100644
@@ -226,7 +226,7 @@ INSTALL_PYTHON_PROG = \
 
 headers.chk:
 	for i in $(filter %.h,$^); do \
-	    $(CC) -x c -ansi -Wall -Werror $(CFLAGS_xeninclude) \
+	    $(CC) $(CPPFLAGS) -x c -ansi -Wall -Werror $(CFLAGS_xeninclude) \
 	          -S -o /dev/null $$i || exit 1; \
 	    echo $$i; \
 	done >[email protected]
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Wei Liu

author
#0 lore raw

cover build: fix tools and stubdom build

Wei Liu (2):
tools/Rules.mk: honour CPPFLAGS in header check
build: fix tools/include and stubdom build

 stubdom/Makefile       | 13 +++----------
 tools/Rules.mk         |  2 +-
 tools/include/Makefile | 34 ++++++++++++++++++----------------
 3 files changed, 22 insertions(+), 27 deletions(-)
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#2 lore raw

PATCH 2/2 build: fix tools/include and stubdom build

Build can fail if stubdom build is run before tools build because:

1. tools/include build uses relative path and depends on XEN_OS
2. stubdom needs tools/include to be built, at which time XEN_OS is mini-os and corresponding symlinks are created
3. libraries inside tools needs tools/include to be built, at which time XEN_OS is the host os name, but symlinks won't be created because they are already there
4. libraries get the wrong headers and fail to build

Fix this by using absolute paths in tools/include Makefile. Provide mechanism to override the prefix in paths. Use that mechanism in stubdom build to reduce code duplication.

---
Cc: Steven Haigh <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Samuel Thibault <[email protected]>
Cc: Julien Grall <[email protected]>

---
 stubdom/Makefile       | 13 +++----------
 tools/include/Makefile | 34 ++++++++++++++++++----------------
 2 files changed, 21 insertions(+), 26 deletions(-)
stubdom/Makefile +3 -10
index 54a2bdda0e..0875f0d7c2 100644
@@ -353,16 +353,9 @@ LINK_DIRS := libxc-$(XEN_TARGET_ARCH) xenstore $(foreach dir,$(LINK_LIBS_DIRS),l
 LINK_STAMPS := $(foreach dir,$(LINK_DIRS),$(dir)/stamp)
 
 mk-headers-$(XEN_TARGET_ARCH): $(IOEMU_LINKFARM_TARGET) $(LINK_STAMPS)
-	$(MAKE) -C $(XEN_ROOT)/tools/include
-	mkdir -p include/xen && \
-          ln -sf $(wildcard $(XEN_ROOT)/xen/include/public/*.h) include/xen && \
-          ln -sf $(addprefix $(XEN_ROOT)/xen/include/public/,arch-x86 hvm io xsm) include/xen && \
-          ( [ -h include/xen/sys ] || ln -sf $(XEN_ROOT)/tools/include/xen-sys/MiniOS include/xen/sys ) && \
-          ( [ -h include/xen/libelf ] || ln -sf $(XEN_ROOT)/tools/include/xen/libelf include/xen/libelf ) && \
-	  mkdir -p include/xen-foreign && \
-	  ln -sf $(wildcard $(XEN_ROOT)/tools/include/xen-foreign/*) include/xen-foreign/ && \
-	  $(MAKE) DESTDIR= -C include/xen-foreign/ && \
-	  ( [ -h include/xen/foreign ] || ln -sf ../xen-foreign include/xen/foreign )
+	rm -rf include
+	mkdir -p include/xen/libelf
+	$(MAKE) -C $(XEN_ROOT)/tools/include TOOLS_INCLUDE_PREFIX=$(CURDIR)/include/
 	$(MAKE) DESTDIR= -C $(MINI_OS) links
 	touch mk-headers-$(XEN_TARGET_ARCH)
 
tools/include/Makefile +18 -16
index f1af91c129..8b623566b2 100644
@@ -4,32 +4,34 @@ include $(XEN_ROOT)/tools/Rules.mk
 # Relative to $(XEN_ROOT)/xen/xsm/flask
 FLASK_H_DEPEND := policy/initial_sids
 
+TOOLS_INCLUDE_PREFIX ?= $(XEN_ROOT)/tools/include
+
 .PHONY: all
-all: xen-foreign xen/.dir xen-xsm/.dir
+all: $(addprefix $(TOOLS_INCLUDE_PREFIX)/, xen-foreign xen/.dir xen-xsm/.dir)
 
-.PHONY: xen-foreign
-xen-foreign:
+.PHONY: $(TOOLS_INCLUDE_PREFIX)/xen-foreign
+$(TOOLS_INCLUDE_PREFIX)/xen-foreign:
 	$(MAKE) -C xen-foreign
 
-xen/.dir:
-	@rm -rf xen
-	mkdir -p xen/libelf
-	ln -sf $(XEN_ROOT)/xen/include/public/COPYING xen
-	ln -sf $(wildcard $(XEN_ROOT)/xen/include/public/*.h) xen
-	ln -sf $(addprefix $(XEN_ROOT)/xen/include/public/,arch-x86 arch-arm hvm io xsm) xen
-	ln -sf ../xen-sys/$(XEN_OS) xen/sys
-	ln -sf $(addprefix $(XEN_ROOT)/xen/include/xen/,libelf.h elfstructs.h) xen/libelf/
-	ln -s ../xen-foreign xen/foreign
-	ln -sf $(XEN_ROOT)/xen/include/acpi acpi
+$(TOOLS_INCLUDE_PREFIX)/xen/.dir:
+	@rm -rf $(TOOLS_INCLUDE_PREFIX)/xen
+	mkdir -p $(TOOLS_INCLUDE_PREFIX)/xen/libelf
+	ln -sf $(XEN_ROOT)/xen/include/public/COPYING $(TOOLS_INCLUDE_PREFIX)/xen
+	ln -sf $(wildcard $(XEN_ROOT)/xen/include/public/*.h) $(TOOLS_INCLUDE_PREFIX)/xen
+	ln -sf $(addprefix $(XEN_ROOT)/xen/include/public/,arch-x86 arch-arm hvm io xsm) $(TOOLS_INCLUDE_PREFIX)/xen
+	ln -sf $(CURDIR)/xen-sys/$(XEN_OS) $(TOOLS_INCLUDE_PREFIX)/xen/sys
+	ln -sf $(addprefix $(XEN_ROOT)/xen/include/xen/,libelf.h elfstructs.h) $(TOOLS_INCLUDE_PREFIX)/xen/libelf/
+	ln -sf $(CURDIR)/xen-foreign $(TOOLS_INCLUDE_PREFIX)/xen/foreign
+	ln -sf $(XEN_ROOT)/xen/include/acpi $(TOOLS_INCLUDE_PREFIX)/acpi
 	touch $@
 
 # Not xen/xsm as that clashes with link to
 # $(XEN_ROOT)/xen/include/public/xsm above.
-xen-xsm/.dir: $(XEN_ROOT)/xen/xsm/flask/policy/mkflask.sh \
+$(TOOLS_INCLUDE_PREFIX)/xen-xsm/.dir: $(XEN_ROOT)/xen/xsm/flask/policy/mkflask.sh \
 	      $(patsubst %,$(XEN_ROOT)/xen/xsm/flask/%,$(FLASK_H_DEPEND))
-	mkdir -p xen-xsm/flask
+	mkdir -p $(TOOLS_INCLUDE_PREFIX)/xen-xsm/flask
 	cd $(XEN_ROOT)/xen/xsm/flask/ && \
-		$(SHELL) policy/mkflask.sh $(AWK) $(CURDIR)/xen-xsm/flask $(FLASK_H_DEPEND)
+		$(SHELL) policy/mkflask.sh $(AWK) $(TOOLS_INCLUDE_PREFIX)/xen-xsm/flask $(FLASK_H_DEPEND)
 	touch $@
 
 .PHONY: install
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 2/2
#3 lore raw

Re: [PATCH for-4.9 2/2] build: fix tools/include and stubdom build

Quoted 10 lines · Wei Liu, on mar. 16 mai 2017 11:47:30 +0100, wrote:

Build can fail if stubdom build is run before tools build because:

1. tools/include build uses relative path and depends on XEN_OS
2. stubdom needs tools/include to be built, at which time XEN_OS is mini-os and corresponding symlinks are created
3. libraries inside tools needs tools/include to be built, at which time XEN_OS is the host os name, but symlinks won't be created because they are already there
4. libraries get the wrong headers and fail to build

Quoted 6 lines

Fix this by using absolute paths in tools/include Makefile. Provide mechanism to override the prefix in paths. Use that mechanism in stubdom build to reduce code duplication.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw
In reply to Wei Liu
Quoted 8 lines · Wei Liu

Wei Liu (2):
tools/Rules.mk: honour CPPFLAGS in header check
build: fix tools/include and stubdom build

 stubdom/Makefile       | 13 +++----------
 tools/Rules.mk         |  2 +-
 tools/include/Makefile | 34 ++++++++++++++++++----------------
 3 files changed, 22 insertions(+), 27 deletions(-)

I have been seeing mixed results with these patches.

I can confirm that they seem to fix the problem with building on RHEL7 - however on RHEL6, the packages still fail to build.

I have copied the build log to:
https://cloud.crc.id.au/index.php/s/iTWJE3A1TQBhgDq

So far:
EL7 - Successful builds: 4/4
EL6 - Successful builds: 0/4

Signature · 5 lines
Steven Haigh

Email: [email protected]
Web: https://www.crc.id.au
Phone: (03) 9001 6090 - 0412 935 897

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#5 lore raw
Quoted 15 lines · Steven Haigh
Quoted 8 lines · Wei Liu

Wei Liu (2):
tools/Rules.mk: honour CPPFLAGS in header check
build: fix tools/include and stubdom build

 stubdom/Makefile       | 13 +++----------
 tools/Rules.mk         |  2 +-
 tools/include/Makefile | 34 ++++++++++++++++++----------------
 3 files changed, 22 insertions(+), 27 deletions(-)

I have been seeing mixed results with these patches.

I can confirm that they seem to fix the problem with building on RHEL7 - however on RHEL6, the packages still fail to build.

Quoted 6 lines

I have copied the build log to:
https://cloud.crc.id.au/index.php/s/iTWJE3A1TQBhgDq

So far:
EL7 - Successful builds: 4/4
EL6 - Successful builds: 0/4

Thanks for testing.

I think there is yet another bug in the build system. Let me write a new version.

Quoted 8 lines
Signature · 6 lines
-- 
Steven Haigh

Email: [email protected]
Web: https://www.crc.id.au
Phone: (03) 9001 6090 - 0412 935 897

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#6 lore raw
In reply to Wei Liu

Hi Wei,

Quoted 2 lines · Wei Liu

Wei Liu (2):
tools/Rules.mk: honour CPPFLAGS in header check

Assuming this patch got ack...

Quoted 1 line

build: fix tools/include and stubdom build

...

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#7 lore raw
Quoted 6 lines · Julien Grall

Hi Wei,

Quoted 2 lines · Wei Liu

Wei Liu (2):
tools/Rules.mk: honour CPPFLAGS in header check

Quoted 8 lines

Assuming this patch got ack...

Quoted 1 line

build: fix tools/include and stubdom build

...

This series is superseded by

[PATCH for-4.9 v2] build: stubdom and tools should depend on public header target

Quoted 4 lines

Cheers,

Signature · 1 line
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#8 lore raw
Quoted 13 lines · Wei Liu
Quoted 12 lines · Julien Grall

Hi Wei,

Quoted 2 lines · Wei Liu

Wei Liu (2):
tools/Rules.mk: honour CPPFLAGS in header check

Assuming this patch got ack...

Quoted 1 line

build: fix tools/include and stubdom build

...

Quoted 7 lines
Quoted 2 lines

This series is superseded by

[PATCH for-4.9 v2] build: stubdom and tools should depend on public header target

Oh, I was not sure. Thank you for the heads-up.

Cheers,

Quoted 5 lines
Quoted 5 lines

Cheers,

--
Julien Grall

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel