8 Replies Latest reply: Feb 5, 2014 6:11 AM by skybluecircles
bitsian Level 1 Level 1 (0 points)

This is further to etresoft's post on July 11, 2011 titled - Local Web Server for Lion. However, I am only referring to the installation of DBD::MySQL driver from that post.

 

I have Xcode 4.3.2 downloaded from MacApp store. However, it didn't set my environment for development libraries at all. So I included /Applications/Xcode.app/Contents/Developer/usr/bin/ in PATH so it can find common utilities like make, cc, etc.

 

I have installed mysql-5.5.23-osx10.6-x86_64 from MySQL's DMG archive. That went smooth - I am able to start and stop the server. Get in using mysql command line client interface and execute queries, etc.

 

Perl came preinstalled with 10.7.3 Lion. Version of perl is 5.12.3.

 

I am now trying to install DBD::MySQL driver for interfacing with perl and ran into issues.

 

According to MySQL documentation, I first tried to install this driver using -

 

shell> perl -MCPAN -e shell

cpan> force install DBD::mysql

 

But this failed with make errors (the error is same as reported further below).

 

Then, after days of googling, I found the original post by etresoft on installing this driver.

 

I followed the steps documented in that post (reproduced below for easy reference). My comments in italics.

 

Download the MySQL Perl driver.

 

Done. My version of DBD happens to be 4.021.

 

Extract the archive with:

tar xvf DBD-mysql-4.021.tar

 

Move into the directory:

cd DBD-mysql-4.021

 

First, fix the MySQL client library. (credit)

 

For Lion, type:

sudo install_name_tool -id /usr/local/mysql-5.5.14-osx10.6-x86_64/lib/libmysqlclient.18.dylib /usr/local/mysql-5.5.14-osx10.6-x86_64/lib/libmysqlclient.18.dylib

 

Done. No issues.


Next, build DBD::mysql with:

perl Makefile.PL --mysql_config=/usr/local/mysql/bin/mysql_config --testuser=root --testpassword=xxxxxx

 

Done. No issues.


make

 

Failed! See steps leading to the error output below.

 

Administrators-iMac:DBD-mysql-4.021 admin$ pwd

/usr/local/DBD-mysql-4.021

Administrators-iMac:DBD-mysql-4.021 admin$ perl Makefile.PL --mysql_config=/usr/local//mysql/bin/mysql_config --testuser=root --testpassword=xxxxxx

