I need some help understanding how to build the File::LibMagic module on OS X 10.6.<div><br></div><div><br></div><div>I've installed Libmagic using homebrew.  The homebrew formula used:  <a href="ftp://ftp.astron.com/pub/file/file-5.04.tar.gz">ftp://ftp.astron.com/pub/file/file-5.04.tar.gz</a></div>

<div><br></div><div>Now the header and lib ended up in odd places:</div><div><br></div><div><div>$ find /usr/local -name libmagic\*</div><div>/usr/local/Cellar/libmagic</div><div>/usr/local/Cellar/libmagic/5.04/lib/libmagic.1.0.0.dylib</div>

<div>/usr/local/Cellar/libmagic/5.04/lib/libmagic.1.dylib</div><div>/usr/local/Cellar/libmagic/5.04/lib/libmagic.a</div><div>/usr/local/Cellar/libmagic/5.04/lib/libmagic.dylib</div><div>/usr/local/Cellar/libmagic/5.04/share/man/man3/libmagic.3</div>

<div>/usr/local/Library/Formula/libmagic.rb</div><div><br></div><div><div>$ find /usr/local -name magic.h | grep -v Image</div><div>/usr/local/Cellar/libmagic/5.04/include/magic.h</div></div><div><br></div><div><br></div>

<div>I seem to be able to build the Perl module like this:</div><div><br></div><div>$ perl Makefile.PL INC=-I/usr/local/Cellar/libmagic/5.04/include LIBS='-L/usr/local/Cellar/libmagic/5.04/lib'</div><div><br></div>

<div><br></div><div>"make" seems to run fine, but, the tests fail with this:</div><div><br></div><div><div>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</div>

<div>  Referenced from: /Users/moseley/.cpan/build/File-LibMagic-0.96-HoXX3N/blib/arch/auto/File/LibMagic/LibMagic.bundle</div><div>  Expected in: dynamic lookup</div></div><div><br></div><div>That symbol is in the libmagic library:</div>

<div><br></div><div><div>$ nm  -gU /usr/local/Cellar/libmagic/5.04/lib/libmagic.1.dylib | grep magic_buffer</div><div>0000000000000fc0 T _magic_buffer</div></div><div><br></div><div>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.</div>

<div><br></div><div>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?</div><div><br></div><div><div>

$ otool -L /Users/moseley/.cpan/build/File-LibMagic-0.96-HoXX3N/blib/arch/auto/File/LibMagic/LibMagic.bundle</div><div>/Users/moseley/.cpan/build/File-LibMagic-0.96-HoXX3N/blib/arch/auto/File/LibMagic/LibMagic.bundle:</div>

<div><span class="Apple-tab-span" style="white-space:pre">      </span>/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)</div></div><div><br></div><div><br></div><div>Thanks,</div><div><br></div>

<div><div><br></div>-- <br>Bill Moseley<br><a href="mailto:moseley@hank.org" target="_blank">moseley@hank.org</a><br>
</div></div>