Hello, I have attached a patch that allowed the build to complete successfully on macOS. I haven't tried building the daemon under macOS, but I patched two files there in a similar manner to some of the other files for consistency (just the include order for rpc headers). Thanks, Adam Robinson Virtualization and Cloud Infrastructure Senior Information and Technology Services University of Michigan
diff --git a/daemon/tsk.c b/daemon/tsk.c index ad10d74fe..00a4b04b4 100644 --- a/daemon/tsk.c +++ b/daemon/tsk.c @@ -23,8 +23,8 @@ #include <inttypes.h> #include <string.h> #include <unistd.h> -#include <rpc/xdr.h> #include <rpc/types.h> +#include <rpc/xdr.h> Is it generally required on Macs that rpc/xdr.h is included after rpc/types.h, or is this change a mistake? The rest of the change looks fine. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
Hi Richard, rpc/xdr.h does not itself include rpc/types.h on macOS. This is why I had to modify the configure script to check for rpc/types.h and include it when checking for rpc/xdr.h. Without this, the configure script throws up a "WARNING: rpc/xdr.h: present but cannot be compiled" and fails. What is also was interesting is that some files (such as lib/proto.c) already include the headers in this order. Thanks, -Adam On Mon, May 7, 2018 at 4:04 PM, Richard W.M. Jones <rjones@redhat.com> wrote:> diff --git a/daemon/tsk.c b/daemon/tsk.c > index ad10d74fe..00a4b04b4 100644 > --- a/daemon/tsk.c > +++ b/daemon/tsk.c > @@ -23,8 +23,8 @@ > #include <inttypes.h> > #include <string.h> > #include <unistd.h> > -#include <rpc/xdr.h> > #include <rpc/types.h> > +#include <rpc/xdr.h> > > Is it generally required on Macs that rpc/xdr.h is included after > rpc/types.h, or is this change a mistake? > > The rest of the change looks fine. > > Rich. > > -- > Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~ > rjones > Read my programming and virtualization blog: http://rwmj.wordpress.com > Fedora Windows cross-compiler. Compile Windows programs, test, and > build Windows installers. Over 100 libraries supported. > http://fedoraproject.org/wiki/MinGW >
Hi Adam, On Monday, 7 May 2018 15:31:37 CEST Adam Robinson wrote:> I have attached a patch that allowed the build to complete successfully on > macOS. > > I haven't tried building the daemon under macOS, but I patched two files > there in a similar manner to some of the other files for consistency (just > the include order for rpc headers).This is great to hear. I have few notes regarding your patch:> diff --git a/common/mlutils/unix_utils-c.c b/common/mlutils/unix_utils-c.c > index 1b5eb7957..6d8aa0b6c 100644 > --- a/common/mlutils/unix_utils-c.c > +++ b/common/mlutils/unix_utils-c.c > @@ -55,6 +55,10 @@ > #include <windows.h> > #endif > > +#ifdef __APPLE__ && __MACH__ > +#include <sys/mount.h> > +#endifThis must be a configure check, including it if found. See other headers e.g. in the same file, before the bit you added.> diff --git a/daemon/tsk.c b/daemon/tsk.c > index ad10d74fe..00a4b04b4 100644 > --- a/daemon/tsk.c > +++ b/daemon/tsk.c > @@ -23,8 +23,8 @@ > #include <inttypes.h> > #include <string.h> > #include <unistd.h> > -#include <rpc/xdr.h> > #include <rpc/types.h> > +#include <rpc/xdr.h> > > #include "guestfs_protocol.h" > #include "daemon.h"All of these changes look good to me. Would it be possible for you to create a git formatted patch (so with proper authorship, description, etc) only with them?> diff --git a/m4/guestfs-libraries.m4 b/m4/guestfs-libraries.m4 > index 17cf556d9..b78a5cefa 100644 > --- a/m4/guestfs-libraries.m4 > +++ b/m4/guestfs-libraries.m4 > @@ -181,9 +181,14 @@ PKG_CHECK_MODULES([RPC], [libtirpc], [], [ > # If we don't have libtirpc, then we must have <rpc/xdr.h> and > # some library to link to in libdir. > RPC_CFLAGS="" > + AC_CHECK_HEADER([rpc/types.h], [AC_DEFINE([HAVE_RPC_TYPES_H], > + [], [no rpc/types.h])]) > AC_CHECK_HEADER([rpc/xdr.h],[],[ > - AC_MSG_ERROR([XDR header files are required]) > - ]) > + AC_MSG_ERROR([XDR header files are required])], > +[#ifdef HAVE_RPC_TYPES_H > +# include <rpc/types.h> > +#endif > +])Considering we assume that rpc/types.h exists, there is no need to check it at configure time -- just include it directly in the AC_CHECK_HEADER for rpc/xdr.h. Also, this needs to be in its own patch (with authorship, description, etc). -- Pino Toscano
Reasonably Related Threads
- [PATCH v2 0/2] Fix building on macOS
- [PATCH v2 0/2] builder: Choose better weights in the planner.
- [PATCH] po: reduce the list of extracted sources
- [PATCH v3 0/2] builder: Choose better weights in the planner.
- [PATCH 0/2] builder: Choose better weights in the planner.