Skip to contentSkip to conversation

libxl: add missing dependencies of libxl.h

PATCH In review Olaf Hering 3 participants 9 messages Sep 6, 2012 – Sep 11, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl: add missing dependencies of libxl.h

# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1346951410 -7200
# Node ID cc71fe7029b27cb95d268b99e136c445903af927 # Parent 8a2eef481d3ab3ca5692dd0083c95cf314fe1da3
libxl: add missing dependencies of libxl.h

libxl.h includes generated files, but the Makefile lists no dependency on these files. As a result compilation may fail like this:

[  379s] make -C libxl install
[  379s] make[3]: Entering directory `/usr/src/packages/BUILD/xen-4.2.25821/non-dbg/tools/libxl'
[  379s] /usr/bin/perl /usr/src/packages/BUILD/xen-4.2.25821/non-dbg/tools/libxl/../../tools/include/xen-external/bsd-sys-queue-h-seddery /usr/src/packages/BUILD/xen-4.2.25821/non-dbg/tools/libxl/../../tools/include/xen-external/bsd-sys-queue.h --prefix=libxl >_libxl_list.h.new

...
[ 380s] gcc -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -D__XEN_TOOLS__ -MMD -MF ._libxl.api-for-check.d -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -Werror -Wno-format-zero-length -Wmissing-declarations -Wno-declaration-after-statement -Wformat-nonliteral -I. -fPIC -pthread -I/usr/src/packages/BUILD/xen-4.2.25821/non-dbg/tools/libxl/../../tools/libxc -I/usr/src/packages/BUILD/xen-4.2.25821/non-dbg/tools/libxl/../../tools/include -I/usr/src/packages/BUILD/xen-4.2.25821/non-dbg/tools/libxl/../../tools/libxl -I/usr/src/packages/BUILD/xen-4.2.25821/non-dbg/tools/libxl/../.
./tools/libxc -I/usr/src/packages/BUILD/xen-4.2.25821/non-dbg/tools/libxl/../../tools/include -I/usr/src/packages/BUILD/xen-4.2.25821/non-dbg/tools/libxl/../../tools/include -include /usr/src/packages/BUILD/xen-4.2.25821/non-dbg/tools/libxl/../../tools/config.h -I/usr/src/packages/BUILD/xen-4.2.25821/non-dbg/tools/libxl/../../tools/libxc -I/usr/src/packages/BUILD/xen-4.2.25821/non-dbg/tools/libxl/../../tools/include -c -E libxl.h \
[ 380s] -DLIBXL_EXTERNAL_CALLERS_ONLY=LIBXL_EXTERNAL_CALLERS_ONLY \
[ 380s] >_libxl.api-for-check.new
...

[  380s] libxl.h:260:25: fatal error: _libxl_list.h: No such file or directory
[  380s] compilation terminated.
[  380s] make[3]: *** [_libxl.api-for-check] Error 1
[  381s] if ! cmp -s _libxl_list.h.new _libxl_list.h; then mv -f _libxl_list.h.new _libxl_list.h; else rm -f _libxl_list.h.new; fi

Fix this be extending the existing libxl.h dependency with the generated file _libxl_list.h, and also with the existing libxl_event.h.

tools/libxl/Makefile +1 -1
diff -r 8a2eef481d3a -r cc71fe7029b2 tools/libxl/Makefile
@@ -140,7 +140,7 @@ _libxl_save_msgs_helper.h _libxl_save_ms
 	$(PERL) -w $< $@ >[email protected]
 	$(call move-if-changed,[email protected],$@)
 
-libxl.h: _libxl_types.h
+libxl.h: _libxl_types.h _libxl_list.h libxl_event.h
 libxl_json.h: _libxl_types_json.h
 libxl_internal.h: _libxl_types_internal.h _paths.h
 libxl_internal_json.h: _libxl_types_internal_json.h
#1 lore raw
Quoted 7 lines · Olaf Hering

# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1346951410 -7200
# Node ID cc71fe7029b27cb95d268b99e136c445903af927 # Parent 8a2eef481d3ab3ca5692dd0083c95cf314fe1da3
libxl: add missing dependencies of libxl.h

Quoted 8 lines

libxl.h includes generated files, but the Makefile lists no dependency on these files. As a result compilation may fail like this:

[  379s] make -C libxl install
[  379s] make[3]: Entering directory `/usr/src/packages/BUILD/xen-4.2.25821/non-dbg/tools/libxl'
[  379s] /usr/bin/perl /usr/src/packages/BUILD/xen-4.2.25821/non-dbg/tools/libxl/../../tools/include/xen-external/bsd-sys-queue-h-seddery /usr/src/packages/BUILD/xen-4.2.25821/non-dbg/tools/libxl/../../tools/include/xen-external/bsd-sys-queue.h --prefix=libxl >_libxl_list.h.new

