Olaf Hering
2012-Jul-12 07:51 UTC
[PATCH] tools/vtpm: fix version.h error during parallel build
# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1342079491 -7200
# Node ID 02ec826cab1e4acb25b364a180a1597ace1149f9
# Parent 42f76d536b116d2ebad1b6705ae51ecd171d2581
tools/vtpm: fix version.h error during parallel build
Generating the tpm_version.h is not make -j safe:
In file included from ../tpm/tpm_emulator.h:25:0,
from ../tpm/tpm_startup.c:18:
../tpm/tpm_version.h:1:0: error: unterminated #ifndef
make[5]: *** [tpm_startup.o] Error 1
Add another patch which adds proper dependencies in the tpm_manager Makefile.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
diff -r 42f76d536b11 -r 02ec826cab1e tools/vtpm/Makefile
--- a/tools/vtpm/Makefile
+++ b/tools/vtpm/Makefile
@@ -51,7 +51,8 @@ mrproper:
set -e; cd $(VTPM_DIR); \
patch -p1 < ../vtpm-0.5.1.patch; \
- patch -p1 < ../vtpm-0.5.1-LDLIBS.patch
+ patch -p1 < ../vtpm-0.5.1-LDLIBS.patch; \
+ patch -p1 < ../vtpm-0.5.1-version.h.patch
orig: $(TPM_EMULATOR_TARFILE)
mkdir $(ORIG_DIR);
diff -r 42f76d536b11 -r 02ec826cab1e tools/vtpm/vtpm-0.5.1-version.h.patch
--- /dev/null
+++ b/tools/vtpm/vtpm-0.5.1-version.h.patch
@@ -0,0 +1,45 @@
+
+make[4]: Entering directory
`/usr/src/packages/BUILD/xen-4.2.25602/non-dbg/tools/vtpm/vtpm''
+Making all in tpmd
+make[5]: Entering directory
`/usr/src/packages/BUILD/xen-4.2.25602/non-dbg/tools/vtpm/vtpm/tpmd''
+gcc -Wall -Wno-unused -Wpointer-arith -Wcast-align -Wwrite-strings
-Wsign-compare -Wno-multichar -g -I.. -I. -O2 -fno-strict-aliasing
-I../../../../tools/vtpm_manager/manager -c -o tpm_data.o ../tpm/tpm_data.c
+gcc -Wall -Wno-unused -Wpointer-arith -Wcast-align -Wwrite-strings
-Wsign-compare -Wno-multichar -g -I.. -I. -O2 -fno-strict-aliasing
-I../../../../tools/vtpm_manager/manager -c -o tpm_startup.o
../tpm/tpm_startup.c
+gcc -Wall -Wno-unused -Wpointer-arith -Wcast-align -Wwrite-strings
-Wsign-compare -Wno-multichar -g -I.. -I. -O2 -fno-strict-aliasing
-I../../../../tools/vtpm_manager/manager -c -o tpm_storage.o
../tpm/tpm_storage.c
+In file included from ../tpm/tpm_emulator.h:25:0,
+ from ../tpm/tpm_startup.c:18:
+../tpm/tpm_version.h:1:0: error: unterminated #ifndef
+gcc -Wall -Wno-unused -Wpointer-arith -Wcast-align -Wwrite-strings
-Wsign-compare -Wno-multichar -g -I.. -I. -O2 -fno-strict-aliasing
-I../../../../tools/vtpm_manager/manager -c -o tpm_credentials.o
../tpm/tpm_credentials.c
+make[5]: *** [tpm_startup.o] Error 1
+
+---
+ Makefile | 17 ++++++++++-------
+ 1 file changed, 10 insertions(+), 7 deletions(-)
+
+Index: tpm_emulator-0.5.1/Makefile
+==================================================================+---
tpm_emulator-0.5.1.orig/Makefile
++++ tpm_emulator-0.5.1/Makefile
+@@ -14,13 +14,16 @@ SUBDIRS := tpmd
+
+ all: version all-recursive
+
+-version:
+- @echo "#ifndef _TPM_VERSION_H_" > tpm/tpm_version.h
+- @echo "#define _TPM_VERSION_H_" >> tpm/tpm_version.h
+- @echo "#define VERSION_MAJOR $(VERSION_MAJOR)" >>
tpm/tpm_version.h
+- @echo "#define VERSION_MINOR $(VERSION_MINOR)" >>
tpm/tpm_version.h
+- @echo "#define VERSION_BUILD $(VERSION_BUILD)" >>
tpm/tpm_version.h
+- @echo "#endif /* _TPM_VERSION_H_ */" >> tpm/tpm_version.h
++tpm/tpm_version.h:
++ @echo "#ifndef _TPM_VERSION_H_" > tpm/tpm_version.h.tmp
++ @echo "#define _TPM_VERSION_H_" >> tpm/tpm_version.h.tmp
++ @echo "#define VERSION_MAJOR $(VERSION_MAJOR)" >>
tpm/tpm_version.h.tmp
++ @echo "#define VERSION_MINOR $(VERSION_MINOR)" >>
tpm/tpm_version.h.tmp
++ @echo "#define VERSION_BUILD $(VERSION_BUILD)" >>
tpm/tpm_version.h.tmp
++ @echo "#endif /* _TPM_VERSION_H_ */" >> tpm/tpm_version.h.tmp
++ mv -f tpm/tpm_version.h.tmp tpm/tpm_version.h
++
++version: tpm/tpm_version.h
+
+ clean: clean-recursive
+ rm -f tpm/tpm_version.h
Olaf Hering
2012-Jul-12 15:07 UTC
Re: [PATCH] tools/vtpm: fix version.h error during parallel build
On Thu, Jul 12, Olaf Hering wrote:> ++++ tpm_emulator-0.5.1/Makefile > +@@ -14,13 +14,16 @@ SUBDIRS := tpmd > + > + all: version all-recursiveThe actual bug is that version and all-recursive will run in parallel. To fix this all-recursive needs to depend on version. I will send a fixed version of that patch. Olaf
Olaf Hering
2012-Jul-12 15:08 UTC
[PATCH] tools/vtpm: fix version.h error during parallel build
# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1342105705 -7200
# Node ID 51506c407f3ef3e238a4154c7f72ac61093e0bce
# Parent 42f76d536b116d2ebad1b6705ae51ecd171d2581
tools/vtpm: fix version.h error during parallel build
Generating the tpm_version.h is not make -j safe:
In file included from ../tpm/tpm_emulator.h:25:0,
from ../tpm/tpm_startup.c:18:
../tpm/tpm_version.h:1:0: error: unterminated #ifndef
make[5]: *** [tpm_startup.o] Error 1
Add another patch which adds proper dependencies in the tpm_manager Makefile.
(all-recursive needs to depend on version)
Signed-off-by: Olaf Hering <olaf@aepfle.de>
diff -r 42f76d536b11 -r 51506c407f3e tools/vtpm/Makefile
--- a/tools/vtpm/Makefile
+++ b/tools/vtpm/Makefile
@@ -51,7 +51,8 @@ mrproper:
set -e; cd $(VTPM_DIR); \
patch -p1 < ../vtpm-0.5.1.patch; \
- patch -p1 < ../vtpm-0.5.1-LDLIBS.patch
+ patch -p1 < ../vtpm-0.5.1-LDLIBS.patch; \
+ patch -p1 < ../vtpm-0.5.1-version.h.patch
orig: $(TPM_EMULATOR_TARFILE)
mkdir $(ORIG_DIR);
diff -r 42f76d536b11 -r 51506c407f3e tools/vtpm/vtpm-0.5.1-version.h.patch
--- /dev/null
+++ b/tools/vtpm/vtpm-0.5.1-version.h.patch
@@ -0,0 +1,53 @@
+
+make[4]: Entering directory
`/usr/src/packages/BUILD/xen-4.2.25602/non-dbg/tools/vtpm/vtpm''
+Making all in tpmd
+make[5]: Entering directory
`/usr/src/packages/BUILD/xen-4.2.25602/non-dbg/tools/vtpm/vtpm/tpmd''
+gcc -Wall -Wno-unused -Wpointer-arith -Wcast-align -Wwrite-strings
-Wsign-compare -Wno-multichar -g -I.. -I. -O2 -fno-strict-aliasing
-I../../../../tools/vtpm_manager/manager -c -o tpm_data.o ../tpm/tpm_data.c
+gcc -Wall -Wno-unused -Wpointer-arith -Wcast-align -Wwrite-strings
-Wsign-compare -Wno-multichar -g -I.. -I. -O2 -fno-strict-aliasing
-I../../../../tools/vtpm_manager/manager -c -o tpm_startup.o
../tpm/tpm_startup.c
+gcc -Wall -Wno-unused -Wpointer-arith -Wcast-align -Wwrite-strings
-Wsign-compare -Wno-multichar -g -I.. -I. -O2 -fno-strict-aliasing
-I../../../../tools/vtpm_manager/manager -c -o tpm_storage.o
../tpm/tpm_storage.c
+In file included from ../tpm/tpm_emulator.h:25:0,
+ from ../tpm/tpm_startup.c:18:
+../tpm/tpm_version.h:1:0: error: unterminated #ifndef
+gcc -Wall -Wno-unused -Wpointer-arith -Wcast-align -Wwrite-strings
-Wsign-compare -Wno-multichar -g -I.. -I. -O2 -fno-strict-aliasing
-I../../../../tools/vtpm_manager/manager -c -o tpm_credentials.o
../tpm/tpm_credentials.c
+make[5]: *** [tpm_startup.o] Error 1
+
+---
+ Makefile | 19 +++++++++++--------
+ 1 file changed, 11 insertions(+), 8 deletions(-)
+
+Index: tpm_emulator-0.5.1/Makefile
+==================================================================+---
tpm_emulator-0.5.1.orig/Makefile
++++ tpm_emulator-0.5.1/Makefile
+@@ -14,20 +14,23 @@ SUBDIRS := tpmd
+
+ all: version all-recursive
+
+-version:
+- @echo "#ifndef _TPM_VERSION_H_" > tpm/tpm_version.h
+- @echo "#define _TPM_VERSION_H_" >> tpm/tpm_version.h
+- @echo "#define VERSION_MAJOR $(VERSION_MAJOR)" >>
tpm/tpm_version.h
+- @echo "#define VERSION_MINOR $(VERSION_MINOR)" >>
tpm/tpm_version.h
+- @echo "#define VERSION_BUILD $(VERSION_BUILD)" >>
tpm/tpm_version.h
+- @echo "#endif /* _TPM_VERSION_H_ */" >> tpm/tpm_version.h
++tpm/tpm_version.h:
++ @echo "#ifndef _TPM_VERSION_H_" > tpm/tpm_version.h.tmp
++ @echo "#define _TPM_VERSION_H_" >> tpm/tpm_version.h.tmp
++ @echo "#define VERSION_MAJOR $(VERSION_MAJOR)" >>
tpm/tpm_version.h.tmp
++ @echo "#define VERSION_MINOR $(VERSION_MINOR)" >>
tpm/tpm_version.h.tmp
++ @echo "#define VERSION_BUILD $(VERSION_BUILD)" >>
tpm/tpm_version.h.tmp
++ @echo "#endif /* _TPM_VERSION_H_ */" >> tpm/tpm_version.h.tmp
++ mv -f tpm/tpm_version.h.tmp tpm/tpm_version.h
++
++version: tpm/tpm_version.h
+
+ clean: clean-recursive
+ rm -f tpm/tpm_version.h
+
+ install: install-recursive
+
+-all-recursive clean-recursive install-recursive:
++all-recursive clean-recursive install-recursive: version
+ @target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $(SUBDIRS); do \
+ echo "Making $$target in $$subdir"; \
Ian Jackson
2012-Jul-23 16:54 UTC
Re: [PATCH] tools/vtpm: fix version.h error during parallel build
Olaf Hering writes ("[Xen-devel] [PATCH] tools/vtpm: fix version.h error
during parallel build"):> tools/vtpm: fix version.h error during parallel build
>
> Generating the tpm_version.h is not make -j safe:
Thanks for tracking this down. However, wouldn''t it be possible to
fix this entirely in our Makefile, somehow ? The patch to the
upstream Makefile risks getting conflicts in the future with changes
to the upstream code.
Thanks,
Ian.
Olaf Hering
2012-Jul-23 17:12 UTC
Re: [PATCH] tools/vtpm: fix version.h error during parallel build
On Mon, Jul 23, Ian Jackson wrote:> Olaf Hering writes ("[Xen-devel] [PATCH] tools/vtpm: fix version.h error during parallel build"): > > tools/vtpm: fix version.h error during parallel build > > > > Generating the tpm_version.h is not make -j safe: > > Thanks for tracking this down. However, wouldn''t it be possible to > fix this entirely in our Makefile, somehow ? The patch to the > upstream Makefile risks getting conflicts in the future with changes > to the upstream code.The build_sub rule in tools/vtpm/Makefile could be changed to $(MAKE) -C $(VTPM_DIR) version && $(MAKE) -C $(VTPM_DIR) all-recursive; \ And the install rule in that Makefile perhaps to $(MAKE) -C $(VTPM_DIR) install-recursive I will see how that works, the failure happens rarely. Olaf
Ian Jackson
2012-Jul-23 17:14 UTC
Re: [PATCH] tools/vtpm: fix version.h error during parallel build
Olaf Hering writes ("Re: [Xen-devel] [PATCH] tools/vtpm: fix version.h
error during parallel build"):> On Mon, Jul 23, Ian Jackson wrote:
>
> > Olaf Hering writes ("[Xen-devel] [PATCH] tools/vtpm: fix
version.h error during parallel build"):
> > > tools/vtpm: fix version.h error during parallel build
> > >
> > > Generating the tpm_version.h is not make -j safe:
> >
> > Thanks for tracking this down. However, wouldn''t it be
possible to
> > fix this entirely in our Makefile, somehow ? The patch to the
> > upstream Makefile risks getting conflicts in the future with changes
> > to the upstream code.
>
> The build_sub rule in tools/vtpm/Makefile could be changed to
> $(MAKE) -C $(VTPM_DIR) version && $(MAKE) -C $(VTPM_DIR)
all-recursive; \
>
> And the install rule in that Makefile perhaps to
> $(MAKE) -C $(VTPM_DIR) install-recursive
Right, something like that.
> I will see how that works, the failure happens rarely.
I find that adding sleeps can help repro these kind of problems.
Ian.
Olaf Hering
2012-Jul-31 08:19 UTC
Re: [PATCH] tools/vtpm: fix version.h error during parallel build
On Mon, Jul 23, Ian Jackson wrote:> Olaf Hering writes ("Re: [Xen-devel] [PATCH] tools/vtpm: fix version.h error during parallel build"): > > The build_sub rule in tools/vtpm/Makefile could be changed to > > $(MAKE) -C $(VTPM_DIR) version && $(MAKE) -C $(VTPM_DIR) all-recursive; \ > > > > And the install rule in that Makefile perhaps to > > $(MAKE) -C $(VTPM_DIR) install-recursive > > Right, something like that.I just sent a new patch which does that. Olaf