Skip to contentSkip to conversation

libxl build errors in xen-unstable

DISCUSSION Olaf Hering 4 participants 8 messages May 30, 2011 – Jun 2, 2011

lore
Share & tools
lore
#0 lore raw

There are new build errors in xen-unstable since revision 23368. Wether the _libxl_paths.h.tmp/_libxl_paths.h errros/warnings are new, no idea.

Olaf

..........
make -C libxl install
make[3]: Entering directory `/usr/src/packages/BUILD/xen-unstable.hg-4.2.23437/tools/libxl'
python gentypes.py libxl.idl __libxl_types.h __libxl_types.c
rm -f _libxl_paths.h.tmp.tmp; echo "SBINDIR=\"/usr/sbin\"" >> _libxl_paths.h.tmp.tmp; echo "BINDIR=\"/usr/bin\"" >> _libxl_paths.h.tmp.tmp; echo "LIBEXEC=\"/usr/lib/xen/bin\"" >> _libxl_paths.h.tmp.tmp; echo "LIBDIR=\"/usr/lib64\"" >> _libxl_paths.h.tmp.tmp; echo "SHAREDIR=\"/usr/share\"" >> _libxl_paths.h.tmp.tmp; echo "PRIVATE_BINDIR=\"/usr/lib64/xen/bin\"" >> _libxl_paths.h.tmp.tmp; echo "XENFIRMWAREDIR=\"/usr/lib/xen/boot\"" >> _libxl_paths.h.tmp.tmp; echo "XEN_CONFIG_DIR=\"/etc/xen\"" >> _libxl_paths.h.tmp.tmp; echo "XEN_SCRIPT_DIR=\"/etc/xen/scripts\"" >> _libxl_paths.h.tmp.tmp; echo "XEN_LOCK_DIR=\"/var/lock\"" >> _libxl_paths.h.tmp.tmp; if ! cmp _libxl_paths.h.tmp.tmp _libxl_paths.h.tmp; then mv -f _libxl_paths.h.tmp.tmp _libxl_paths.h.tmp; fi
cmp: _libxl_paths.h.tmp: No such file or directory
sed -e "s/\([^=]*\)=\(.*\)/#define \1 \2/g" _libxl_paths.h.tmp >_libxl_paths.h.2.tmp
if ! cmp _libxl_paths.h.2.tmp _libxl_paths.h; then mv -f _libxl_paths.h.2.tmp _libxl_paths.h; fi
Parsing libxl.idl
cmp: _libxl_paths.h: No such file or directory
outputting libxl type definitions to __libxl_types.h
outputting libxl type implementations to __libxl_types.c
mv __libxl_types.h _libxl_types.h
mv __libxl_types.c _libxl_types.c
gcc -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -funwind-tables -fasynchronous-unwind-tables -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -D__XEN_TOOLS__ -MMD -MF .subdirs-install.d -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -D__XEN_TOOLS__ -MMD -MF .subdir-install-libxl.d -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -D__XEN_TOOLS__ -MMD -MF .libxl_exec.o.d -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -Werror -Wno-format-zero-length -Wmissing-declarations -I. -fPIC -I/usr/src/packages/BUILD/xen-unstable.hg-4.2.23437/tools/libxl/../../tools/libxc -I/usr/src/packages/BUILD/xen-unstable.hg-4.2.23437/tools/libxl/../../tools/include -I/usr/src/packages/BUILD/xen-unstable.hg-4.2.23437/tools/libxl/../../tools/libxc -I/usr/src/packages/BUILD/xen-unstable.hg-4.2.23437/tools/libxl/../../tools/include -I/usr/src/packages/BUILD/xen-unstable.hg-4.2.23437/tools/libxl/../../tools/xenstore -I/usr/src/packages/BUILD/xen-unstable.hg-4.2.23437/tools/libxl/../../tools/include -I/usr/src/packages/BUILD/xen-unstable.hg-4.2.23437/tools/libxl/../../tools/blktap2/control -I/usr/src/packages/BUILD/xen-unstable.hg-4.2.23437/tools/libxl/../../tools/blktap2/include -I/usr/src/packages/BUILD/xen-unstable.hg-4.2.23437/tools/libxl/../../tools/include -c -o libxl_exec.o libxl_exec.c
cc1: warnings being treated as errors
libxl_exec.c: In function 'check_open_fds':
libxl_exec.c:48: error: ignoring return value of 'atoi', declared with attribute warn_unused_result
gcc -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -funwind-tables -fasynchronous-unwind-tables -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -D__XEN_TOOLS__ -MMD -MF .subdirs-install.d -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -D__XEN_TOOLS__ -MMD -MF .subdir-install-libxl.d -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -D__XEN_TOOLS__ -MMD -MF .libxl_device.o.d -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -Werror -Wno-format-zero-length -Wmissing-declarations -I. -fPIC -I/usr/src/packages/BUILD/xen-unstable.hg-4.2.23437/tools/libxl/../../tools/libxc -I/usr/src/packages/BUILD/xen-unstable.hg-4.2.23437/tools/libxl/../../tools/include -I/usr/src/packages/BUILD/xen-unstable.hg-4.2.23437/tools/libxl/../../tools/libxc -I/usr/src/packages/BUILD/xen-unstable.hg-4.2.23437/tools/libxl/../../tools/include -I/usr/src/packages/BUILD/xen-unstable.hg-4.2.23437/tools/libxl/../../tools/xenstore -I/usr/src/packages/BUILD/xen-unstable.hg-4.2.23437/tools/libxl/../../tools/include -I/usr/src/packages/BUILD/xen-unstable.hg-4.2.23437/tools/libxl/../../tools/blktap2/control -I/usr/src/packages/BUILD/xen-unstable.hg-4.2.23437/tools/libxl/../../tools/blktap2/include -I/usr/src/packages/BUILD/xen-unstable.hg-4.2.23437/tools/libxl/../../tools/include -c -o libxl_device.o libxl_device.c libxl_exec.c: In function 'libxl__spawn_spawn':
libxl_exec.c:224: error: ignoring return value of 'write', declared with attribute warn_unused_result
make[3]: *** [libxl_exec.o] Error 1
cc1: warnings being treated as errors
libxl_device.c: In function 'libxl__wait_for_device_model':
libxl_device.c:488: error: ignoring return value of 'read', declared with attribute warn_unused_result
make[3]: *** [libxl_device.o] Error 1

#1 lore raw
Quoted 3 lines · Olaf Hering

There are new build errors in xen-unstable since revision 23368. Wether the _libxl_paths.h.tmp/_libxl_paths.h errros/warnings are new, no idea.

[...]

Quoted 5 lines

cmp: _libxl_paths.h.tmp: No such file or directory
sed -e "s/\([^=]*\)=\(.*\)/#define \1 \2/g" _libxl_paths.h.tmp >_libxl_paths.h.2.tmp if ! cmp _libxl_paths.h.2.tmp _libxl_paths.h; then mv -f _libxl_paths.h.2.tmp _libxl_paths.h; fi Parsing libxl.idl
cmp: _libxl_paths.h: No such file or directory

Presumably this also yields the correct return code to cause the mv to happen, so you do end up with a _libxl_paths.h with stuff in it?

[...]

Quoted 1 line

libxl_exec.c:48: error: ignoring return value of 'atoi', declared with attribute warn_unused_result

[...]

Quoted 1 line

libxl_exec.c:224: error: ignoring return value of 'write', declared with attribute warn_unused_result

[...]

Quoted 1 line

libxl_device.c:488: error: ignoring return value of 'read', declared with attribute warn_unused_result

Has someone got a bit carried away with the warn_unused_result attribute in your distro/gcc/libc/etc? Applying that sort of attribute system wide to such widespread functions seems like... trouble...

That said the atoi one is definitely a thinko on my part. (patch below)

The read/write ones are opposite ends of the notification pipe used when the device model fails to start (to give the parent an fd to select on so it can fail more quickly on qemu error).

I'm not sure there is much in the way of error handling which can or should be done here, the parent will eventually timeout, much like if the qemu process starts but fails initialise properly (i.e. hangs instead of crashing).

I suppose we could check for EINTR and the like on the write side (being careful not to get into a pointless loop) but on the read side we really don't care about the result of the read, the wake up from select is the important thing.

Ian.

8<--------------------------------

# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1306830860 -3600
# Node ID acef384cf9ebbebde29b57a2fcbf2aef0b915497 # Parent 2e197702a9ab6d7fceeb27589d8ef88dd2c9741a
libxl: remove stray "atoi" in debug code.

I switched from atoi to strtol but failed to actually remove it...

tools/libxl/libxl_exec.c +1 -1
diff -r 2e197702a9ab -r acef384cf9eb tools/libxl/libxl_exec.c
@@ -47,7 +47,7 @@ static void check_open_fds(const char *w
     env_debug = getenv("_LIBXL_DEBUG_EXEC_FDS");
     if (!env_debug) return;
 
-    debug = strtol(env_debug, (char **) NULL, 10);atoi(env_debug);
+    debug = strtol(env_debug, (char **) NULL, 10);
     if (debug <= 0) return;
 
     for (i = 4; i < 256; i++) {
#2 lore raw
Quoted 5 lines · Ian Campbell
Quoted 3 lines · Olaf Hering

There are new build errors in xen-unstable since revision 23368. Wether the _libxl_paths.h.tmp/_libxl_paths.h errros/warnings are new, no idea.

[...]

Quoted 8 lines
Quoted 5 lines

cmp: _libxl_paths.h.tmp: No such file or directory
sed -e "s/\([^=]*\)=\(.*\)/#define \1 \2/g" _libxl_paths.h.tmp >_libxl_paths.h.2.tmp if ! cmp _libxl_paths.h.2.tmp _libxl_paths.h; then mv -f _libxl_paths.h.2.tmp _libxl_paths.h; fi Parsing libxl.idl
cmp: _libxl_paths.h: No such file or directory

Presumably this also yields the correct return code to cause the mv to happen, so you do end up with a _libxl_paths.h with stuff in it?

Seems to return 2 for me, so yes it works.

8<-----------------------------------

# HG changeset patch
# User Ian Campbell <[email protected]>
# Date 1306831676 -3600
# Node ID 8cf4450955f43bb6e5fc07f20cacdf6e8cb80765
# Parent acef384cf9ebbebde29b57a2fcbf2aef0b915497
libxl: avoid build warning when _libxl_types.h does not initially exist.

Olaf Hering reports:
if ! cmp _libxl_paths.h.2.tmp _libxl_paths.h; then mv -f _libxl_paths.h.2.tmp _libxl_paths.h; fi
cmp: _libxl_paths.h: No such file or directory

Use "cmp -s" to silence the error. cmp returns 2 in this case and so the mv does occur.

tools/libxl/Makefile +1 -1
diff -r acef384cf9eb -r 8cf4450955f4 tools/libxl/Makefile
@@ -69,7 +69,7 @@ genpath-target = $(call buildmakevars2fi
 
 _libxl_paths.h: genpath
 	sed -e "s/\([^=]*\)=\(.*\)/#define \1 \2/g" [email protected] >[email protected]
-	if ! cmp [email protected] $@; then mv -f [email protected] $@; fi
+	if ! cmp -s [email protected] $@; then mv -f [email protected] $@; fi
 
 libxl_paths.c: _libxl_paths.h
#3 lore raw
In reply to Ian Campbell
Quoted 6 lines · Ian Campbell

[...]

Quoted 1 line

libxl_exec.c:48: error: ignoring return value of 'atoi', declared

with attribute warn_unused_result
[...]

Quoted 1 line

libxl_exec.c:224: error: ignoring return value of 'write', declared

Quoted 8 lines

with attribute warn_unused_result
[...]

Quoted 1 line

libxl_device.c:488: error: ignoring return value of 'read', declared

with attribute warn_unused_result

Has someone got a bit carried away with the warn_unused_result attribute in your distro/gcc/libc/etc? Applying that sort of attribute system wide to such widespread functions seems like... trouble...

Are you running Ubuntu by any chance?
https://wiki.ubuntu.com/CompilerFlags

Does this help?

Ian.

# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1306835068 -3600
# Node ID 94be5a2d500c19b8e1ee8fc18374d70cdfdb0f0f # Parent 8cf4450955f43bb6e5fc07f20cacdf6e8cb80765
libxl: check return values of read/write

Some distros enable -D_FORTIFY_SOURCE=2 by default
(https://wiki.ubuntu.com/CompilerFlags) which adds the warn_unused_result attribute to several functions including read(2) and write(2)

Although we don't really care about error reading or writing the libxl spawn fd catch them anyway to keep this warning happy.

tools/libxl/libxl_device.c +3 -1
diff -r 8cf4450955f4 -r 94be5a2d500c tools/libxl/libxl_device.c
@@ -485,7 +485,9 @@ again:
             }
             if (starting && FD_ISSET(starting->for_spawn->fd, &rfds)) {
                 unsigned char dummy;
-                read(starting->for_spawn->fd, &dummy, sizeof(dummy));
+                if (read(starting->for_spawn->fd, &dummy, sizeof(dummy)) != 1)
+                    LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_DEBUG,
+                                     "failed to read spawn status pipe");
             }
         }
     }
tools/libxl/libxl_exec.c +4 -2
diff -r 8cf4450955f4 -r 94be5a2d500c tools/libxl/libxl_exec.c
@@ -220,8 +220,10 @@ int libxl__spawn_spawn(libxl__gc *gc,
     rc = (WIFEXITED(status) ? WEXITSTATUS(status) :
           WIFSIGNALED(status) && WTERMSIG(status) < 127
           ? WTERMSIG(status)+128 : -1);
-    if (for_spawn)
-        write(pipes[1], &dummy, sizeof(dummy));
+    if (for_spawn) {
+        if (write(pipes[1], &dummy, sizeof(dummy)) != 1)
+            perror("libxl__spawn_spawn: unable to signal child exit to parent");
+    }
     _exit(rc);
 
  err_parent_pipes:
#4 lore raw
In reply to Ian Campbell
Quoted 5 lines · Ian Campbell
Quoted 3 lines · Olaf Hering

There are new build errors in xen-unstable since revision 23368. Wether the _libxl_paths.h.tmp/_libxl_paths.h errros/warnings are new, no idea.

[...]

Quoted 8 lines
Quoted 5 lines

cmp: _libxl_paths.h.tmp: No such file or directory
sed -e "s/\([^=]*\)=\(.*\)/#define \1 \2/g" _libxl_paths.h.tmp >_libxl_paths.h.2.tmp if ! cmp _libxl_paths.h.2.tmp _libxl_paths.h; then mv -f _libxl_paths.h.2.tmp _libxl_paths.h; fi Parsing libxl.idl
cmp: _libxl_paths.h: No such file or directory

Presumably this also yields the correct return code to cause the mv to happen, so you do end up with a _libxl_paths.h with stuff in it?

Ian,

this is an automated build, I just have that log.

Quoted 10 lines

[...]

Quoted 1 line

libxl_exec.c:48: error: ignoring return value of 'atoi', declared with attribute warn_unused_result

[...]

Quoted 1 line

libxl_exec.c:224: error: ignoring return value of 'write', declared with attribute warn_unused_result

[...]

Quoted 1 line

libxl_device.c:488: error: ignoring return value of 'read', declared with attribute warn_unused_result

Has someone got a bit carried away with the warn_unused_result attribute in your distro/gcc/libc/etc? Applying that sort of attribute system wide to such widespread functions seems like... trouble...

This is SLES11SP1. The applied attribute is not new.

Olaf

#5 lore raw
Quoted 25 lines · Olaf Hering
Quoted 5 lines · Ian Campbell
Quoted 3 lines · Olaf Hering

There are new build errors in xen-unstable since revision 23368. Wether the _libxl_paths.h.tmp/_libxl_paths.h errros/warnings are new, no idea.

[...]

Quoted 8 lines
Quoted 5 lines

cmp: _libxl_paths.h.tmp: No such file or directory
sed -e "s/\([^=]*\)=\(.*\)/#define \1 \2/g" _libxl_paths.h.tmp >_libxl_paths.h.2.tmp if ! cmp _libxl_paths.h.2.tmp _libxl_paths.h; then mv -f _libxl_paths.h.2.tmp _libxl_paths.h; fi Parsing libxl.idl
cmp: _libxl_paths.h: No such file or directory

Presumably this also yields the correct return code to cause the mv to happen, so you do end up with a _libxl_paths.h with stuff in it?

Ian,

this is an automated build, I just have that log.

Quoted 4 lines

[...]

Quoted 1 line

libxl_exec.c:48: error: ignoring return value of 'atoi', declared with attribute warn_unused_result

[...]

Quoted 1 line

libxl_exec.c:224: error: ignoring return value of 'write', declared with attribute warn_unused_result

Quoted 8 lines
Quoted 6 lines

[...]

Quoted 1 line

libxl_device.c:488: error: ignoring return value of 'read', declared with attribute warn_unused_result

Has someone got a bit carried away with the warn_unused_result attribute in your distro/gcc/libc/etc? Applying that sort of attribute system wide to such widespread functions seems like... trouble...

This is SLES11SP1. The applied attribute is not new.

Thanks. Do the various patches I sent to the thread resolve the issue?

Ian.

#6 lore raw
Quoted 1 line · Ian Campbell

Thanks. Do the various patches I sent to the thread resolve the issue?

Ian,

the build just finished. Yes, the three patches fix the issue. Thanks!

Olaf

#7 lore raw

Olaf Hering writes ("Re: [Xen-devel] libxl build errors in xen-unstable"):

Quoted 5 lines · Ian Campbell
Quoted 1 line

Thanks. Do the various patches I sent to the thread resolve the issue?

the build just finished. Yes, the three patches fix the issue. Thanks!

Thanks, I have applied all three.

Ian.