[PATCH 0/3] hivex: Improve OS X support
This patch series improves, but does not complete, OS X support for hivex. There are several outstanding issues before hivexml and hivexsh can run: * hivexsh uses open_memstream, which doesn't exist in OS X as near as I can see. Unfortunately, I'm inexperienced with autoconf, so I'm not sure how to employ AC_CHECK_FUNCS([open_memstream]) to conditionally add 'sh' to the Makefile.am's SUBDIRS. * The check for libxml fails, because PKG_CHECK_CONFIG doesn't exist on OS X. I think it would be better to use AC_CHECK_FUNCS on some of the libxml functions, but again, I'm not too hot with autoconf and automake. * hivexml has the following run-time failure: dyld: lazy symbol binding failed: Symbol not found: _iconv_open Referenced from: /Users/alex/local/src/hivex/lib/.libs/libhivex.0.dylib Expected in: flat namespace dyld: Symbol not found: _iconv_open Referenced from: /Users/alex/local/src/hivex/lib/.libs/libhivex.0.dylib Expected in: flat namespace Trace/BPT trap: 5 I have the vague idea of how to address the first two, but not the last. I would appreciate any help on these. Gillen, you said earlier this weekend you had taken a stab at compiling things in OS X. Did you have to take these steps, too? --Alex Alex Nelson (3): Mac OS X: Detect bindtextdomain Mac OS X: setlocale function requires locale.h Mac OS X: Run glibtoolize in absence of libtoolize bootstrap | 2 +- configure.ac | 3 +++ sh/hivexsh.c | 3 +++ xml/hivexml.c | 3 +++ 4 files changed, 10 insertions(+), 1 deletions(-) -- 1.7.4.4
On 09/06/2011 03:52 AM, Alex Nelson wrote:
This patch series improves, but does not complete, OS X support for hivex. There are several outstanding issues before hivexml and hivexsh can run:
* hivexsh uses open_memstream, which doesn't exist in OS X as near as I can see. Unfortunately, I'm inexperienced with autoconf, so I'm not sure how to employ AC_CHECK_FUNCS([open_memstream]) to conditionally add 'sh' to the Makefile.am's SUBDIRS.
* The check for libxml fails, because PKG_CHECK_CONFIG doesn't exist on OS X. I think it would be better to use AC_CHECK_FUNCS on some of the libxml functions, but again, I'm not too hot with autoconf and automake.
* hivexml has the following run-time failure: dyld: lazy symbol binding failed: Symbol not found: _iconv_open Referenced from: /Users/alex/local/src/hivex/lib/.libs/libhivex.0.dylib Expected in: flat namespace
dyld: Symbol not found: _iconv_open Referenced from: /Users/alex/local/src/hivex/lib/.libs/libhivex.0.dylib Expected in: flat namespace
Trace/BPT trap: 5
I have the vague idea of how to address the first two, but not the last. I would appreciate any help on these. Gillen, you said earlier this weekend you had taken a stab at compiling things in OS X. Did you have to take these steps, too?
--Alex
Alex Nelson (3): Mac OS X: Detect bindtextdomain Mac OS X: setlocale function requires locale.h Mac OS X: Run glibtoolize in absence of libtoolize
bootstrap | 2 +- configure.ac | 3 +++ sh/hivexsh.c | 3 +++ xml/hivexml.c | 3 +++ 4 files changed, 10 insertions(+), 1 deletions(-)
I was only interested in the lib itself, so I can't speak for the tools. I can confirm that libxml2 is not found due to the lack of pkg-config. Additionally, as explained in my last mail, I had to patch lib/byte_conversions.h as shown below. About your "Symbol not found: _iconv_open" problem, this hit to me too when I linked against hivex. It's due to a missing -liconv on platforms where this is needed. -- Unix _IS_ user friendly - it's just selective about who its friends are!
On Tue, Sep 06, 2011 at 08:10:31AM +0200, GIDA wrote:
Additionally, as explained in my last mail, I had to patch lib/byte_conversions.h as shown below.
Thanks, I pushed this. Rich. -- 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 Mon, Sep 05, 2011 at 06:52:43PM -0700, Alex Nelson wrote:
This patch series improves, but does not complete, OS X support for hivex. There are several outstanding issues before hivexml and hivexsh can run:
* hivexsh uses open_memstream, which doesn't exist in OS X as near as I can see. Unfortunately, I'm inexperienced with autoconf, so I'm not sure how to employ AC_CHECK_FUNCS([open_memstream]) to conditionally add 'sh' to the Makefile.am's SUBDIRS.
You need to use an automake conditional. It'll be something like this (not tested): AM_CONDITIONAL([HAVE_HIVESH],[test "x$HAVE_OPEN_MEMSTREAM" = "x1"]) and then in Makefile.am: if HAVE_HIVESH SUBDIRS += sh endif There are plenty of examples of this in the libguestfs source, eg. have a look at HAVE_PERL in configure.ac and Makefile.am.
* The check for libxml fails, because PKG_CHECK_CONFIG doesn't exist on OS X. I think it would be better to use AC_CHECK_FUNCS on some of the libxml functions, but again, I'm not too hot with autoconf and automake.
Grumble. OS X sounds a bit broken if it doesn't include pkg-config files (*.pc). Is libxml2 provided in the base OS X or is this coming from an outside project like MacPorts?
* hivexml has the following run-time failure: dyld: lazy symbol binding failed: Symbol not found: _iconv_open Referenced from: /Users/alex/local/src/hivex/lib/.libs/libhivex.0.dylib Expected in: flat namespace
dyld: Symbol not found: _iconv_open Referenced from: /Users/alex/local/src/hivex/lib/.libs/libhivex.0.dylib Expected in: flat namespace
Trace/BPT trap: 5
Missing libiconv on OS X?? I don't really know about this one. 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
Rich, Gillen, Thank you both for the help, I've made some more progress. Notes below. On Sep 6, 2011, at 05:38 , Richard W.M. Jones wrote:
On Mon, Sep 05, 2011 at 06:52:43PM -0700, Alex Nelson wrote:
This patch series improves, but does not complete, OS X support for hivex. There are several outstanding issues before hivexml and hivexsh can run:
* hivexsh uses open_memstream, which doesn't exist in OS X as near as I can see. Unfortunately, I'm inexperienced with autoconf, so I'm not sure how to employ AC_CHECK_FUNCS([open_memstream]) to conditionally add 'sh' to the Makefile.am's SUBDIRS.
You need to use an automake conditional. It'll be something like this (not tested):
AM_CONDITIONAL([HAVE_HIVESH],[test "x$HAVE_OPEN_MEMSTREAM" = "x1"])
and then in Makefile.am:
if HAVE_HIVESH SUBDIRS += sh endif
There are plenty of examples of this in the libguestfs source, eg. have a look at HAVE_PERL in configure.ac and Makefile.am.
Ok, I've gotten this to work on OS X and Fedora Core 15. `make check` fails on OS X still, though I'm not sure it ever worked to begin with. `make check` works fine on FC15. Patch incoming.
* The check for libxml fails, because PKG_CHECK_CONFIG doesn't exist on OS X. I think it would be better to use AC_CHECK_FUNCS on some of the libxml functions, but again, I'm not too hot with autoconf and automake.
Grumble. OS X sounds a bit broken if it doesn't include pkg-config files (*.pc). Is libxml2 provided in the base OS X or is this coming from an outside project like MacPorts?
libxml2 is provided in the base OS X, though one can install a different version with MacPorts. Do you have any recommendations on how to fix this check? Commenting it out works well enough on OS X, it seems.
* hivexml has the following run-time failure: dyld: lazy symbol binding failed: Symbol not found: _iconv_open Referenced from: /Users/alex/local/src/hivex/lib/.libs/libhivex.0.dylib Expected in: flat namespace
dyld: Symbol not found: _iconv_open Referenced from: /Users/alex/local/src/hivex/lib/.libs/libhivex.0.dylib Expected in: flat namespace
Trace/BPT trap: 5
Missing libiconv on OS X?? I don't really know about this one.
Gillen, you seem to have the right idea in your other message, passing -liconv in hivexml_CFLAGS (also works passing in hivex_CFLAGS). I can now compile, run, and produce a lot of Chinese with hivexml. ...That last one was an unexpected feature, given the American image I was analyzing. How do you test for whether you're on a system that needs that argument, though? --Alex
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
On Tue, Sep 06, 2011 at 08:42:40PM -0700, Alex Nelson wrote:
libxml2 is provided in the base OS X, though one can install a different version with MacPorts.
Do you have any recommendations on how to fix this check? Commenting it out works well enough on OS X, it seems.
I don't like commenting out what is a good test on non-broken systems. In particular, libxml2 uses the pkg-config system to set the correct CFLAGS, which can be vital to correctly compiling on some systems. We should keep the PKG_CHECK_MODULES test and only fallback if that fails. Something like: PKG_CHECK_MODULES([LIBXML2], [libxml-2.0], [], [ AC_CHECK_LIB([xml2], [xmlNewTextWriter], [LIBXML2_LIBS="-lxml2"]) ... also check for and set LIBXML2_CFLAGS ... ]) AC_SUBST([LIBXML2_CFLAGS]) AC_SUBST([LIBXML2_LIBS]) The pkg-config(1) man page has good documentation.
Gillen, you seem to have the right idea in your other message, passing -liconv in hivexml_CFLAGS (also works passing in hivex_CFLAGS). I can now compile, run, and produce a lot of Chinese with hivexml. ...That last one was an unexpected feature, given the American image I was analyzing.
How do you test for whether you're on a system that needs that argument, though?
You have to write a configure test for it. The autoconf documentation covers this in detail. 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
participants (3)
-
Alex Nelson -
GIDA -
Richard W.M. Jones