[Hivex] OS X and iconv
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
On Wed, Oct 16, 2013 at 01:08:02PM -0400, Alex Nelson wrote:
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 [...] Or is the correct answer to file a complaint with Apple and commence thumb-twiddling?
Heh :-) It's a bit odd that the libiconv library doesn't have a 64 bit version. However I think what you need to do is to tell configure to search in /opt/local/lib first. I believe the following should work: ./configure LDFLAGS=-L/opt/local/lib CPPFLAGS=-I/opt/local/include make There is more information in ./configure --help output. 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://people.redhat.com/~rjones/virt-top
That did it! Thank you, Rich! --Alex On Oct 16, 2013, at 15:04 , "Richard W.M. Jones" <rjones@redhat.com> wrote:
On Wed, Oct 16, 2013 at 01:08:02PM -0400, Alex Nelson wrote:
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 [...] Or is the correct answer to file a complaint with Apple and commence thumb-twiddling?
Heh :-) It's a bit odd that the libiconv library doesn't have a 64 bit version.
However I think what you need to do is to tell configure to search in /opt/local/lib first. I believe the following should work:
./configure LDFLAGS=-L/opt/local/lib CPPFLAGS=-I/opt/local/include make
There is more information in ./configure --help output.
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://people.redhat.com/~rjones/virt-top
participants (3)
-
Alex Nelson -
Alex Nelson -
Richard W.M. Jones