[Libguestfs] [Hivex] [PATCH] lib: Promote byte_conversions.h #include to hivex-internal.h
Richard W.M. Jones
rjones at redhat.com
Wed Oct 16 13:18:16 UTC 2013
On Tue, Oct 15, 2013 at 09:28:13PM -0400, Alex Nelson wrote:
> This patch addresses a build failure in OS X. Running git-bisect on a
> straightforward build (bootstrap, autogen.sh, configure, make, make
> install) showed this as the "Bad commit:"
> 3e7c039799cddc45517350cc917eb10715f33fec
>
> The issue is that hivex-internal.h uses le32toh in a static inline
> function. In case `configure` doesn't find le32toh, byte_conversions.h
> defines it. But hivex-internal.h doesn't include the safety definition.
>
> OS X demonstrates this a problem. Neither endian.h nor byteswap.h are
> found with `configure` in OS X 10.8.5 (XCode 5), but the headers are
> both found in Fedora 19 and Ubuntu 13.04. This patch to configure.ac
> further logs that only ntohl is available for byte swaps:
>
> @@ -153,6 +153,8 @@ AC_REPLACE_FUNCS([mmap])
> dnl Functions.
> AC_CHECK_FUNCS([bindtextdomain])
>
> +AC_CHECK_FUNCS([le32toh ntohl bswap_32 __bswap_32])
> +
>
> (As an aside, it's curious that a missing byteswap.h didn't cause
> hivex-internal.h to fail to build.)
> (As another aside, this is an interesting example of lazy symbol
> binding failing with an inline function.)
>
> The problem is resolved by having hivex-internal.h include
> byte_conversions.h. This obviates most of the other direct inclusions
> of byte_conversions.h. (One persists under sh/.)
>
> This patch builds and runs hivexml on images/large fine in Ubuntu 13.04
> and Fedora 19. It also allows builds to succeed in OS X, but doesn't
> run hivexml for an unrelated reason. The _iconv_open
> symbol-not-found issue, that I thought was previously resolved
> (491ba0f7a761c7ffd50e0eaa4d892f78d538eb2b), resurfaced.
>
> Signed-off-by: Alex Nelson <a.nelson at prometheuscomputing.com>
Hi Alex,
This all looks good to me. I've ACKed and pushed it.
Thanks,
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
More information about the Libguestfs
mailing list