Solved

Problems installing DBD::MySQL (CPAN)

Posted on 2009-07-06
5
748 Views
Last Modified: 2013-12-26
Hi,

I'm currently having issues trying to install the DBD driver for MySQL to use with DBI.
I currently have DBI 1.609 installed.

When i go to install the DBD::MySQL it seems two directories can not be located... cflags and libs. I think i need to locate these files and then tell the script where they are (if they are there at all!).

I'll link my code below:

Thanks.
cpan> install DBD::mysql
CPAN: Storable loaded ok
Going to read /Users/stevey_mac2k2/.cpan/Metadata
  Database was generated on Sun, 05 Jul 2009 21:26:57 GMT
Running install for module DBD::mysql
Running make for C/CA/CAPTTOFU/DBD-mysql-4.012.tar.gz
CPAN: Digest::MD5 loaded ok
CPAN: Compress::Zlib loaded ok
Checksum for /Users/stevey_mac2k2/.cpan/sources/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.012.tar.gz ok
Scanning cache /Users/stevey_mac2k2/.cpan/build for sizes
DBD-mysql-4.012/
DBD-mysql-4.012/ChangeLog
DBD-mysql-4.012/constants.h
DBD-mysql-4.012/dbdimp.c
DBD-mysql-4.012/dbdimp.h
DBD-mysql-4.012/eg/
DBD-mysql-4.012/eg/._bug14979.pl
DBD-mysql-4.012/eg/bug14979.pl
DBD-mysql-4.012/eg/._bug21028.pl
DBD-mysql-4.012/eg/bug21028.pl
DBD-mysql-4.012/eg/bug30033.pl
DBD-mysql-4.012/eg/bug30033pg.pl
DBD-mysql-4.012/eg/decimal_test.pl
DBD-mysql-4.012/eg/issue21946.pl
DBD-mysql-4.012/eg/prepare_memory_usage.pl
DBD-mysql-4.012/eg/proc_example1.pl
DBD-mysql-4.012/eg/proc_example2.pl
DBD-mysql-4.012/eg/proc_example2a.pl
DBD-mysql-4.012/eg/proc_example2b.pl
DBD-mysql-4.012/eg/proc_example3.pl
DBD-mysql-4.012/eg/proc_example4.pl
DBD-mysql-4.012/INSTALL.html
DBD-mysql-4.012/lib/
DBD-mysql-4.012/lib/Bundle/
DBD-mysql-4.012/lib/Bundle/DBD/
DBD-mysql-4.012/lib/Bundle/DBD/mysql.pm
DBD-mysql-4.012/lib/DBD/
DBD-mysql-4.012/lib/DBD/mysql/
DBD-mysql-4.012/lib/DBD/mysql/GetInfo.pm
DBD-mysql-4.012/lib/DBD/mysql/INSTALL.pod
DBD-mysql-4.012/lib/DBD/mysql.pm
DBD-mysql-4.012/Makefile.PL
DBD-mysql-4.012/Makefile.PL.embedded
DBD-mysql-4.012/MANIFEST
DBD-mysql-4.012/MANIFEST.SKIP
DBD-mysql-4.012/META.yml
DBD-mysql-4.012/myld
DBD-mysql-4.012/mysql.xs
DBD-mysql-4.012/README
DBD-mysql-4.012/t/
DBD-mysql-4.012/t/00base.t
DBD-mysql-4.012/t/10connect.t
DBD-mysql-4.012/t/20createdrop.t
DBD-mysql-4.012/t/25lockunlock.t
DBD-mysql-4.012/t/29warnings.t
DBD-mysql-4.012/t/30insertfetch.t
DBD-mysql-4.012/t/31insertid.t
DBD-mysql-4.012/t/32insert_error.t
DBD-mysql-4.012/t/35limit.t
DBD-mysql-4.012/t/35prepare.t
DBD-mysql-4.012/t/40bindparam.t
DBD-mysql-4.012/t/40bindparam2.t
DBD-mysql-4.012/t/40blobs.t
DBD-mysql-4.012/t/40catalog.t
DBD-mysql-4.012/t/40keyinfo.t
DBD-mysql-4.012/t/40listfields.t
DBD-mysql-4.012/t/40nulls.t
DBD-mysql-4.012/t/40numrows.t
DBD-mysql-4.012/t/40server_prepare.t
DBD-mysql-4.012/t/40server_prepare_error.t
DBD-mysql-4.012/t/40types.t
DBD-mysql-4.012/t/41bindparam.t
DBD-mysql-4.012/t/41blobs_prepare.t
DBD-mysql-4.012/t/42bindparam.t
DBD-mysql-4.012/t/50chopblanks.t
DBD-mysql-4.012/t/50commit.t
DBD-mysql-4.012/t/51bind_type_guessing.t
DBD-mysql-4.012/t/55utf8.t
DBD-mysql-4.012/t/60leaks.t
DBD-mysql-4.012/t/65types.t
DBD-mysql-4.012/t/70takeimp.t
DBD-mysql-4.012/t/71impdata.t
DBD-mysql-4.012/t/75supported_sql.t
DBD-mysql-4.012/t/76multi_statement.t
DBD-mysql-4.012/t/80procs.t
DBD-mysql-4.012/t/lib.pl
DBD-mysql-4.012/t/mysql.dbtest
DBD-mysql-4.012/t/mysql.mtest
DBD-mysql-4.012/TODO
Removing previously used /Users/stevey_mac2k2/.cpan/build/DBD-mysql-4.012
 
  CPAN.pm: Going to build C/CA/CAPTTOFU/DBD-mysql-4.012.tar.gz
 
 
 
