Recent

Author Topic: Can Not load MYSql Library  (Read 22726 times)

Davide Gurgone

  • New member
  • *
  • Posts: 8
Can Not load MYSql Library
« on: October 30, 2009, 10:03:29 pm »
Hi all,
I'm Davide and I'm new with lazarus and, as every other newbies, I've got some strange issues to solve!

I imported a windows running application on my mac (snow leopard) to build the mac os version, but it cannot run for some trouble with mysql client library, here is the message:
Quote
"Project p raised an exception class 'EInOutError' with message:
Can not load MySQL library ("libmysqlclient.dylib.15" or "libmysqlclient.dylib"). Check your installation.

Using google I find something and I used every advice read:
1. Create a simbolic link from /usr/local/mysql/lib/libmysqlclient.dylib to /usr/lib
2. Adding /usr/local/mysql/lib to $PATH variable
3. Add /usr/local/mysql/lib location to fpc.cfg
4. Add full library path to mysql.inc
5. Add to ~/.MacOSX/environment.plist key/value pairs as follow:
LD_LIBRARY_PATH = /usr/local/mysql/lib

Nothing's happend! Every time the same error... I can't tell my program to use the correct library! What I have to do???

In mysql lib folder I've libmysqlclient.16.dylib and libmysqlclient.dylib as a symbolic link to the first one, but error looks like lib missing at runtime... :'(

Please help me I read everything's possible!

Ciao, Davide.
« Last Edit: November 02, 2009, 12:58:22 am by davide.gurgone »

cdbc

  • Hero Member
  • *****
  • Posts: 2615
    • http://www.cdbc.dk
Re: Can Not load MYSql Library
« Reply #1 on: October 31, 2009, 11:01:51 am »
Hi Davide.

Looks like a version inconsistency, you've got libmysqlclient.dylib.16 and laz expects libmysqlclient.dylib.15.

Try to figure out what's the difference between the two, probably at MySql website.
Maybe they are interchangeable, then you can do a simple rename/copy to libmysqlclient.dylib.15 and create new symlink.

HTH

Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

Davide Gurgone

  • New member
  • *
  • Posts: 8
Re: Can Not load MYSql Library
« Reply #2 on: October 31, 2009, 01:46:45 pm »
Hi,
I tried to use symlink, but it does not work.. I think is mandatory to use that version of MySql on snow leopard (64bit mac os x version of leopard) I really have no more ideas...

I think that library is used from also mysql admin tools too, don't you think?
How do they use the same library?

Thank's a lot
D.

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1071
Re: Can Not load MYSql Library
« Reply #3 on: October 31, 2009, 02:33:07 pm »
I tried to use symlink, but it does not work.. I think is mandatory to use that version of MySql on snow leopard (64bit mac os x version of leopard) I really have no more ideas...

You're not saying which MySQL version you installed or where you got it from (MySQL is not included with Mac OS X by default), which FPC MySQL unit you are using, nor how you are trying to initialise it.

My guess is that you installed a 64 bit version of MySQL, whose libraries obviously won't work with a 32 bit FPC program. You can run the "file" command on the library to see which architectures it includes.

Davide Gurgone

  • New member
  • *
  • Posts: 8
Re: Can Not load MYSql Library
« Reply #4 on: October 31, 2009, 05:56:45 pm »
Ok, before everything, thank's 4 help...

MySQL Libraries versions are 5.1.37 for server and 5.1.8 for client, both compiled at 64 bit.

I downloaded 32 bit version of the same libraries, but the build version is the same, 5.1.37 and with it, the library name too...

Now I have two solutions:
1st try to tell my application to use downloaded 32bit library, hoping it works! Do you think it's possible?
2nd, compile my application at 64 bit...

What do you suggest?
Davide.

bluewolf

  • New Member
  • *
  • Posts: 24
Re: Can Not load MYSql Library
« Reply #5 on: October 31, 2009, 07:04:31 pm »
Hi Davide,

I'm not familiar with Mac OSX but browsing on the internet I have the impression that:

libmysqlclient.15.dylib -> Mysql 5.0
libmysqlclient.16.dylib -> Mysql 5.1

I have some question for you:

Which version of MySql were you running in your Windows application?
Which component did you use to access MySql database?

I'm asking you this because I came across a problem while trying to use MySql 5.1 in Lazarus using the provided component from SQLDb (TMySQL50Connection).
As you can check here MySql 5.1 is not supported by TMySQL50Connection.

I have the impression that in your case the application is trying to access a MySql 5.0 database while you are running MySql 5.1.

That's a possible reason why your application is looking for libmysqlclient.15.dylib instead of libmysqlclient.16.dylib.

If you intend to access MySql 5.1 you might try Zeoslib. However I have no idea if they are working fine under Mac OSX.

Regards.
Alberto.
Alberto

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1071
Re: Can Not load MYSql Library
« Reply #6 on: October 31, 2009, 10:56:51 pm »
Ok, before everything, thank's 4 help...

MySQL Libraries versions are 5.1.37 for server and 5.1.8 for client, both compiled at 64 bit.

I downloaded 32 bit version of the same libraries, but the build version is the same, 5.1.37 and with it, the library name too...

Now I have two solutions:
1st try to tell my application to use downloaded 32bit library, hoping it works! Do you think it's possible?
I think it won't work, since FPC does not have a MySQL 5.1 interface library. The newest it has is for MySQL 5.0 (if you use the mysql50 unit). This is independent of 32 vs 64 bit.

You still have not answered the question about which MySQL unit you are using or how you are initialising it. If you want help, you should provide all possible information. Half answers are unhelpful to people trying to help you.

Quote
2nd, compile my application at 64 bit...

That's not possible, because
a) There is no version of FPC 2.2.4 for Mac OS X 64 bit (FPC 2.4.0 will support 64 bit on Mac OS X though)
b) The Mac OS X version of the LCL is currently based on Carbon and large parts of the Carbon framework are not available to 64 bit applications (so even FPC 2.4.0 won't help)

Davide Gurgone

  • New member
  • *
  • Posts: 8
Re: Can Not load MYSql Library
« Reply #7 on: November 01, 2009, 10:48:00 am »
Quote
Quote
1st try to tell my application to use downloaded 32bit library, hoping it works! Do you think it's possible?
I think it won't work, since FPC does not have a MySQL 5.1 interface library. The newest it has is for MySQL 5.0 (if you use the mysql50 unit). This is independent of 32 vs 64 bit.
I think so...

Yesterday I did the following:
  • downloaded the latest mysql 5.0 Version for 32 bit OS and putted into /usr/local/ folder
  • startup mysql 5.1
  • export DYLD_LIBRARY_PATH=/usr/local/mysql-5.0.87-osx10.5-x86/lib/
  • launched application, by command line
  • registered exception: dbSC: Server connection failed

Now I think I have 2 choose between waiting for support to 5.1 and downgrade DB to 5.0, but i doubt it will work untill I'll be able to startup mysql in 32 bit mode...

Quote
You still have not answered the question about which MySQL unit you are using or how you are initialising it.
I'm sorry, I'm using TMySQL50Connection.

Davide.



bluewolf

  • New Member
  • *
  • Posts: 24
Re: Can Not load MYSql Library
« Reply #8 on: November 01, 2009, 03:58:44 pm »
Hi Davide,


Yesterday I did the following:
  • downloaded the latest mysql 5.0 Version for 32 bit OS and putted into /usr/local/ folder
  • startup mysql 5.1
  • export DYLD_LIBRARY_PATH=/usr/local/mysql-5.0.87-osx10.5-x86/lib/
  • launched application, by command line
  • registered exception: dbSC: Server connection failed
This look like a dirty solution. Using library of Mysql 5.0 to access MySql 5.1. Definitely not a good approach.

Now I think I have 2 choose between waiting for support to 5.1 and downgrade DB to 5.0, but i doubt it will work untill I'll be able to startup mysql in 32 bit mode...
Well, possible solutions are:
  • Downgrade DB to MySql 5.0
  • Use a different component to access MySql 5.1

I don't know how complex is your application but, as I said before, I have successfully used MySql 5.1 under Windows using Zeoslib instead of SQLdb components. However I have no experience of Zeoslib under Mac OSX.

Quote
You still have not answered the question about which MySQL unit you are using or how you are initialising it.
I'm sorry, I'm using TMySQL50Connection.
TMySQL50Connection is not compatible with MySql 5.1 even under Windows.

Alberto

Davide Gurgone

  • New member
  • *
  • Posts: 8
Re: Can Not load MYSql Library
« Reply #9 on: November 02, 2009, 12:16:08 am »
Hi Alberto,
thank's a lot for your reply, I'm trying to downgrade to MySQL 5, because application is too big to migrate rapidly to another library.

I think I'll consider that next time.
Now I'm trying to uninstall mysql 5.1 and re-install 5.0 compiled in 32bit.

As I read seams to be sample, but is not... Certainly is not a lazarus trouble!

I'll report you as soon as possible results.

Thank's you all 4 support,
Davide.

Davide Gurgone

  • New member
  • *
  • Posts: 8
Re: Can Not load MYSql Library
« Reply #10 on: November 02, 2009, 12:57:54 am »
Habemus running application!!!

Completely uninstalling MySQL 5.1 (not so simple) and installing 5.0 at 32 bit, everything's running fine!

Thank's a lot to everyone's help me!

I'm really Happy!!!  :D

Ciao, Davide.

agreen

  • Newbie
  • Posts: 1
Re: Can Not load MYSql Library
« Reply #11 on: October 10, 2012, 10:01:14 pm »

Hello,

i have the same problem ... what you still did???

i installed mysql 5.0 and i get still the error massage cannot load default mysql library libmysqlclient.dylib


thanks for helping

 

TinyPortal © 2005-2018