[Libguestfs] [PATCH] Fix building on macOS

Pino Toscano ptoscano at redhat.com
Wed May 9 09:03:56 UTC 2018


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>
> +#endif

This 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20180509/b1e82d43/attachment.sig>


More information about the Libguestfs mailing list