PLEASE NOTE:
 
For 'make test' to run properly, you must ensure that the 
database user 'root' can connect to your MySQL server 
and has the proper privileges that these tests require such 
as 'drop table', 'create table', 'drop procedure', 'create procedure'
as well as others. 
 
mysql> grant all privileges on test.* to 'root'@'localhost' identified by 's3kr1t';
 
You can also optionally set the user to run 'make test' with:
 
perl Makefile.pl --testuser=username
 
I will use the following settings for compiling and testing:
 
  cflags        (mysql_config) = -I/usr/local/mysql/include  -g -Os -arch i386 -fno-common   -D_P10
+03_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT  -DDONT_DE
+CLARE_CXA_PURE_VIRTUAL
  embedded      (mysql_config) = 
  libs          (mysql_config) = -L/usr/local/mysql/lib -lmysqlclient -lz -lm     -lmygcc
  mysql_config  (guessed     ) = mysql_config
  nocatchstderr (default     ) = 0
  nofoundrows   (default     ) = 0
  ssl           (guessed     ) = 0
  testdb        (default     ) = test
  testhost      (default     ) = 
  testpassword  (default     ) = 
  testsocket    (default     ) = 
  testuser      (guessed     ) = root
 
To change these settings, see 'perl Makefile.PL --help' and
'perldoc INSTALL'.
 
Checking if your kit is complete...
Looks good
Using DBI 1.609 (for perl 5.008008 on darwin-thread-multi-2level) installed in /Library/Perl/5.8.8/
+darwin-thread-multi-2level/auto/DBI/
Writing Makefile for DBD::mysql
    -- NOT OK
Running make test
  Can't test without successful make
Running make install
  make had returned bad status, install seems impossible

Open in new window

0
Comment
Question by:StephenMcGowan
  • 3
5 Comments
 
LVL 13

Accepted Solution

by:
kawas earned 400 total points
ID: 24785876
Found a similar problem to yours here: http://osdir.com/ml/lang.perl.macosx/2007-06/msg00003.html

They downloaded the module from cpan.org, installed as root. Apparently, command line cpan didnt work for them either. The thread is about 8 messages long, so maybe take a look at what they did to solve the problem and try it yourself.

Good luck
0
 
LVL 39

Assisted Solution

by:Adam314
Adam314 earned 100 total points
ID: 24785919
The output you posted doesn't contain the errors from make.  Was there more output?  What do you get if you try running make from the command line?
0
 

Author Comment

by:StephenMcGowan
ID: 24786283
Ok thanks guys, i think i'm on top of this now.

Yeah it seems to me the error is in the directories for cflags and libs.

(shown top of code box)

Having read the help... it says for these two:

Possible options are:

  --cflags=<flags>       Use <flags> for running the C compiler; defaults
                         to the value of "mysql_config --cflags" or a guessed
                         value
  --libs=<libs>          Use <libs> for running the linker; defaults
                         to the value of "mysql_config --libs" or a gussed
                         value

So i'm guessing i need to change the defaults to the value "mysql_config --cflags" and "mysql_config --libs".

Would this be right? and if so how would i go about this?

