[sf-perl] Building File::LibMagic on OS X

Bill Moseley moseley at hank.org
Tue Jun 26 07:47:15 PDT 2012


Well, nothing like sending out an email to improve the google searches:

https://github.com/mxcl/homebrew/issues/7280

Turns out the symlinks are important.

Can anyone provide some OS X debugging tips (more than I have below) for
situations like this?   It's not the first time I've stumbled around with a
build problem on OS X.

Thanks,

On Tue, Jun 26, 2012 at 9:36 AM, Bill Moseley <moseley at hank.org> wrote:

> I need some help understanding how to build the File::LibMagic module on
> OS X 10.6.
>
>
> I've installed Libmagic using homebrew.  The homebrew formula used:
> ftp://ftp.astron.com/pub/file/file-5.04.tar.gz
>
> Now the header and lib ended up in odd places:
>
> $ find /usr/local -name libmagic\*
> /usr/local/Cellar/libmagic
> /usr/local/Cellar/libmagic/5.04/lib/libmagic.1.0.0.dylib
> /usr/local/Cellar/libmagic/5.04/lib/libmagic.1.dylib
> /usr/local/Cellar/libmagic/5.04/lib/libmagic.a
> /usr/local/Cellar/libmagic/5.04/lib/libmagic.dylib
> /usr/local/Cellar/libmagic/5.04/share/man/man3/libmagic.3
> /usr/local/Library/Formula/libmagic.rb
>
> $ find /usr/local -name magic.h | grep -v Image
> /usr/local/Cellar/libmagic/5.04/include/magic.h
>
>
> I seem to be able to build the Perl module like this:
>
> $ perl Makefile.PL INC=-I/usr/local/Cellar/libmagic/5.04/include
> LIBS='-L/usr/local/Cellar/libmagic/5.04/lib'
>
>
> "make" seems to run fine, but, the tests fail with this:
>
> Can't load
> '/Users/moseley/.cpan/build/File-LibMagic-0.96-HoXX3N/blib/arch/auto/File/LibMagic/LibMagic.bundle'
> for module File::LibMagic:
> dlopen(/Users/moseley/.cpan/build/File-LibMagic-0.96-HoXX3N/blib/arch/auto/File/LibMagic/LibMagic.bundle,
> 2): Symbol not found: _magic_buffer
>   Referenced from:
> /Users/moseley/.cpan/build/File-LibMagic-0.96-HoXX3N/blib/arch/auto/File/LibMagic/LibMagic.bundle
>   Expected in: dynamic lookup
>
> That symbol is in the libmagic library:
>
> $ nm  -gU /usr/local/Cellar/libmagic/5.04/lib/libmagic.1.dylib | grep
> magic_buffer
> 0000000000000fc0 T _magic_buffer
>
> My guess is runtime isn't linking to libmagic.1.dylib (IIRC, OS X doesn't
> have a default search path), but if that was the case then I would think
> I'd see an error about not finding the library at run time.
>
> And that's the limit of my OS X knowledge.  If "otool -L" is similar to
> "ldd" then doesn't look like it's linked at all with libmagic, right?
>
> $ otool -L
> /Users/moseley/.cpan/build/File-LibMagic-0.96-HoXX3N/blib/arch/auto/File/LibMagic/LibMagic.bundle
>
> /Users/moseley/.cpan/build/File-LibMagic-0.96-HoXX3N/blib/arch/auto/File/LibMagic/LibMagic.bundle:
>  /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
> 125.2.11)
>
>
> Thanks,
>
>
> --
> Bill Moseley
> moseley at hank.org
>



-- 
Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20120626/d95f5d8a/attachment.html>


More information about the SanFrancisco-pm mailing list