MySQL Forums
Forum List  »  Perl

error on install DBD::mysql
Posted by: Jiong Wang
Date: May 04, 2011 03:27PM

I got the following error while testing my perl code which needed to access a MySQL database.

Can't locate DBD/mysql.pm in @INC

I tried to do CPAN install of DBD::mysql but got the following error:

Can't exec "mysql_config"

Some online post suggested installing MySQL-devel packages so I installed both 32bit and 64bit versions of it (5.1.55 is the closest package that I can find to match the 5.1.50 server).

[root@dev_mhportal_cim eis3d]# rpm -qa | grep -i mysql
MySQL-devel-community-5.1.55-1.rhel5
MySQL-server-community-5.1.50-1.rhel5
MySQL-client-community-5.1.50-1.rhel5
MySQL-devel-community-5.1.55-1.rhel5

Then we tried the CPAN installation of DBD::mysql and got the following error. You kindly help is greatly appreciated.

########## error message started ##########
[root@dev_mhportal_cim eis3d]# perl -MCPAN -e shell
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v1.7602)
ReadLine support available (try 'install Bundle::CPAN')

cpan> install DBD::mysql
CPAN: Storable loaded ok
Going to read /root/.cpan/Metadata
Database was generated on Mon, 02 May 2011 07:39:34 GMT
Running install for module DBD::mysql
Running make for C/CA/CAPTTOFU/DBD-mysql-4.018.tar.gz
CPAN: Digest::MD5 loaded ok
Checksum for /root/.cpan/sources/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.018.tar.gz ok
Scanning cache /root/.cpan/build for sizes
DBD-mysql-4.018/
DBD-mysql-4.018/ChangeLog
DBD-mysql-4.018/constants.h
DBD-mysql-4.018/dbdimp.c
DBD-mysql-4.018/dbdimp.h
DBD-mysql-4.018/eg/
DBD-mysql-4.018/eg/bug14979.pl
DBD-mysql-4.018/eg/bug21028.pl
DBD-mysql-4.018/eg/bug30033.pl
DBD-mysql-4.018/eg/bug30033pg.pl
DBD-mysql-4.018/eg/decimal_test.pl
DBD-mysql-4.018/eg/issue21946.pl
DBD-mysql-4.018/eg/prepare_memory_usage.pl
DBD-mysql-4.018/eg/proc_example1.pl
DBD-mysql-4.018/eg/proc_example2.pl
DBD-mysql-4.018/eg/proc_example2a.pl
DBD-mysql-4.018/eg/proc_example2b.pl
DBD-mysql-4.018/eg/proc_example3.pl
DBD-mysql-4.018/eg/proc_example4.pl
DBD-mysql-4.018/INSTALL.html
DBD-mysql-4.018/lib/
DBD-mysql-4.018/lib/Bundle/
DBD-mysql-4.018/lib/Bundle/DBD/
DBD-mysql-4.018/lib/Bundle/DBD/mysql.pm
DBD-mysql-4.018/lib/DBD/
DBD-mysql-4.018/lib/DBD/mysql/
DBD-mysql-4.018/lib/DBD/mysql/GetInfo.pm
DBD-mysql-4.018/lib/DBD/mysql/INSTALL.pod
DBD-mysql-4.018/lib/DBD/mysql.pm
DBD-mysql-4.018/Makefile.PL
DBD-mysql-4.018/Makefile.PL.embedded
DBD-mysql-4.018/MANIFEST
DBD-mysql-4.018/MANIFEST.SKIP
DBD-mysql-4.018/META.yml
DBD-mysql-4.018/myld
DBD-mysql-4.018/mysql.xs
DBD-mysql-4.018/README
DBD-mysql-4.018/t/
DBD-mysql-4.018/t/00base.t
DBD-mysql-4.018/t/10connect.t
DBD-mysql-4.018/t/20createdrop.t
DBD-mysql-4.018/t/25lockunlock.t
DBD-mysql-4.018/t/29warnings.t
DBD-mysql-4.018/t/30insertfetch.t
DBD-mysql-4.018/t/31insertid.t
DBD-mysql-4.018/t/32insert_error.t
DBD-mysql-4.018/t/35limit.t
DBD-mysql-4.018/t/35prepare.t
DBD-mysql-4.018/t/40bindparam.t
DBD-mysql-4.018/t/40bindparam2.t
DBD-mysql-4.018/t/40blobs.t
DBD-mysql-4.018/t/40catalog.t
DBD-mysql-4.018/t/40keyinfo.t
DBD-mysql-4.018/t/40listfields.t
DBD-mysql-4.018/t/40nulls.t
DBD-mysql-4.018/t/40nulls_prepare.t
DBD-mysql-4.018/t/40numrows.t
DBD-mysql-4.018/t/40server_prepare.t
DBD-mysql-4.018/t/40server_prepare_error.t
DBD-mysql-4.018/t/40types.t
DBD-mysql-4.018/t/41bindparam.t
DBD-mysql-4.018/t/41blobs_prepare.t
DBD-mysql-4.018/t/42bindparam.t
DBD-mysql-4.018/t/50chopblanks.t
DBD-mysql-4.018/t/50commit.t
DBD-mysql-4.018/t/51bind_type_guessing.t
DBD-mysql-4.018/t/52comment.t
DBD-mysql-4.018/t/53comment.t
DBD-mysql-4.018/t/55utf8.t
DBD-mysql-4.018/t/60leaks.t
DBD-mysql-4.018/t/65types.t
DBD-mysql-4.018/t/70takeimp.t
DBD-mysql-4.018/t/71impdata.t
DBD-mysql-4.018/t/75supported_sql.t
DBD-mysql-4.018/t/76multi_statement.t
DBD-mysql-4.018/t/80procs.t
DBD-mysql-4.018/t/85init_command.t
DBD-mysql-4.018/t/86_bug_36972.t
DBD-mysql-4.018/t/lib.pl
DBD-mysql-4.018/t/mem_leak.pl
DBD-mysql-4.018/t/mysql.dbtest
DBD-mysql-4.018/t/mysql.mtest
DBD-mysql-4.018/TODO
Removing previously used /root/.cpan/build/DBD-mysql-4.018

