[patch_done] ubuntu / libmysqlclient.so.15 or .16

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
tintinux
Junior Boarder
Junior Boarder
Posts: 44
Joined: 19.05.2010, 10:39

[patch_done] ubuntu / libmysqlclient.so.15 or .16

Post by tintinux »

Hi

Programs compiled with ZEOS 6.6.6 are looking for libmysqlclient.so.15 (or libmysqlclient.so).

With Karmic Koala, they are provided by the package libmysql-client15off.
With Lucid Lynx this library libmysql-client15off do not look available by default...

On these 2 systems there is also a more recent package libmysql16 which provides libmysqlclient.so.16.

Is it possible to direct ZEOS to use the new library ?

I don't know how ZEOS lib knows it has to search the release 15... Is there a recommended way to direct ZEOS to search for the new library, without modifying the ZEOS sources, and without using a Linux trick on Linux like creating a link libmysql.so to libmysql16.so ?

Thanks
Martin
marcov
Senior Boarder
Senior Boarder
Posts: 95
Joined: 24.06.2010, 09:17

Post by marcov »

I think so. Zeos uses the same mechanism to workaround mysql versioning.

You need to define a small driver class for a new version (16 is Mysql 5.1, 15 is mysql 5.0).

See the source of ZPlainMySqlDriver how to it. These drivers must be somehow get connected to the connection, probably via similar classes as in zdbc/zdbcmysql.pas
tintinux
Junior Boarder
Junior Boarder
Posts: 44
Joined: 19.05.2010, 10:39

Post by tintinux »

Hi

Thanks for your reply, I have found how Zeos load the libraries.

But I do not understand what I can do and where...
Should I add something new in my project ? What exactly ?

Obviously, I don't want to change anything in Zeos, because others will not have the updates.

Can you explain a little more ?

Thanks,
Martin
silvioprog
Junior Boarder
Junior Boarder
Posts: 42
Joined: 10.01.2009, 00:34
Location: Brasil
Contact:

Post by silvioprog »

If you enable the directive {.$DEFINE MYSQL_STRICT_DLL_LOADING} (in Zeos.inc) your code not works?
tintinux
Junior Boarder
Junior Boarder
Posts: 44
Joined: 19.05.2010, 10:39

Post by tintinux »

Hi

I read that {$DEFINE MYSQL_STRICT_DLL_LOADING} "prevents loading default libmysql.dll"

This directive should not solve anything, since this dll (or .so in Linux) do not exist. it might even be the opposite of what we need, or there is something that I do not understand !

I'm reluctant to define (in the installation package) libmysql.so as a logical link to the right file, depending on the release, but if this is the only way, I will do it.

Or someone can explain to me a better way to make a MySql application working with the 3 last versions of Ubuntu, with Lenny or other Linux distributions ?

Thanks
Martin
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

I read that {$DEFINE MYSQL_STRICT_DLL_LOADING} "prevents loading default libmysql.dll"
You read that very well :D

I must admit I have no idea on how searching voor libraries is done on linux. But if libraries change their name on every linux distribution there's no way around creating links to the right directory.
But, if finding the lib isn't the problem and it's only the NAME of the lib (15 or 16), please edit ZplainMysql5.pas and ADD the new 'possible library name', the way it is done to allow mysql 5.0 and 5.1 for windows.
And after testing, please send me the patch, so I can add it to 6.6-table branch for a next release.

Mark

UPDATE: Just checked the zeoslib 7 implementation. There the libmysqlclient.so.16 has been added already. But please provide a tested patch for 6.6, as the library loading code has changed a lot between zeos 6.6 and 7.
Image
tintinux
Junior Boarder
Junior Boarder
Posts: 44
Joined: 19.05.2010, 10:39

Post by tintinux »

Hi mdaems and others

Thanks for your input.

I would be happy to help a little Zeos, and I can make and send you the patch. :D

However, after some thoughts, I wonder whether it is the right solution. When a new libmysql17.so will be included in Ubuntu (for example), in a few months, we will have the issue again. We would have to patch Zeos again and every developer would have to reinstall it, probably too late, after being reported the "bug" due to this change. I don't like this : leading to bugs after the development of the applications and/or the Zeos release used in them will be stopped.

I think that it is not a good idea from the MySql developers to change the library name, but we have to deal with that... :twisted:

I will then have to create libmysql.so as a logical link to the appropriate libmysqlXX.so, depending on the distribution and define MYSQL_STRICT_DLL_LOADING.

A meta-package installing the last mysql library and creating the logical link would avoid this. I'll suggest this to Ubuntu packagers...

Tell me if the patch is really useful...

Regards,

Martin
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Martin,

It's not that bad. Mysql only changes the number with their release numbers.
15 was 5.0, 16 is 5.1, so probably 17 will be mysql 5.5.
I didn't check the 5.5 compatibility yet, but it's safest when we explicitly check if the right lib is used for the protocol you're choosing. That's the main purpose of the MYSQL_STRICT_DLL_LOADING directive.
As an example: the naming changes aren't done on 'mysql for windows' and there you always have the risk of loading a wrong dll version as they are all named equal. So on windows you have to explicitly rename the libmysql.dll from the mysql5 distribution to libmysql50.dll to allow strict loading.

Mark
Image
tintinux
Junior Boarder
Junior Boarder
Posts: 44
Joined: 19.05.2010, 10:39

Post by tintinux »

Hi

Ok, if you like. But Linux is better than Windows on this topic, because libmysql.so doesn't exist by default. Something must be done during software installation to link it to an existing driver, and there is less hazard.

I send you attached the patch :
  • * Searching for libmysql16.so before other mysql5 drivers
    * Not searching for libmysql.so if MYSQL_STRICT_DLL_LOADING directive is set.
I found that the directive had no effect on Linux, it was used only for Windows. I didn't changed sources for Mysql 3 & 4, but if they are still in Zeos 7, may be they should be checked for this feature.

It was tested only with Lazarus on Linux Ubuntu and Windows with all possible combinations of drivers. I have no more Delphi.

I would be happy if this could improve this great package. Let me know when the patch will be available.

Regards,
Martin
You do not have the required permissions to view the files attached to this post.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Patch applied to 6.6-patches branch. (Rev. 853) Will be available in next release/snapshot in the stable series.

This is actually a port for rev 786 - See http://zeos.firmos.at/viewtopic.php?t=2693

Mark
Image
Post Reply