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

Christian Sperandio christian.sperandio at gmail.com
Sat Oct 25 12:07:06 UTC 2014


Hi,


I’d like to use Haskell for some processing on a MySQL database. Currently, I use Java program to do that but I’d like to change.And an important information, I’m working on OS X Maverick and I use EclipseFP.

I installed mysql-simple package. I had some troubles.
First, I had to download pcre to get a pcre.h I put into the /usr/include dir. 
After, to link the mysql-simple package I did an export LD_LIBRARY_PATH=/usr/local/mysql-5.6.11-osx10.7-x86_64/lib. Thus, the library libmysqlclient.18.dylib was found.
All stuff above were done by command line.

Now, I want to code a simple program: 

module Main where

import Database.MySQL.Simple


main::IO()
main = undefined

hello :: IO Int
hello = do
   conn <- connect defaultConnectInfo
   [Only i] <- query_ conn "select 2 + 2"
   return i

But when I try to launch a repl from EclipseFP, I’ve got this error: 
Loading package mysql-0.1.1.7 ... <command line>: can't load .so/.DLL for: /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 (dlopen(/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, 9): Library not loaded: libmysqlclient.18.dylib
  Referenced from: /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
  Reason: image not found)

How can I set the place of this library ? I read some stuff on the web but I don’t understand everything :(

Thanks for your help.

Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20141025/ccf13cba/attachment.html>


More information about the Beginners mailing list