Recent

Author Topic: Cannot load MySQL library "libmysqlclient.so"  (Read 41205 times)

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
Cannot load MySQL library "libmysqlclient.so"
« Reply #15 on: April 25, 2007, 11:02:28 am »
ok, my first test failed also, I was missing a symlink libmysqlclient.so -> libmysqlclient.so.14 (I use FC4)
after creating the link and doing (as root)
Code: [Select]
ldconfig -v the testapp succeeded.
For this testapp, the lazarus version is not important, it is pure fpc. I tested with fpc 2.0.0 2.0.2 2.0.4 and 2.1.3

what does
Code: [Select]
/sbin/ldconfig -p |grep mysql show ?
and what does
Code: [Select]
file -L /usr/lib/mysql/libmysqlclient.so
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

rturney

  • New Member
  • *
  • Posts: 48
Cannot load MySQL library "libmysqlclient.so"
« Reply #16 on: April 26, 2007, 02:21:32 am »
Code: [Select]
/sbin/ldconfig -p |grep mysql  
shows:
    libmysqlclient_r.so.15 (libc6) => /usr/lib/libmysqlclient_r.so.15
            libmysqlclient.so.15 (libc6) => /usr/lib/libmysqlclient.so.15


Code: [Select]
file -L /usr/lib/mysql/libmysqlclient.so
shows:
    /usr/lib/mysql/libmysqlclient.so: cannot open `/usr/lib/mysql/libmysqlclient.so' (No such file or directory)

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
Cannot load MySQL library "libmysqlclient.so"
« Reply #17 on: April 26, 2007, 11:46:54 am »
aha....
Create a symlink in the /usr/lib/mysql dir like I did. See previous message
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

rturney

  • New Member
  • *
  • Posts: 48
Cannot load MySQL library "libmysqlclient.so"
« Reply #18 on: April 27, 2007, 06:33:05 am »
I had some minor success!  I switched to /usr/lib/mysql and as root did:
Code: [Select]
ln -s libmysqlclient.so.15 libmysqlclient.so
Then, still as root, did:
Code: [Select]
ldconfig -v
under /usr/lib it showed:
    libmysqlclient.so.15 -> libmysqlclient.so.15.0.0
    libmysqlclient_r.so.15 -> libmysqlclient_r.so.15.0.0

Then I did:
Code: [Select]
/sbin/ldconfig -p |grep mysql
which returned:
    libmysqlclient_r.so.15 (libc6) => /usr/lib/libmysqlclient_r.so.15
          libmysqlclient.so.15 (libc6) => /usr/lib/libmysqlclient.so.15

Next,
Code: [Select]
file -L /usr/lib/mysql/libmysqlclient.so
Which returned:
    /usr/lib/mysql/libmysqlclient.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), stripped


I then ran the original console program you had written using:
 
Code: [Select]
h := loadlibrary('libmysqlclient.so'); but it returned "fail"

Then I ran it with:
Code: [Select]
h := loadlibrary('/usr/lib/mysql/libmysqlclient.so'); and it returned "success" !!!!!!!!!!!!:D

I think the loadlibrary('libmysqlclient.so') failed because without the path, it will look in /usr/lib and libmysqlclient.so is not there ???? Also, since I am in SUSE 10.2, my /etc/ld.so.conf.d does not contain "mysql-i386.conf".  Maybe I need to do a sym link to usr/lib ??? Would this make sense:
(executing from /usr/lib/mysql)
Code: [Select]
ln -s libmysqlclient.so.15 /usr/lib/libmysqlclient.so
??????  If so should I remove the sym link I just put in /usr/lib/mysql ?

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
Cannot load MySQL library "libmysqlclient.so"
« Reply #19 on: April 27, 2007, 11:55:24 am »
This thread started at a FC6 machine. There you have a /usr/lib/mysql in the library search path. If you don't have a "mysql-i386.conf" or a /etc/ld.so.conf.d dir, then your disrto doesnt' use this way of config.
in that case, it in /usr/lib (so in the same dir where the libmysqlclient.so.15.0.0 is)
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

rturney

  • New Member
  • *
  • Posts: 48
Cannot load MySQL library "libmysqlclient.so"
« Reply #20 on: April 27, 2007, 02:08:26 pm »
In /usr/lib I created the sym link:
Code: [Select]
ln -s libmysqlclient.so.15 libmysqlclient.so
Now, the fpc program with the line:
Code: [Select]
h := loadlibrary('libmysqlclient.so');
returns "success"

Also, now the Lazarus MySQL tutorial program does not crash because of the "can't load MySQL library libmysqlclient.so" and is connecting to MySQL!!!!

Thank you very much for your patience and help.

oting

  • Newbie
  • Posts: 1
Cannot load MySQL library "libmysqlclient.so"
« Reply #21 on: November 05, 2008, 10:03:52 am »
please try in synaptic package manager install libmysqlclient15-dev


thx

kriengten

  • Newbie
  • Posts: 1
Re: Cannot load MySQL library "libmysqlclient.so"
« Reply #22 on: February 23, 2011, 04:12:03 pm »
sudo ln -s /usr/lib/libmysqlclient.so.16.0.0 /usr/lib/libmysqlclient.so.15

it work for me in ubuntu 10.10