...
[ 380s] gcc -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -D__XEN_TOOLS__ -MMD -MF ._libxl.api-for-check.d -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -Werror -Wno-format-zero-length -Wmissing-declarations -Wno-declaration-after-statement -Wformat-nonliteral -I. -fPIC -pthread -I/usr/src/packages/BUILD/xen-4.2.25821/non-dbg/tools/libxl/../../tools/libxc -I/usr/src/packages/BUILD/xen-4.2.25821/non-dbg/tools/libxl/../../tools/include -I/usr/src/packages/BUILD/xen-4.2.25821/non-dbg/tools/libxl/../../tools/libxl -I/usr/src/packages/BUILD/xen-4.2.25821/non-dbg/tools/libxl/..

/../tools/libxc -I/usr/src/packages/BUILD/xen-4.2.25821/non-dbg/tools/libxl/../../tools/include -I/usr/src/packages/BUILD/xen-4.2.25821/non-dbg/tools/libxl/../../tools/include -include /usr/src/packages/BUILD/xen-4.2.25821/non-dbg/tools/libxl/../../tools/config.h -I/usr/src/packages/BUILD/xen-4.2.25821/non-dbg/tools/libxl/../../tools/libxc -I/usr/src/packages/BUILD/xen-4.2.25821/non-dbg/tools/libxl/../../tools/include -c -E libxl.h \

Quoted 18 lines

[ 380s] -DLIBXL_EXTERNAL_CALLERS_ONLY=LIBXL_EXTERNAL_CALLERS_ONLY \
[ 380s] >_libxl.api-for-check.new
...

[  380s] libxl.h:260:25: fatal error: _libxl_list.h: No such file or directory
[  380s] compilation terminated.
[  380s] make[3]: *** [_libxl.api-for-check] Error 1
[  381s] if ! cmp -s _libxl_list.h.new _libxl_list.h; then mv -f _libxl_list.h.new _libxl_list.h; else rm -f _libxl_list.h.new; fi

Fix this be extending the existing libxl.h dependency with the generated file _libxl_list.h, and also with the existing libxl_event.h.

diff -r 8a2eef481d3a -r cc71fe7029b2 tools/libxl/Makefile

tools/libxl/Makefile _libxl_save_msgs_helper.h _libxl_save_ms · line 143

Quoted 5 lines
tools/libxl/Makefile +1 -1
@@ -140,7 +140,7 @@ _libxl_save_msgs_helper.h _libxl_save_ms
 	$(PERL) -w $< $@ >[email protected]
 	$(call move-if-changed,[email protected],$@)
 
-libxl.h: _libxl_types.h
+libxl.h: _libxl_types.h _libxl_list.h libxl_event.h

You don't need libxl_event.h here (it's not autogenerated).

I'm not sure if $(AUTOINCS) should be used here. Ian J probably has an opinion.

Quoted 8 lines
tools/libxl/Makefile +0 -0
 libxl_json.h: _libxl_types_json.h
 libxl_internal.h: _libxl_types_internal.h _paths.h
 libxl_internal_json.h: _libxl_types_internal_json.h

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

#2 lore raw

Ian Campbell writes ("Re: [Xen-devel] [PATCH] libxl: add missing dependencies of libxl.h"):

Quoted 2 lines · Olaf Hering
Quoted 1 line

libxl: add missing dependencies of libxl.h

This is not correct. A dependency in the sense of make is a thing which is used to construct the target file, not a thing which the target file's contents refers to.

The correct fix is, I think, this:

tools/libxl/Makefile +1 -1
index a9d9ec6..f48e304 100644
@@ -119,7 +119,7 @@ libxl.api-ok: check-libxl-api-rules _libxl.api-for-check
 	$(PERL) $^
 	touch $@
 
