Send Beginners mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."


Today's Topics:

   1.  Use mysql-simple (OS X and dymanic library       trouble)
      (Christian Sperandio)
   2. Re:  Use mysql-simple (OS X and dymanic library   trouble)
      (Brandon Allbery)
   3. Re:  Use mysql-simple (OS X and dymanic library   trouble)
      (Christian Sperandio)
   4. Re:  Use mysql-simple (OS X and dymanic library   trouble)
      (Brandon Allbery)
   5. Re:  Use mysql-simple (OS X and dymanic library   trouble)
      (Christian Sperandio)


----------------------------------------------------------------------

Message: 1
Date: Sat, 25 Oct 2014 14:07:06 +0200
From: Christian Sperandio <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: [Haskell-beginners] Use mysql-simple (OS X and dymanic
        library trouble)
Message-ID: <[email protected]>
Content-Type: text/plain; charset="windows-1252"

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-0001.html>

------------------------------

Message: 2
Date: Sat, 25 Oct 2014 09:43:12 -0400
From: Brandon Allbery <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Use mysql-simple (OS X and dymanic
        library trouble)
Message-ID:
        <CAKFCL4V=fqBFNfCfbaHz7ao5kZCDcv1RMaFDa289yuug3S=d...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On Sat, Oct 25, 2014 at 8:07 AM, Christian Sperandio <
[email protected]> wrote:

> 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.
>

This is usually a bad idea, and what you're seeing is the least of the
things that can go wrong.

The correct fix for all of this is not to use the environment settings, but
to build the mysql binding with

    cabal install mysql-simple
--extra-lib-dirs=/usr/local/mysql-5.6.11-osx10.7-x86_64/lib

so it actually finds and records the location of the library instead of
using an unsafe override that you have to reproduce at runtime (doing that
for anything launched from the GUI is difficult, and in some OS X releases
impossible, and is always risky).

-- 
brandon s allbery kf8nh                               sine nomine associates
[email protected]                                  [email protected]
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20141025/661f7fa0/attachment-0001.html>

------------------------------

Message: 3
Date: Sat, 25 Oct 2014 17:09:41 +0200
From: Christian Sperandio <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Use mysql-simple (OS X and dymanic
        library trouble)
Message-ID: <[email protected]>
Content-Type: text/plain; charset="windows-1252"

I tried your solution but it doesn?t work.

I unregistered the previous install with ghc-pkg unregister (for mysql and 
mysql-simple) and I tried:
cabal install mysql --extra-lib-dirs=/usr/local/mysql-5.6.11-osx10.7-x86_64/lib

But I get the error again:

Resolving dependencies...
Configuring mysql-0.1.1.7...
Building mysql-0.1.1.7...
Failed to install mysql-0.1.1.7
Last 10 lines of the build log ( /Users/batman/.cabal/logs/mysql-0.1.1.7.log ):
Building mysql-0.1.1.7...
Preprocessing library mysql-0.1.1.7...
dyld: Library not loaded: libmysqlclient.18.dylib
  Referenced from: 
/private/var/folders/fk/339860r16j759wmsfmjkyr4h0000gn/T/mysql-0.1.1.7-25273/mysql-0.1.1.7/dist/build/Database/MySQL/Base/C_hsc_make
  Reason: image not found
running dist/build/Database/MySQL/Base/C_hsc_make failed (exit code -5)
command was: dist/build/Database/MySQL/Base/C_hsc_make  
>dist/build/Database/MySQL/Base/C.hs
cabal: Error: some packages failed to install:
mysql-0.1.1.7 failed during the building phase. The exception was:
ExitFailure 1




Le 25 oct. 2014 ? 15:43, Brandon Allbery <[email protected]> a ?crit :

> On Sat, Oct 25, 2014 at 8:07 AM, Christian Sperandio 
> <[email protected]> wrote:
> 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.
> 
> This is usually a bad idea, and what you're seeing is the least of the things 
> that can go wrong.
> 
> The correct fix for all of this is not to use the environment settings, but 
> to build the mysql binding with
> 
>     cabal install mysql-simple 
> --extra-lib-dirs=/usr/local/mysql-5.6.11-osx10.7-x86_64/lib
> 
> so it actually finds and records the location of the library instead of using 
> an unsafe override that you have to reproduce at runtime (doing that for 
> anything launched from the GUI is difficult, and in some OS X releases 
> impossible, and is always risky).
> 
> -- 
> brandon s allbery kf8nh                               sine nomine associates
> [email protected]                                  [email protected]
> unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners

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

------------------------------

Message: 4
Date: Sat, 25 Oct 2014 11:14:16 -0400
From: Brandon Allbery <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Use mysql-simple (OS X and dymanic
        library trouble)
Message-ID:
        <CAKFCL4V=uusbg6mnskz7vntkvr9zodhmt+99vc6-rb3hgxf...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

On Sat, Oct 25, 2014 at 11:09 AM, Christian Sperandio <
[email protected]> wrote:

> I unregistered the previous install with ghc-pkg unregister (for mysql and
> mysql-simple) and I tried:
> cabal install mysql
> --extra-lib-dirs=/usr/local/mysql-5.6.11-osx10.7-x86_64/lib
>
> But I get the error again:
>

Then I presume whoever wrote those bindings didn't follow the rules, and
you'll have to contact them to find out how to get it to work properly.
(Unfortunately there's a decent chance they made it work on Linux and don't
know about other platforms, and their only suggestion will be the
LD_LIBRARY_PATH one which will not work properly on OS X, as you found.)

-- 
brandon s allbery kf8nh                               sine nomine associates
[email protected]                                  [email protected]
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://www.haskell.org/pipermail/beginners/attachments/20141025/3ad92168/attachment-0001.html>

------------------------------

Message: 5
Date: Sat, 25 Oct 2014 17:16:47 +0200
From: Christian Sperandio <[email protected]>
To: The Haskell-Beginners Mailing List - Discussion of primarily
        beginner-level topics related to Haskell <[email protected]>
Subject: Re: [Haskell-beginners] Use mysql-simple (OS X and dymanic
        library trouble)
Message-ID: <[email protected]>
Content-Type: text/plain; charset="windows-1252"

I?ll email the maintainer of the package.


Meanwhile, I have to do the ugly export DYLD_LIBRARY_PATH :/

Thanks for your help :)


Le 25 oct. 2014 ? 17:14, Brandon Allbery <[email protected]> a ?crit :

> 
> On Sat, Oct 25, 2014 at 11:09 AM, Christian Sperandio 
> <[email protected]> wrote:
> I unregistered the previous install with ghc-pkg unregister (for mysql and 
> mysql-simple) and I tried:
> cabal install mysql 
> --extra-lib-dirs=/usr/local/mysql-5.6.11-osx10.7-x86_64/lib
> 
> But I get the error again:
> 
> Then I presume whoever wrote those bindings didn't follow the rules, and 
> you'll have to contact them to find out how to get it to work properly. 
> (Unfortunately there's a decent chance they made it work on Linux and don't 
> know about other platforms, and their only suggestion will be the 
> LD_LIBRARY_PATH one which will not work properly on OS X, as you found.)
> 
> -- 
> brandon s allbery kf8nh                               sine nomine associates
> [email protected]                                  [email protected]
> unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
> _______________________________________________
> Beginners mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/beginners

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

------------------------------

Subject: Digest Footer

_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners


------------------------------

End of Beginners Digest, Vol 76, Issue 22
*****************************************

Reply via email to