Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^3: Getting DBD-mysql to work with Mac OS X Lion

by desertrat (Acolyte)
on Jan 13, 2012 at 17:52 UTC ( #947783=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Getting DBD-mysql to work with Mac OS X Lion
in thread Getting DBD-mysql to work with Mac OS X Lion

You don't need to re-install perl, the built-in one works just fine, but the MySQL install from oracle just does not work with DBI and MySQL DBD client. Use the MacPorts mysql5 and mysql5 +server ports and everything falls into place. See my travails here <a href="http://groups.google.com/group/perl.dbi.users/browse_thread/thread/616d94b675c14b10?hl=en#"


Comment on Re^3: Getting DBD-mysql to work with Mac OS X Lion
Re^4: Getting DBD-mysql to work with Mac OS X Lion
by luis.roca (Deacon) on Jan 13, 2012 at 18:20 UTC

    “ You don't need to re-install perl, the built-in one works just fine ... ”

    No one suggested re-installing Perl but to create a second install for development purposes :-) Working with the system Perl can be fine until it isn't and then it's a huge headache (e.g., Installing modules and plugins to included modules in the same location). This became more true with Snow Leopard and has been documented, among other places, here: How Do You Use Manage Perl Modules When Using A Package Manager, here: Perl Strategy For A New Snow Leopard User and here: Perl Script Problems

    * Some of these problems were due to Snow Leopard's 32-bit/64-bit issues which should no longer exist in Lion

    UPDATE
    Same Day, 13.Jan.2012 :: 2:10 PM :: Added other links discussing maintaining separate Perl builds on Mac OSX and note on 32-bit/64-bit (Snow Leopard).


    "...the adversities born of well-placed thoughts should be considered mercies rather than misfortunes." Don Quixote
Re^4: Getting DBD-mysql to work with Mac OS X Lion
by bmckenzie (Sexton) on Jan 22, 2012 at 18:51 UTC
    Hi,

    Well I've spent some time learning about OS X Unix with the excellent Lynda.com tutorial. I uninstalled the Oracle mySQL and installed the one from MacPorts. It seems to be working OK -- I dragged my old DBs from the Windows PC into /opt/local/var/db/mysql5 and they show up in phpMyAdmin as expected.

    Alas, all this work does not seem to have impressed DBD::MySQL, which still fails in require as follows:

    Can't load '/Library/Perl/5.12/darwin-thread-multi-2level/auto/DBD/mys +ql/mysql.bundle' for module DBD::mysql: dlopen(/Library/Perl/5.12/dar +win-thread-multi-2level/auto/DBD/mysql/mysql.bundle, 1): Library not +loaded: libmysqlclient.18.dylib Referenced from: /Library/Perl/5.12/d +arwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle Reason: image n +ot found at /System/Library/Perl/5.12/darwin-thread-multi-2level/Dyna +Loader.pm line 204. at /Users/Bruce/Sites/public_html/cgi-bin/ptest.p +l line 17 Compilation failed in require at /Users/Bruce/Sites/public_ +html/cgi-bin/ptest.pl line 17. BEGIN failed--compilation aborted at / +Users/Bruce/Sites/public_html/cgi-bin/ptest.pl line 17.

    The perl script ptest.pl is a simple "Hello, World" that runs without complaint if I comment out the line "use DBD::MySQL;" Diagnosis with otool was recommended in some of the online discussion. I ran otool -L /Library/Perl/5.12/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle I got this result:

    libmysqlclient.18.dylib (compatibility version 18.0.0, current ver +sion 18.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current v +ersion 159.1.0)

    Suggestions for further troubleshooting are very welcome. I suppose the MacPorts perl distro might work better with their mySQL, but it seems like there ought to be a simpler solution.

    Cheers,

    Bruce

      Sorry to hear you're still having trouble. Could you please post the code that is failing? Specifically what does your #! line look like at the top? Did you install the DBD module in the Macports /opt directory? Other than that I would say to load the library it's asking for through Macports or, even before that, do a search to see if and where the current version is on your machine.


      "...the adversities born of well-placed thoughts should be considered mercies rather than misfortunes." Don Quixote
        Here's the script:
        #!/usr/bin/perl use strict; use warnings; use CGI; use CGI::Carp qw(fatalsToBrowser set_message); # set my module lib use FindBin qw($Bin); use lib "$Bin/perl_lib"; use Util::Std; use Util::Std qw/:IO/; use Date::DT_Util; use CGI::Application; use DBI; use DBD::MySQL; print "Content-type: text/html\n\n"; print "Hello, World";

        As noted, works fine if I comment out DBD::MySQL. The latter is where the CPAN installer put it: "(System) Library/Perl/5.12/darwin-thread-multi-2level/auto/DBD/". I noticed in the path, the file name is all lower case, where my script calls for "MySQL". However, changing this has no effect. I get the same error.

        I don't see any DynaLoader.pm in that Library where DBD::MySQL seems to be looking for it. When I went to install DynaLoader, it failed, and the CPAN installer said I'd need to force install. "force install DynaLoader" resulted in a lot of scary questions related to changing or rebuilding the C Compiler for Perl 5.8 (I've got 5.12.3 on the computer). So I bailed out. Ugh.

        Bruce

      Library not loaded: libmysqlclient.18.dylib .

      Where is libmysqlclient.18.dylib?

      What do you get when you run  ldd libmysqlclient.18.dylib ?

        Well, I don't think libmysqlclient.18.dylib exists on my system. Mac OS X doesn't have a "ldd" command; people seem to use otool for this. Not sure this is what we're looking for, but here's some info :-)
        /-> otool -L /opt/local/lib/mysql5/mysql/libmysqlclient.16.dylib /opt/local/lib/mysql5/mysql/libmysqlclient.16.dylib: /opt/local/lib/mysql5/mysql/libmysqlclient.16.dylib (compatibility + version 17.0.0, current version 17.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current v +ersion 159.1.0) /opt/local/lib/libssl.1.0.0.dylib (compatibility version 1.0.0, cu +rrent version 1.0.0) /opt/local/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, + current version 1.0.0) /opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current +version 1.2.5)

        The fix described at MySQL bugs involves using install_name_tool -id but it's not clear to me what to use for arguments, or where to put this command (.bashrsc?)

        Thx.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://947783]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (12)
As of 2014-09-02 12:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (22 votes), past polls