-_%.api-for-check: %.h
+_%.api-for-check: %.h $(filter-out %.api-ok, $(AUTOINCS))
 	$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) -c -E $< $(APPEND_CFLAGS) \
 		-DLIBXL_EXTERNAL_CALLERS_ONLY=LIBXL_EXTERNAL_CALLERS_ONLY \
 		>[email protected]

Can you confirm that this fixes it for you ?

Ian.

#3 lore raw
Quoted 7 lines · Ian Jackson
tools/libxl/Makefile +1 -1
-_%.api-for-check: %.h
+_%.api-for-check: %.h $(filter-out %.api-ok, $(AUTOINCS))
 	$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) -c -E $< $(APPEND_CFLAGS) \
 		-DLIBXL_EXTERNAL_CALLERS_ONLY=LIBXL_EXTERNAL_CALLERS_ONLY \
 		>[email protected]

Can you confirm that this fixes it for you ?

The package builds fine with this change.
The failure if fixes happend only once.

Olaf

#4 lore raw

PATCH 1/1 libxl: Fix missing dependency in api check rule

Olaf Hering writes ("Re: [Xen-devel] [PATCH] libxl: add missing dependencies of libxl.h"):

Quoted 11 lines · Ian Jackson
Quoted 7 lines
(quoted diff) +1 -1
-_%.api-for-check: %.h
+_%.api-for-check: %.h $(filter-out %.api-ok, $(AUTOINCS))
 	$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) -c -E $< $(APPEND_CFLAGS) \
 		-DLIBXL_EXTERNAL_CALLERS_ONLY=LIBXL_EXTERNAL_CALLERS_ONLY \
 		>[email protected]

Can you confirm that this fixes it for you ?

The package builds fine with this change.
The failure if fixes happend only once.

Hmm.

Adding this: (WARNING DO NOT APPLY THIS BIT)

tools/libxl/Makefile +1 -0
index a9d9ec6..5f2332c 100644
@@ -132,6 +132,7 @@ _paths.h: genpath
 
 _libxl_list.h: $(XEN_INCLUDE)/xen-external/bsd-sys-queue-h-seddery $(XEN_INCLUDE)/xen-external/bsd-sys-queue.h
 	$(PERL) $^ --prefix=libxl >[email protected]
+	sleep 10
 	$(call move-if-changed,[email protected],$@)
 
 _libxl_save_msgs_helper.c _libxl_save_msgs_callout.c \

allowed me to repro the failure and confirm that my proposed change fixes it.

So (for -unstable and 4.2), the fix is below.

Ian.

Subject: [PATCH] libxl: Fix missing dependency in api check rule

Without this, the api check cpp run might happen before the various autogenerated files which are #include by libxl.h are ready.

We need to filter out the api-ok file from AUTOINCS to avoid a circular dependency. The result is that the api check is the last thing to be done before make considers the AUTOINCS all done and can start work on compiling .c files into .o's.

tools/libxl/Makefile +1 -1
index 5f2332c..c298e97 100644
@@ -119,7 +119,7 @@ libxl.api-ok: check-libxl-api-rules _libxl.api-for-check
 	$(PERL) $^
 	touch $@
 
-_%.api-for-check: %.h
+_%.api-for-check: %.h $(filter-out %.api-ok, $(AUTOINCS))
 	$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) -c -E $< $(APPEND_CFLAGS) \
 		-DLIBXL_EXTERNAL_CALLERS_ONLY=LIBXL_EXTERNAL_CALLERS_ONLY \
 		>[email protected]
Acked-by on v1 1/1
#5 lore raw

Re: [PATCH] libxl: Fix missing dependency in api check rule

Quoted 43 lines · Ian Jackson

Olaf Hering writes ("Re: [Xen-devel] [PATCH] libxl: add missing dependencies of libxl.h"):

Quoted 11 lines · Ian Jackson
Quoted 7 lines
tools/libxl/Makefile +1 -1
-_%.api-for-check: %.h
+_%.api-for-check: %.h $(filter-out %.api-ok, $(AUTOINCS))
 	$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) -c -E $< $(APPEND_CFLAGS) \
 		-DLIBXL_EXTERNAL_CALLERS_ONLY=LIBXL_EXTERNAL_CALLERS_ONLY \
 		>[email protected]