CPAN.pm: Going to build C/CA/CAPTTOFU/DBD-mysql-4.018.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/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -fasynchronous-unwind-tables -DUNIV_LINUX -DUNIV_LINUX
embedded (mysql_config) =
libs (mysql_config) = -rdynamic -L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -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
Unrecognized argument in LIBS ignored: '-rdynamic'
Using DBI 1.616 (for perl 5.008008 on x86_64-linux-thread-multi) installed in /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI/
Writing Makefile for DBD::mysql
cp lib/DBD/mysql.pm blib/lib/DBD/mysql.pm
cp lib/DBD/mysql/GetInfo.pm blib/lib/DBD/mysql/GetInfo.pm
cp lib/DBD/mysql/INSTALL.pod blib/lib/DBD/mysql/INSTALL.pod
cp lib/Bundle/DBD/mysql.pm blib/lib/Bundle/DBD/mysql.pm
gcc -c -I/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -fasynchronous-unwind-tables -DUNIV_LINUX -DUNIV_LINUX -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DVERSION=\"4.018\" -DXS_VERSION=\"4.018\" -fPIC "-I/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE" dbdimp.c
dbdimp.c: In function âcount_paramsâ:
dbdimp.c:94: warning: suggest parentheses around assignment used as truth value
dbdimp.c:137: warning: suggest parentheses around assignment used as truth value
dbdimp.c: In function âalloc_paramâ:
dbdimp.c:212: warning: comparison is always false due to limited range of data type
dbdimp.c: In function âalloc_bindâ:
dbdimp.c:230: warning: comparison is always false due to limited range of data type
dbdimp.c: In function âalloc_fbindâ:
dbdimp.c:246: warning: comparison is always false due to limited range of data type
dbdimp.c: In function âalloc_fbufferâ:
dbdimp.c:261: warning: comparison is always false due to limited range of data type
dbdimp.c: In function âdbd_discon_allâ:
dbdimp.c:2172: warning: unused variable âimp_xxhâ
dbdimp.c: In function âmysql_st_prepareâ:
dbdimp.c:2593: warning: unused variable âlimit_flagâ
/usr/bin/perl -p -e "s/~DRIVER~/mysql/g" /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI/Driver.xst > mysql.xsi
/usr/bin/perl /usr/lib/perl5/5.8.8/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.8.8/ExtUtils/typemap mysql.xs > mysql.xsc && mv mysql.xsc mysql.c
Warning: duplicate function definition 'do' detected in mysql.xs, line 225
Warning: duplicate function definition 'rows' detected in mysql.xs, line 650
gcc -c -I/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -fasynchronous-unwind-tables -DUNIV_LINUX -DUNIV_LINUX -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DVERSION=\"4.018\" -DXS_VERSION=\"4.018\" -fPIC "-I/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE" mysql.c
mysql.xs: In function âXS_DBD__mysql__db_doâ:
mysql.xs:330: warning: comparison is always false due to limited range of data type
mysql.xs:331: warning: comparison is always false due to limited range of data type
mysql.xs:242: warning: unused variable âstatement_ptrâ
mysql.xs: In function âXS_DBD__mysql__st_more_resultsâ:
mysql.xs:588: warning: implicit declaration of function âmysql_st_next_resultsâ
mysql.xs:587: warning: unused variable âretvalâ
mysql.xs: In function âXS_DBD__mysql__GetInfo_dbd_mysql_get_infoâ:
mysql.xs:724: warning: implicit declaration of function âis_prefixâ
Running Mkbootstrap for DBD::mysql ()
chmod 644 mysql.bs
rm -f blib/arch/auto/DBD/mysql/mysql.so
/usr/bin/perl myld gcc -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic dbdimp.o mysql.o -o blib/arch/auto/DBD/mysql/mysql.so \
-L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -lmygcc \

/usr/bin/ld: skipping incompatible /usr/lib/mysql/libmysqlclient.a when searching for -lmysqlclient
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
make: *** [blib/arch/auto/DBD/mysql/mysql.so] Error 1
/usr/bin/make -- NOT OK
Running make test
Can't test without successful make
Running make install
make had returned bad status, install seems impossible

cpan>
########## error message ended ##########

Options: ReplyQuote


Subject
Written By
Posted
error on install DBD::mysql
May 04, 2011 03:27PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.