I will use the following settings for compiling and testing:

 

 

  cflags        (mysql_config ) = -I/usr/local//mysql/include  -Os -g -fno-common -fno-strict-aliasing -arch x86_64

  embedded      (mysql_config ) =

  ldflags       (mysql_config ) =

  libs          (mysql_config ) = -L/usr/local//mysql/lib -lmysqlclient -lpthread

  mysql_config  (Users choice ) = /usr/local//mysql/bin/mysql_config

  nocatchstderr (default      ) = 0

  nofoundrows   (default      ) = 0

  ssl           (guessed      ) = 0

  testdb        (default      ) = test

  testhost      (default      ) =

  testpassword  (User's choice) = xxxxxx

  testsocket    (default      ) =

  testuser      (User's choice) = root

 

 

To change these settings, see 'perl Makefile.PL --help' and

'perldoc INSTALL'.

 

 

Checking if your kit is complete...

Looks good

Using DBI 1.615 (for perl 5.012003 on darwin-thread-multi-2level) installed in /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level/auto/DBI/

Writing Makefile for DBD::mysql

Administrators-iMac:DBD-mysql-4.021 admin$ make

make: *** No rule to make target `/System/Library/Perl/5.12/darwin-thread-multi-2level/CORE/config.h', needed by `Makefile'.  Stop.

Administrators-iMac:DBD-mysql-4.021 admin$

 

I have checked the directory in which it is looking for config.h. It's not there. There's a perl.h there and a Config.pm in the directory one level up from CORE. I have been unable to proceed with further steps listed below.

 

make test

sudo make install

 

Can someone please help. I have been stuck with this for the past week or so. I have found many posts on installing this driver and all of them assume the make was successful, but for me, it fails right in the first step.

 

Cheers.


iMac, Mac OS X (10.7.3)
  • 1. Re: Problems installing DBD::MySQL on OS X Lion 10.7.3
    bitsian Level 1 Level 1 (0 points)

    Sorry - one mistake in my earlier post.

     

    The following lines -

     

    For Lion, type:

    sudo install_name_tool -id /usr/local/mysql-5.5.14-osx10.6-x86_64/lib/libmysqlclient.18.dylib /usr/local/mysql-5.5.14-osx10.6-x86_64/lib/libmysqlclient.18.dylib

     

    should instead read as below since I installed 5.5.23 MySQL version:

     

    For Lion, type:

    sudo install_name_tool -id /usr/local/mysql-5.5.23-osx10.6-x86_64/lib/libmysqlclient.18.dylib /usr/local/mysql-5.5.23-osx10.6-x86_64/lib/libmysqlclient.18.dylib


    Any help is greatly appreciated. In the meantime, I have started exploring pure perl version of DBD driver - available from CPAN as DBD::mysqlPP. If that installs succesfully, I can probably get my perl scripts to connect to mysql, but would really like my driver install problem to go away.

     

    In talking to some people who migrated from Snow Leopard to Lion, I am informed that after installing Xcode, they have all the binaries available in standard locations like /usr/bin, /bin, etc. But for me, all development utilities are only present in /Applications/Xcode.app/Contents/Developer/usr/bin/ (so I updated PATH to include this directory in search - as posted earlier). Don't know if the lack of a development environment from the terminal shell (in standard directories like /usr/bin, etc) is the cause of my grief. If someone knows of a way to get the Xcode environment recognised in terminal shell, that might also help.

     

    Cheers.

  • 2. Re: Problems installing DBD::MySQL on OS X Lion 10.7.3
    bitsian Level 1 Level 1 (0 points)

    Hooray! Latest update...

     

    Problem was as suspected. When I installed Xcode (v 4.3.2 for Lion 10.7.3), it didn't install any of the development utilities/libraries automatically - this behaviour seems to have changed from previous version of Xcode! After searching on the Apple development forums on this topic, I found that you can ask Xcode to install development utilities from Xcode->Preferences->Downloads (the development tools was sitting there waiting to be installed). Just click Install and all is well!

     

    Now my terminal shell can find all that is needed in standard locations such as /usr/bin, etc.

     

    Went back to making my original DBD::mysql after this and voila! everything installs like a charm!

     

    Though I am familiar with Unix, being a first time user to Mac, every little thing was taking away a lot of time, but now hopefully, I am all set!

     

    Hope this post helps some other damsel/dude in distress!

     

    Thanks for those who took time to review this post.

     

    Cheers.

  • 3. Re: Problems installing DBD::MySQL on OS X Lion 10.7.3
    charliemacey Level 1 Level 1 (0 points)

    Great, thank you, this solved my Perldoc issue -> I could not access perl help from the Terminal (using OS X 10.7.4 & Xcode 4.3.2):

    Before my problem was:

     

    $ perldoc -u -f atan2

    No documentation found for "perlfunc"

     

    Now after your tip -> Xcode->Preferences->Downloads and clicking Install opposite "Command Line Tools", I can now use perldoc!!

     

    $ perldoc -u -f atan2

     

     

    =over 8

     

     

    =item atan2 Y,X

    X<atan2> X<arctangent> X<tan> X<tangent>

     

     

    Returns the arctangent of Y/X in the range -PI to PI.

     

     

    For the tangent operation, you may use the C<Math::Trig::tan>

    function, or use the familiar relation:

     

     

        sub tan { sin($_[0]) / cos($_[0])  }

     

     

    The return value for C<atan2(0,0)> is implementation-defined; consult

    your atan2(3) manpage for more information.

     

     

    =back

     

     

    //Thank You for your answer!!

  • 4. Re: Problems installing DBD::MySQL on OS X Lion 10.7.3
    bitsian Level 1 Level 1 (0 points)

    Sure. Glad this post was of help to someone.

     

    Cheers.

  • 5. Re: Problems installing DBD::MySQL on OS X Lion 10.7.3
    melaxon Level 1 Level 1 (0 points)

    THIS SOLVED MY PROBLEMS ON OSX 10.8

    THANKS A LOT!!!!

  • 6. Re: Problems installing DBD::MySQL on OS X Lion 10.7.3
    zubermichal Level 1 Level 1 (0 points)

    Thanks a lot. It helped me installing on OSX 10.8.4

    I blogged about my install process at http://michalzuber.blogspot.sk/2013/06/installing-dbdmysql-on-os-x-mountain.html

  • 7. Re: Problems installing DBD::MySQL on OS X Lion 10.7.3
    mouthbreather0 Level 1 Level 1 (0 points)

    Oh, this is a real nugget! I've been struggling with this one off and on for months. Thought Oracle had done something nasty with MySQL . Thank you thank you thank you!

    Running OSX 10.7.5 on an iMac.

  • 8. Re: Problems installing DBD::MySQL on OS X Lion 10.7.3
    skybluecircles Level 1 Level 1 (0 points)

    Hi,

     

    After searching for "install libmysqlclient.18.dylib osx" I found a Python post with a really simple solution:

     

    sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/lib/libmysqlclient.18.dylib

     

    Thanks,

     

    William

     

    ref: http://stackoverflow.com/questions/9911195/libmysqlclient-18-dylib-image-not-fou nd-when-using-mysql-from-django-on-os-x