Simpler Navigation for Servers and Operating Systems
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
General
cancel
Showing results for 
Search instead for 
Did you mean: 

DBD::mySQL issue (Can't find library or mismatched ABI for -lmysqlclient)

SOLVED
Go to solution
GPS
Advisor

DBD::mySQL issue (Can't find library or mismatched ABI for -lmysqlclient)

Greetings

I am working on a project which needs PERL working on mySQL. My platform is HP, B1000 node with HP11.11 on it.

My mySQL version is "mysql-standard-5.0.18-hpux11.11-hppa2.0w-64bit"

I got DBI and DataShowtable modules installed without issue so far. But I am stuck at DBD.

The DBD module I am using is DBD-mysql-3.0006, the DBI version is DBI-1.51, the DataShowTable version is Data-ShowTable-3.3.

After running "perl Makefile.PL", a Makefile is generated. When I use this Makefile to compile, the DBD compiling failed. The error log said :" LD_RUN_PATH="/tmp/mysql-statis" /usr/bin/perl myld ld -b -s -a
shared dbdimp.o mysql.o -o
ib/arch/auto/DBD/mysql/mysql.sl -L/tmp/mysql-statis -lmysqlclient
ld: Can't find library or mismatched ABI for -lmysqlclient
Fatal error.
*** Error exit code 1"

Then I tried to tune up the Makefile. and mysql_config. I found the different settings in Makefile do matter.

There are following 2 lines in the Makefile which were generated by "perl Makefile.SL"
========================================
EXTRALIBS = -L/usr/database/mysql/lib -lmysqlclient -lz -lnsl -lm
LDLOADLIBS = -L/usr/database/mysql/lib -lmysqlclient -lz -lnsl -lm
=======================================

With this setting in Makefile, compiling "make" failed with error log saying "ld: Can't find library or mismatched ABI for -lmysqlclient"

If I blank out the contents for these 2 tag. The compiling can go through. But the testing script will fail with the log like
==========================================
"install_driver(mysql) failed: Can't load '/opt/perl5/lib/site_perl/5.6.1/PA-RISC1.1/auto/DBD/mysql/mysql.sl' for module DBD::mysql: Exec format error at /opt/perl5/lib/5.6.1/PA-RISC1.1/DynaLoader.pm line 206.
at (eval 1) line 3
Compilation failed in require at (eval 1) line 3.
Perhaps a required shared library or dll isn't installed where expected
at ./TestConnectMySQL060705_1.pl line 9"
================================================

The similar testing script can work on DBD:Informix.

Any advice would be highly appreciated.

Dave



7 REPLIES
H.Merijn Brand (procura
Honored Contributor
Solution

Re: DBD::mySQL issue (Can't find library or mismatched ABI for -lmysqlclient)

Your perl is with 100% certainty 32bit: "perl5/lib/5.6.1/PA-RISC1.1/"
Your mysql is certainly 64bit: "hpux11.11-hppa2.0w-64bit"

32bit and 64bit DO NOT MIX!

So either get yoursel a 32bit mysql, or a 64bit perl

Most 64bit perl's are installed in /opt/perl64. See if you've already got it, otherwise you can visit my site to get it.

http://mirrors.develooper.com/hpux/#Perl
http://mirrors.develooper.com/hpux/downloads.html
http://mirrors.develooper.com/hpux/perl-5.8.8-dor-11.11.sd.bz

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
GPS
Advisor

Re: DBD::mySQL issue (Can't find library or mismatched ABI for -lmysqlclient)

Thanks H.Merijn for your kind advice.

There are two options for me:
1) Install 32 bit mySQL on node to work with 32 bits PERL.
2) Install 64 bit PERL on node to work with 64 bit mySQL

Since all our previous scripts were written by 32 bits PERL, so I decide to take first option to try first.

I downloaded the 32 bit version mySQL for my HP node. It is "mysql-standard-5.0.22-hpux11.11-hppa2.0w", I unzipped it and untarred it and made necesary steps in HP SAM to register the software in HP.

Then I following the instruction of mySQL installtion by shutting down 64 bit mySQL version and changed the mySQL setting to let working link pointing to 32 bits mySQL. So far I got 32 bits mySQL installed withou issue. I can use "mysqladmin" to check the new installed database.

Then I went back to my DBI/Data_ShowTable/DBD compiling, I met with the same problem before.

DBI/Data_ShowTable modules can be compilered and installed without seeing any obvious error. While issue came up at DBD compiling and installation.

1) If I use the Makefile generated by "perl Makefile.PL",
-----------------------------------------
EXTRALIBS = -L/usr/database/mysql/lib -lmysqlclient -lz -lcrypt -lnsl -lm
LDLOADLIBS = -L/usr/database/mysql/lib -lmysqlclient -lz -lcrypt -lnsl -lm
BSLOADLIBS =
LD_RUN_PATH = /usr/database/mysql/lib:/lib
-------------------------------------------
"make" failed in this setting.

----------------------------------------
# make
cc -c -I/opt/perl5/lib/site_perl/5.6.1/PA-RISC1.1/auto/DBI -I/usr/database/mysql/include -O +DAportable -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -Ae -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O +Onolimit -DVERSION=\"3.0006\" -DXS_VERSION=\"3.0006\" +z -I/opt/perl5/lib/5.6.1/PA-RISC1.1/CORE dbdimp.c
cc: "/usr/include/sys/socket.h", line 504: warning 562: Redeclaration of "sendfile" with a different storage class specifier: "sendfile" will have internal linkage.
cc: "/usr/include/sys/socket.h", line 505: warning 562: Redeclaration of "sendpath" with a different storage class specifier: "sendpath" will have internal linkage.
cc -c -I/opt/perl5/lib/site_perl/5.6.1/PA-RISC1.1/auto/DBI -I/usr/database/mysql/include -O +DAportable -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -Ae -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O +Onolimit -DVERSION=\"3.0006\" -DXS_VERSION=\"3.0006\" +z -I/opt/perl5/lib/5.6.1/PA-RISC1.1/CORE mysql.c
cc: "/usr/include/sys/socket.h", line 504: warning 562: Redeclaration of "sendfile" with a different storage class specifier: "sendfile" will have internal linkage.
cc: "/usr/include/sys/socket.h", line 505: warning 562: Redeclaration of "sendpath" with a different storage class specifier: "sendpath" will have internal linkage.
Running Mkbootstrap for DBD::mysql ()
chmod 644 mysql.bs
rm -f blib/arch/auto/DBD/mysql/mysql.sl
LD_RUN_PATH="/usr/database/mysql/lib:/lib" /usr/bin/perl myld ld -b -s -a shared dbdimp.o mysql.o -o blib/arch/auto/DBD/mysql/mysql.sl -L/usr/database/mysql/lib -lmysqlclient -lz -lcrypt -lnsl -lm
ld: Can't find library: "mysqlclient"
*** Error exit code 1

Stop.
--------------------------------------


2) Then when I turn EXTRALIBS & LDLOADLIBS blank, compiling went through. But real DB failed like this

=======================================
root> ./TestConnectMySQL060705_1.pl
install_driver(mysql) failed: Can't load '/opt/perl5/lib/site_perl/5.6.1/PA-RISC1.1/auto/DBD/mysql/mysql.sl' for module DBD::mysql: Exec format error at /opt/perl5/lib/5.6.1/PA-RISC1.1/DynaLoader.pm line 206.
at (eval 1) line 3
Compilation failed in require at (eval 1) line 3.
Perhaps a required shared library or dll isn't installed where expected
at ./TestConnectMySQL060705_1.pl line 9
=========================================

The above error looks the same as former ( 32bits PERL + 64bits mYSQL) case.


Before I go to next option (64 bits PERL + 64 bits mySQL), is there any advice?

Thanks a lot!
H.Merijn Brand (procura
Honored Contributor

Re: DBD::mySQL issue (Can't find library or mismatched ABI for -lmysqlclient)

Did you actually *install* the DBD::mysql module? Can it be that the old files are still there?

Check the format of the file:

# file /opt/perl5/lib/site_perl/5.6.1/PA-RISC1.1/auto/DBD/mysql/mysql.sl

That should say PA-RISC-1.1, if you successfully used +DAportable. If not, check it in your test dir first, and then install again, and check for messages

# make install UNINST=1

If the file *is* a 32bit shared object, then check with 'chatr' and 'ldd' what it is missing, and where it /expects/ those files

# chatr /opt/perl5/lib/site_perl/5.6.1/PA-RISC1.1/auto/DBD/mysql/mysql.sl
# ldd /opt/perl5/lib/site_perl/5.6.1/PA-RISC1.1/auto/DBD/mysql/mysql.sl

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
GPS
Advisor

Re: DBD::mySQL issue (Can't find library or mismatched ABI for -lmysqlclient)

H.Merijn

You are right. When I check sql.sl. I found mysql.sl is still RISC2.0 (64bit)

============================================
root> file /opt/perl5/lib/site_perl/5.6.1/PA-RISC1.1/auto/DBD/mysql/mysql.sl
/opt/perl5/lib/site_perl/5.6.1/PA-RISC1.1/auto/DBD/mysql/mysql.sl: ELF-64 shared object file - PA-RISC 2.0 (LP64)
============================================

Could the reason of (sql.sl is still 64 bit ) that compiling failed as mentioned that Makefile generated by "perl Makefile.PL"
somwhow conflict with something which I don't know.

Below is part of the Makefile generated by "perl Makefile
===========================================
EXTRALIBS = -L/usr/database/mysql/lib -lmysqlclient -lz -lnsl -lm
LDLOADLIBS = -L/usr/database/mysql/lib -lmysqlclient -lz -lnsl -lm
===========================================

Compiling Error is
root> make
rm -f blib/arch/auto/DBD/mysql/mysql.sl
LD_RUN_PATH="/usr/database/mysql/lib:/lib" /usr/bin/perl myld ld -b -s -a shared dbdimp.o mysql.o -o blib/arch/auto/DBD/mysql/mysql.sl -L/usr/database/mysql/lib -lmysqlclient -lz -lcrypt -lnsl -lm
ld: Can't find library: "mysqlclient"
*** Error exit code 1

Stop.
=========================================

While the libsqlclient.a does exist in the right directory. I am quite puzzled.

-----------------------------------------
root> cd /usr/database/mysql/lib
root> ll lib*.a
-r--r--r-- 1 root mysql 25444 May 26 14:25 libdbug.a
-r--r--r-- 1 root mysql 2012226 May 26 14:42 libmysqlclient.a
-r--r--r-- 1 root mysql 2049262 May 26 14:39 libmysqlclient_r.a
-r--r--r-- 1 root mysql 1473324 May 26 14:24 libmystrings.a
-r--r--r-- 1 root mysql 729872 May 26 14:25 libmysys.a
-r--r--r-- 1 root mysql 131496 May 26 14:23 libz.a
----------------------------------------------

Any advice on how these LIB compiling options should be used or not?
H.Merijn Brand (procura
Honored Contributor

Re: DBD::mySQL issue (Can't find library or mismatched ABI for -lmysqlclient)

/me would advice to install perl64 ...

If you are running a 32bit perl, you just cannot make 64bit objects load.
So I can tell you what options to add to build 64bit code (+DD64 as a matter of fact), but it will only suck you deeper in the swamp of bits.

Either make *sure* you have installed a 32bit mysql, and *CHECK* that before you run perl Makefile.PL, or install a 64bit perl.

Enjoy, Have FUN! H.Merijn [ who thinks you do not have any fun right now ]
Enjoy, Have FUN! H.Merijn
Stew McLeod
Occasional Advisor

Re: DBD::mySQL issue (Can't find library or mismatched ABI for -lmysqlclient)

Just a note that may lead someone somewhere useful. I get the warning:

cc: "/usr/include/sys/socket.h", line 504: warning 562: Redeclaration of "sendfile" with a different storage class specifier: "sendfile" will have internal linkage.


from a program I'm writing when I use the

-D_FILE_OFFSET_BITS=64

flag to make the 'off_t' size be 64 bit versus 32 bit. Without this flag the compiler does NOT spit out the warning.
Dennis Handly
Acclaimed Contributor

Re: DBD::mySQL issue (Can't find library or mismatched ABI for -lmysqlclient)

>Just a note that may lead someone somewhere useful. I get the warning:
cc: "/usr/include/sys/socket.h" warning 562: Redeclaration of "sendfile" with a different storage class specifier:...

No, this isn't useful. The warning is an indication of an implementation trick that isn't warning free.