[Libguestfs] [Hivex] OS X and iconv

Alex Nelson ajnelson at cs.ucsc.edu
Wed Oct 16 17:08:02 UTC 2013


Hi all,

The linking problem I found yesterday appears to be because of the built-in iconv in OS X.  So, this is a request for patch or pointers: What needs to happen with configure.ac or the iconv.m4 macro file to link an iconv library _besides_ the one in /usr/local/lib?  That's the tl;dr, full explanation follows.

That library lacks the x86_64 architecture:

    $ file /usr/local/lib/libiconv.dylib
    libiconv.dylib: Mach-O universal binary with 2 architectures
    libiconv.dylib (for architecture i386):	Mach-O dynamically linked shared library i386
    libiconv.dylib (for architecture ppc):	Mach-O dynamically linked shared library ppc

Make complains, though it could stand to complain with more violence to the build:

    [snip]
    Making all in tools
    make[3]: Nothing to be done for `all'.
      CC       libhivex_la-handle.lo
      CC       libhivex_la-node.lo
      CC       libhivex_la-offset-list.lo
      CC       libhivex_la-utf16.lo
      CC       libhivex_la-util.lo
      CC       libhivex_la-value.lo
      CC       libhivex_la-visit.lo
      CC       libhivex_la-write.lo
      CCLD     libhivex.la
    ld: warning: ld: warning: ignoring file /usr/local/lib/libiconv.dylib, missing required architecture x86_64 in file /usr/local/lib/libiconv.dylib (2 slices)ignoring file ./hivex.syms, file was built for unsupported file format ( 0x23 0x20 0x68 0x69 0x76 0x65 0x78 0x20 0x67 0x65 0x6E 0x65 0x72 0x61 0x74 0x65 ) which is not the architecture being linked (x86_64): ./hivex.syms
    
    /opt/local/bin/ranlib: file: .libs/libhivex.a(fd-hook.o) has no symbols
    ranlib: file: .libs/libhivex.a(fd-hook.o) has no symbols
    Making all in images
    [snip]

MacPorts' iconv works fine:

    $ file /opt/local/lib/libiconv.dylib
    /opt/local/lib/libiconv.dylib: Mach-O 64-bit dynamically linked shared library x86_64

In theory, XCode's does too [1], though I tried that suggestion and it didn't work for me.

The way to get compilation to work is to remove the iconv library files from /usr/local/lib [2, 3].  I tried moving them to a temporary folder, and when I did that and rebuilt, Hivexml ran without a hitch.

So, what would work in configure.ac to get Hivex to remove /usr/local/lib from the library paths for OS X, but just for iconv?

Or is the correct answer to file a complaint with Apple and commence thumb-twiddling?

--Alex

[1] http://stackoverflow.com/a/18170376/1207160
[2] http://stackoverflow.com/a/4929905/1207160
[3] https://trac.macports.org/ticket/28302
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4889 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20131016/69e888bf/attachment.p7s>


More information about the Libguestfs mailing list