[PATCH 0/6] Simple fixes for cross-compiling the daemon
As outlined here: https://www.redhat.com/archives/libguestfs/2009-November/msg00171.html These patches fix some of the simpler things. Some of the things (the missing headers) are genuine bugs. Note in order to cross-compile at all you have to comment out the section in the daemon/configure.ac where it detects custom format specifiers. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://et.redhat.com/~rjones/libguestfs/ See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html
Richard W.M. Jones wrote:
Subject: [PATCH 1/6] daemon/Win32: Ignore mingw32-config.cache.
The Fedora Windows cross-compiler 'mingw32-configure' script always uses a configure cache. Ignore that file. --- daemon/.gitignore | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/daemon/.gitignore b/daemon/.gitignore index 6a67b90..9752ad0 100644 --- a/daemon/.gitignore +++ b/daemon/.gitignore @@ -71,4 +71,5 @@ m4/wint_t.m4 m4/xalloc.m4 m4/xgetcwd.m4 m4/xstrndup.m4 +mingw32-config.cache tests
ACK, of course.
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
On Fri, Nov 20, 2009 at 12:25:13PM +0100, Jim Meyering wrote:
Richard W.M. Jones wrote:
Subject: [PATCH 2/6] daemon: Missing #includes revealed by cross-compiling.
Looks fine and obviously safe. What symbols?
The two problems fixed by this are that PATH_MAX requires <limits.h> (on Win32 anyhow), and that various str* and mem* functions were being used without including <string.h> (probably works because this is implicitly included from another header file). Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v
Richard W.M. Jones wrote:
On Fri, Nov 20, 2009 at 12:25:13PM +0100, Jim Meyering wrote:
Richard W.M. Jones wrote:
Subject: [PATCH 2/6] daemon: Missing #includes revealed by cross-compiling.
Looks fine and obviously safe. What symbols?
The two problems fixed by this are that PATH_MAX requires <limits.h> (on Win32 anyhow), and that various str* and mem* functions were being used without including <string.h> (probably works because this is implicitly included from another header file).
Did you know that PATH_MAX may not be defined at all? Or it may be defined to something outrageously large? That's why coding style guidelines often suggest to avoid it altogether.
On Fri, Nov 20, 2009 at 12:39:49PM +0100, Jim Meyering wrote:
Richard W.M. Jones wrote:
On Fri, Nov 20, 2009 at 12:25:13PM +0100, Jim Meyering wrote:
Richard W.M. Jones wrote:
Subject: [PATCH 2/6] daemon: Missing #includes revealed by cross-compiling.
Looks fine and obviously safe. What symbols?
The two problems fixed by this are that PATH_MAX requires <limits.h> (on Win32 anyhow), and that various str* and mem* functions were being used without including <string.h> (probably works because this is implicitly included from another header file).
Did you know that PATH_MAX may not be defined at all? Or it may be defined to something outrageously large? That's why coding style guidelines often suggest to avoid it altogether.
Sure, but in the cases we care about, it is defined and not outrageously large. 4096 on Linux, 256(!) on Windows. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v
Richard W.M. Jones wrote:
On Fri, Nov 20, 2009 at 12:39:49PM +0100, Jim Meyering wrote:
Richard W.M. Jones wrote:
On Fri, Nov 20, 2009 at 12:25:13PM +0100, Jim Meyering wrote:
Richard W.M. Jones wrote:
Subject: [PATCH 2/6] daemon: Missing #includes revealed by cross-compiling.
Looks fine and obviously safe. What symbols?
The two problems fixed by this are that PATH_MAX requires <limits.h> (on Win32 anyhow), and that various str* and mem* functions were being used without including <string.h> (probably works because this is implicitly included from another header file).
Did you know that PATH_MAX may not be defined at all? Or it may be defined to something outrageously large? That's why coding style guidelines often suggest to avoid it altogether.
Sure, but in the cases we care about, it is defined and not outrageously large. 4096 on Linux, 256(!) on Windows.
Right. I suppose it is not be worth removing, here.
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://et.redhat.com/~rjones/libguestfs/ See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html
Richard W.M. Jones wrote:
Subject: [PATCH 3/6] daemon/Win32: NAME_MAX does not exist on Windows, use FILENAME_MAX instead.
--- daemon/realpath.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/daemon/realpath.c b/daemon/realpath.c index 17e74ea..02a82d6 100644 --- a/daemon/realpath.c +++ b/daemon/realpath.c @@ -32,6 +32,11 @@ #include "daemon.h" #include "actions.h"
+/* On Windows, NAME_MAX is not defined. */ +#ifndef NAME_MAX +#define NAME_MAX FILENAME_MAX +#endif
Looks fine.
From back when I had to deal with cpp conditionals nested to a depth of 8 or even 10, I've come to appreciate using indentation to reflect cpp condition nesting, even on a small scale:
#ifndef NAME_MAX # define NAME_MAX FILENAME_MAX #endif
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top
Richard W.M. Jones wrote:
Subject: [PATCH 5/6] daemon/Win32: Don't include missing headers.
This is a partial fix for code in guestfsd.c where many of these header files are missing on Win32. --- daemon/guestfsd.c | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c index 9375ede..4b91660 100644 --- a/daemon/guestfsd.c +++ b/daemon/guestfsd.c @@ -27,15 +27,27 @@ #include <rpc/types.h> #include <rpc/xdr.h> #include <getopt.h> -#include <netdb.h> #include <sys/param.h> -#include <sys/select.h> #include <sys/types.h> -#include <sys/wait.h>
The three above are covered by gnulib. Just use the corresponding module and you can leave them included unconditionally. The module names: netdb sys_select sys_wait
#include <sys/stat.h> #include <fcntl.h> #include <signal.h> + +#ifdef HAVE_NETDB_H +#include <netdb.h> +#endif + +#ifdef HAVE_SYS_SELECT_H +#include <sys/select.h> +#endif + +#ifdef HAVE_SYS_WAIT_H +#include <sys/wait.h> +#endif + +#ifdef HAVE_PRINTF_H #include <printf.h> +#endif
#include "c-ctype.h" #include "ignore-value.h"
On Fri, Nov 20, 2009 at 12:31:50PM +0100, Jim Meyering wrote:
Richard W.M. Jones wrote:
Subject: [PATCH 5/6] daemon/Win32: Don't include missing headers.
This is a partial fix for code in guestfsd.c where many of these header files are missing on Win32. --- daemon/guestfsd.c | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c index 9375ede..4b91660 100644 --- a/daemon/guestfsd.c +++ b/daemon/guestfsd.c @@ -27,15 +27,27 @@ #include <rpc/types.h> #include <rpc/xdr.h> #include <getopt.h> -#include <netdb.h> #include <sys/param.h> -#include <sys/select.h> #include <sys/types.h> -#include <sys/wait.h>
The three above are covered by gnulib. Just use the corresponding module and you can leave them included unconditionally. The module names:
netdb sys_select sys_wait
OK - I'll push this and fix it by adding the gnulib modules in a later patch. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://et.redhat.com/~rjones/libguestfs/ See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html
It may not be immediately obvious, but this is required to compile daemon/glob.c. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
Richard W.M. Jones wrote:
Subject: [PATCH 6/6] daemon/gnulib: Include glob module.
--- daemon/.gitignore | 16 ++++++++++++++++ daemon/m4/gnulib-cache.m4 | 3 ++- 2 files changed, 18 insertions(+), 1 deletions(-)
...
diff --git a/daemon/m4/gnulib-cache.m4 b/daemon/m4/gnulib-cache.m4 -# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --with-tests --no-libtool --macro-prefix=gl c-ctype hash ignore-value manywarnings openat warnings +# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --with-tests --no-libtool --macro-prefix=gl c-ctype glob hash ignore-value manywarnings openat warnings
# Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([]) gl_MODULES([ c-ctype + glob
ACK. Adding a gnulib module is almost always safe.
participants (2)
-
Jim Meyering -
Richard W.M. Jones