Can you confirm that this fixes it for you ?

The package builds fine with this change.
The failure if fixes happend only once.

Hmm.

Adding this: (WARNING DO NOT APPLY THIS BIT)

tools/libxl/Makefile +1 -0
index a9d9ec6..5f2332c 100644
@@ -132,6 +132,7 @@ _paths.h: genpath
 
 _libxl_list.h: $(XEN_INCLUDE)/xen-external/bsd-sys-queue-h-seddery $(XEN_INCLUDE)/xen-external/bsd-sys-queue.h
 	$(PERL) $^ --prefix=libxl >[email protected]
+	sleep 10
 	$(call move-if-changed,[email protected],$@)
 
 _libxl_save_msgs_helper.c _libxl_save_msgs_callout.c \

allowed me to repro the failure and confirm that my proposed change fixes it.

So (for -unstable and 4.2), the fix is below.

Ian.

Subject: [PATCH] libxl: Fix missing dependency in api check rule

Without this, the api check cpp run might happen before the various autogenerated files which are #include by libxl.h are ready.

Quoted 7 lines

We need to filter out the api-ok file from AUTOINCS to avoid a circular dependency. The result is that the api check is the last thing to be done before make considers the AUTOINCS all done and can start work on compiling .c files into .o's.

I'm ok with this for 4.2.0.

Although I do wonder if this:

tools/libxl/Makefile libxl.api-ok: check-libxl-api-rules _libxl.api-for-check · line 122

Quoted 2 lines
tools/libxl/Makefile +1 -1
-_%.api-for-check: %.h
+_%.api-for-check: %.h $(filter-out %.api-ok, $(AUTOINCS))

Indicates that libxl.api-ok doesn't strictly speaking belong in AUTOINCS.

#6 lore raw

Re: [PATCH] libxl: Fix missing dependency in api check rule

Ian Campbell writes ("Re: [PATCH] libxl: Fix missing dependency in api check rule"):

Quoted 7 lines

Although I do wonder if this:

tools/libxl/Makefile libxl.api-ok: check-libxl-api-rules _libxl.api-for-check · line 122

Quoted 2 lines
tools/libxl/Makefile +1 -1
-_%.api-for-check: %.h
+_%.api-for-check: %.h $(filter-out %.api-ok, $(AUTOINCS))

Indicates that libxl.api-ok doesn't strictly speaking belong in AUTOINCS.

It would be possible to instead write:

-$(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS) $(SAVE_HELPER_OBJS): $(AUTOINCS) +$(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS) $(SAVE_HELPER_OBJS): $(AUTOINCS) libxl.api-ok

If you'd prefer that I'd be happy to test that it actually works.

Ian.

#7 lore raw

Re: [PATCH] libxl: Fix missing dependency in api check rule

Quoted 9 lines · Ian Jackson

Ian Campbell writes ("Re: [PATCH] libxl: Fix missing dependency in api check rule"):

Quoted 7 lines

Although I do wonder if this:

tools/libxl/Makefile libxl.api-ok: check-libxl-api-rules _libxl.api-for-check · line 122

Quoted 2 lines
tools/libxl/Makefile +1 -1
-_%.api-for-check: %.h
+_%.api-for-check: %.h $(filter-out %.api-ok, $(AUTOINCS))

Indicates that libxl.api-ok doesn't strictly speaking belong in AUTOINCS.

Quoted 6 lines

It would be possible to instead write:

-$(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS) $(SAVE_HELPER_OBJS): $(AUTOINCS) +$(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS) $(SAVE_HELPER_OBJS): $(AUTOINCS) libxl.api-ok

If you'd prefer that I'd be happy to test that it actually works.

Please do.

Perhaps $(APICHECKS) ? Up to you.

Quoted 2 lines

Ian.

#8 lore raw

Re: [PATCH] libxl: Fix missing dependency in api check rule

Ian Campbell writes ("Re: [PATCH] libxl: Fix missing dependency in api check rule"):

Quoted 6 lines · Ian Jackson
Quoted 1 line

If you'd prefer that I'd be happy to test that it actually works.

Please do.

Perhaps $(APICHECKS) ? Up to you.

I think given it's just the one right now it will do to just have the filename :-).

Ian.