Thanks again
 cflags        (mysql_config) = -I/usr/local/mysql/include  -g -Os -arch i386 -fno-common   -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT  -DDONT_DECLARE_CXA_PURE_VIRTUAL
  embedded      (mysql_config) = 
  libs          (mysql_config) = -L/usr/local/mysql/lib -lmysqlclient -lz -lm     -lmygcc
  mysql_config  (guessed     ) = mysql_config
  nocatchstderr (default     ) = 0
  nofoundrows   (default     ) = 0
  ssl           (guessed     ) = 0
  testdb        (default     ) = test
  testhost      (default     ) = 
  testpassword  (default     ) = 
  testsocket    (default     ) = 
  testuser      (guessed     ) = root

Open in new window

0
 

Author Comment

by:StephenMcGowan
ID: 24786473
I'm currently working through this guide.. which seems to be well documented on this error:

http://jayallen.org/journey/2006/04/dbd-mysql-build-problems-on-mac-book-pro

The guide states:

"Clearly the build script couldn't find the MySQL libraries. Looking more carefully at the output from the first command, I noticed the following two lines:

cflags   (mysql_config) = -I/usr/local/mysql/include/mysql -Os -arch i386 -fno-common
libs     (mysql_config) = -L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lm
I checked to see if those two directories existed and  surprise, surprise!  they did not. I ran the mysql_config command manually to check whether it was also reporting false values:

# mysql_config --cflags
-I/usr/local/mysql/include/mysql -Os -arch i386 -fno-common

# mysql_config --libs
-L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lm
Indeed it was. However, I noticed that if I stripped off mysql from the end of the path gave me the correct directories contained all of MySQL's header and include files. Hooray.

The Solution

So, the solution to the problem is simply to specify the cflags and libs options in the Makefile creation step with the correct directories. For me, this was the final command:

sudo perl Makefile.PL \
 --cflags="-I/usr/local/mysql/include -Os -arch i386 -fno-common" \
 --libs="-L/usr/local/mysql/lib -lmysqlclient -lz -lm"

This is probably the case for you as well, but to make sure, simply check that both of the directories above exist. After this, you should be able to successfully perform the sudo make and sudo make install commands and be up and running."

The problem i seem to be having is actually locating cflags and libs in the mysql_config to able to begin on this.

Stephen
0
 

Author Comment

by:StephenMcGowan
ID: 24786612
I think i've spotted something on this:

My mysql_config command pulls up:

Usage: /usr/local/mysql-5.1.36-osx10.5-x86/bin/mysql_config [OPTIONS]
Options:
        --cflags         [-I/usr/local/mysql-5.1.36-osx10.5-x86/include  -g -Os -arch i386 -fno-common   -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT  -DDONT_DECLARE_CXA_PURE_VIRTUAL]
        --include        [-I/usr/local/mysql-5.1.36-osx10.5-x86/include]
        --libs           [-L/usr/local/mysql-5.1.36-osx10.5-x86/lib -lmysqlclient -lz -lm     -lmygcc]
        --libs_r         [-L/usr/local/mysql-5.1.36-osx10.5-x86/lib -lmysqlclient_r -lz -lm     -lmygcc]
        --plugindir      [/usr/local/mysql/lib/plugin]
        --socket         [/tmp/mysql.sock]
        --port           [0]
        --version        [5.1.36]
        --libmysqld-libs [-L/usr/local/mysql-5.1.36-osx10.5-x86/lib -lmysqld -ldl  -lz -lm       -lmygcc]

you'll see ----cflags in mysql_config is linked to------
 -I/usr/local/mysql-5.1.36-osx10.5-x86/include
and -----libs is linked to------
 -L/usr/local/mysql-5.1.36-osx10.5-x86/lib -lmysqlclient_r

so DBD::mysql is looking for:

  cflags        (mysql_config) = -I/usr/local/mysql/include  -g -Os -arch i386 -fno-common   -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT  -DDONT_DECLARE_CXA_PURE_VIRTUAL
  embedded      (mysql_config) =
  libs          (mysql_config) = -L/usr/local/mysql/lib -lmysqlclient -lz -lm     -lmygcc
  mysql_config  (guessed     ) = mysql_config
  nocatchstderr (default     ) = 0
  nofoundrows   (default     ) = 0
  ssl           (guessed     ) = 0
  testdb        (default     ) = test
  testhost      (default     ) =
  testpassword  (default     ) =
  testsocket    (default     ) =
  testuser      (guessed     ) = root

which are completely different directories... so i need to change the mysql_config?

Stephen
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
simple shopping cart database structure 5 47
MySQL Memory Keeps Increasing 4 37
Complex MySQL Query 2 20
Present Absent from working date rage 11 21
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Creating and Managing Databases with phpMyAdmin in cPanel.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question