[Haskell-beginners] Use mysql-simple (OS X and dymanic library trouble)

Brandon Allbery allbery.b at gmail.com
Sat Oct 25 15:30:11 UTC 2014


On Sat, Oct 25, 2014 at 11:22 AM, Christian Sperandio <
christian.sperandio at gmail.com> wrote:

> Thanks for the trick :)
>
> The solution is perhaps to try another mysql library :/
>

It's the nonstandard location that is the problem, really. The
--extra-lib-dirs thing should have caused the special location to be used,
but it relies on whoever wrote the bindings paying attention to
extra-lib-dirs.

On Linux, you have /etc/ld.so.conf as a list of directories to search for
shared objects and LD_LIBRARY_PATH to add extra directories to it. On OS X,
shared library paths are normally compiled into the things that use them
and DYLD_LIBRARY_PATH overrides this completely (which means setting it can
cause all programs to fail to find any shared libraries, oops!).
DYLD_FALLBACK_LIBRARY_PATH is tried if it can't find the shared library at
its normal location, which is risky but safer than DYLD_LIBRARY_PATH.

If that shared object /Users/batman/Library/Haskell/
ghc-7.8.3-x86_64/lib/mysql-0.1.1.7/libHSmysql-0.1.1.7-ghc7.8.3.dylib was
built with the right option (-headerpad_max_install_names, IIRC) then you
may be able to use install_name_tool to fix the shared object path in it.
You'll need to use otool -L to check what name is there and then
install_name_tool to replace it.

Alternately you can check with otool -L what pathname was stored in the
mysql shared library itself and maybe fix that with install_name_tool.

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20141025/0f59b52e/attachment.html>


More information about the Beginners mailing list