library problem on MAC OSX
library problem on MAC OSX
Hi
I am trying to use zeoslib with Lazarus on a Mac OsX (Maverick) to manage a mysql database. When I try to connect I have the message:
None of the dynamic libraries can be found or is loadable. libmysqlclient.dylib.18,libmysqlclient.dylib.16,libmysqlclient.dylib.15,libmariadb.dylib,libmysqlclient.dylib
Use TZConnection.LibraryLocation if the location is invalid
I have downloaded from MySQL libmysqlclient.18.dylib (there is no libmysqlclient.dylib.18) and I have changed the TZConnection.LibraryLocation but it is still not working
Any ideas
I am trying to use zeoslib with Lazarus on a Mac OsX (Maverick) to manage a mysql database. When I try to connect I have the message:
None of the dynamic libraries can be found or is loadable. libmysqlclient.dylib.18,libmysqlclient.dylib.16,libmysqlclient.dylib.15,libmariadb.dylib,libmysqlclient.dylib
Use TZConnection.LibraryLocation if the location is invalid
I have downloaded from MySQL libmysqlclient.18.dylib (there is no libmysqlclient.dylib.18) and I have changed the TZConnection.LibraryLocation but it is still not working
Any ideas
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
Re: library problem on MAC OSX
Ideas, Yes.
Which IDE you are using for? New Delphi?
Did you use TZConnection.LibraryLocation to let Zeos know which lib you want to use and where the file is located?
if yes and you are sure the path+lib-name are corect:
Check \core\ZPlainLoader.pas
function TZNativeLibraryLoader.ZLoadLibrary(Location: String): Boolean;
how is LoadLibrary on OsX decalred?`I don't know anybody who tested on OsX.
Next possible issue i see:
\ZPlain\ZPlainMySQLConstants.pas
All library call conventions are defined as:
{$IFNDEF UNIX} stdcall {$ELSE} cdecl {$ENDIF}
personally i think
{$IFDEF MSWINDOWS} stdcall {$ELSE} cdecl {$ENDIF}
would be right.
Can you check my suggestions?
Which IDE you are using for? New Delphi?
Did you use TZConnection.LibraryLocation to let Zeos know which lib you want to use and where the file is located?
if yes and you are sure the path+lib-name are corect:
Check \core\ZPlainLoader.pas
function TZNativeLibraryLoader.ZLoadLibrary(Location: String): Boolean;
how is LoadLibrary on OsX decalred?`I don't know anybody who tested on OsX.
Next possible issue i see:
\ZPlain\ZPlainMySQLConstants.pas
All library call conventions are defined as:
{$IFNDEF UNIX} stdcall {$ELSE} cdecl {$ENDIF}
personally i think
{$IFDEF MSWINDOWS} stdcall {$ELSE} cdecl {$ENDIF}
would be right.
Can you check my suggestions?
Best regards, Michael
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
Re: library problem on MAC OSX
LazarusEgonHugeist wrote: Which IDE you are using for? New Delphi?
Yes I did it here is a part of my code.EgonHugeist wrote: Did you use TZConnection.LibraryLocation to let Zeos know which lib you want to use and where the file is located?
if yes and you are sure the path+lib-name are corect:
Code: Select all
if (FileExists(CheminRequete + 'Libmysqlclient.18.dylib') )then
begin
ShowMessage('Path is ok');
//I have tried this one
ConMySQL.LibLocation:=CheminRequete;
//I have tried this one also
ConMySQL.LibLocation:=CheminRequete+ 'Libmysqlclient.18.dylib';
ConMySQL.Connected:=true;
end
else
begin
ShowMessage('Not there '+CheminRequete);
end;
Here is the function. When I check Location it just gives the file name of the library without the path.EgonHugeist wrote: Check \core\ZPlainLoader.pas
function TZNativeLibraryLoader.ZLoadLibrary(Location: String): Boolean;
how is LoadLibrary on OsX decalred?`I don't know anybody who tested on OsX.
Code: Select all
function TZNativeLibraryLoader.ZLoadLibrary(Location: String): Boolean;
var newpath, temp: String; // AB modif
begin
if FLoaded then
Self.FreeNativeLibrary;
temp := ''; //init for FPC
FLoaded := False;
Result := False;
newpath := ExtractFilePath(Location);
ShowMessage(newpath);
// AB modif BEGIN
try
if newpath <> '' then begin
temp := GetCurrentDir;
SetCurrentDir(newpath);
end;
// AB modif END
{$IFDEF UNIX}
{$IFDEF FPC}
FHandle := LoadLibrary(PAnsiChar(Location));
ShowMessage(Location);
{$ELSE}
FHandle := HMODULE(dlopen(PAnsiChar(Location), RTLD_GLOBAL));
{$ENDIF}
{$ELSE}
FHandle := LoadLibrary(PChar(Location));
{$ENDIF}
// AB modif BEGIN
finally
if temp<>'' then
SetCurrentDir(temp);
end;
// AB modif END
if (FHandle <> INVALID_HANDLE_VALUE) and (FHandle <> 0) then
begin
FLoaded := True;
FCurrentLocation := Location;
Result := True;
end;
end;
Code: Select all
{$IFDEF UNIX}
{$IFDEF FPC}
// a very dirty way to force the location
Location:='/Users/MACBOOK/Documents/CloseAction/Bases/Libmysqlclient.18.dylib';
FHandle := LoadLibrary(PAnsiChar(Location));
ShowMessage(Location);
{$ELSE}
FHandle := HMODULE(dlopen(PAnsiChar(Location), RTLD_GLOBAL));
{$ENDIF}
{$ELSE}
FHandle := LoadLibrary(PChar(Location));
{$ENDIF}
My conclusion for the moment is
- The LocationLibrary does not work
- The Library names are not good in ZPlainMySQLDriver.pas
Re: library problem on MAC OSX
Hi
I have already posted a long reply to your suggestions but it seems it was lost .
So I post it again.
To summarize I have found that the path in the TZConnection.LibraryLocation is not working. I have checked in
function TZNativeLibraryLoader.ZLoadLibrary(Location: String): Boolean;
Location just contains the library file name without the path.
For testing I have added the path like this and it works.
But I can't do it this way because I am going to distribute my soft.
I have already posted a long reply to your suggestions but it seems it was lost .
So I post it again.
To summarize I have found that the path in the TZConnection.LibraryLocation is not working. I have checked in
function TZNativeLibraryLoader.ZLoadLibrary(Location: String): Boolean;
Location just contains the library file name without the path.
For testing I have added the path like this and it works.
Code: Select all
$IFDEF UNIX}
{$IFDEF FPC}
Location:='/Users/MACBOOK/Documents/CloseAction/Bases/Libmysqlclient.18.dylib';
FHandle := LoadLibrary(PAnsiChar(Location));
ShowMessage(Location);
{$ELSE}
FHandle := HMODULE(dlopen(PAnsiChar(Location), RTLD_GLOBAL));
{$ENDIF}
{$ELSE}
FHandle := LoadLibrary(PChar(Location));
{$ENDIF}
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
Re: library problem on MAC OSX
The LibraryLocation does work. You allready wrote it.Cratouffe wrote:My conclusion for the moment is
The LocationLibrary does not work
The Library names are not good in ZPlainMySQLDriver.pas
Might be true the Library names are incomplete. Feel free to attach a patch.
Accordingly you issue. I can't see a problem on Zeos side. You simply miss to add you patch to your global OS environment variables OR copy the lib to a path where it simply could be found. Do you really expect Zeos scanns all paths to find one file on your strorage-drive(s)?
You could also generate the path "on the fly" with your enduser app, or locate the library in same path of your executable file... etc...
Best regards, Michael
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
Re: library problem on MAC OSX
May be there is a misunderstanding. For me it does not work because when I print ( ShowMessage(Location);) the Location I just have the library name "Libmysqlclient.18.dylib"EgonHugeist wrote: The LibraryLocation does work. You allready wrote it.
and not the full path "'/Users/MACBOOK/Documents/CloseAction/Bases/Libmysqlclient.18.dylib'". And then it is logical that it cant load it.
Code: Select all
{$IFDEF UNIX}
{$IFDEF FPC}
FHandle := LoadLibrary(PAnsiChar(Location));
ShowMessage(Location);
{$ELSE}
FHandle := HMODULE(dlopen(PAnsiChar(Location), RTLD_GLOBAL));
{$ENDIF}
{$ELSE}
FHandle := LoadLibrary(PChar(Location));
ShowMessage(Location);
{$ENDIF}
Did you test the library on a MAC ?
I did it an now I have the right name.EgonHugeist wrote: Might be true the Library names are incomplete. Feel free to attach a patch.
Of course not and that's why there is a LibraryLocation propertiesEgonHugeist wrote: Do you really expect Zeos scanns all paths to find one file on your strorage-drive(s)?
I have tried to locate it in the same of my executable file but it does not work. But I am not sure of what is the real path of my executable file or if the current directory is my executable file directory.EgonHugeist wrote: You could also generate the path "on the fly" with your enduser app, or locate the library in same path of your executable file... etc...
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
Re: library problem on MAC OSX
Before going on:
Which version of Zeos do you use? Could you switch to 7.2-Alpha from SVN to be on same bandwidth?
Are you sure compile-target (e.g. 32 vs. 64 bit) are equal to the library you are trying to load?
Which version of Zeos do you use? Could you switch to 7.2-Alpha from SVN to be on same bandwidth?
Are you sure compile-target (e.g. 32 vs. 64 bit) are equal to the library you are trying to load?
Best regards, Michael
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
Re: library problem on MAC OSX
I am using 7.1.3 version. I have downloaded th 7.2 beta (I have not found the alpha) and I will switch as soon as possibleEgonHugeist wrote: Which version of Zeos do you use? Could you switch to 7.2-Alpha from SVN to be on same bandwidth?
I am in 32 bit.EgonHugeist wrote: Are you sure compile-target (e.g. 32 vs. 64 bit) are equal to the library you are trying to load?
Re: library problem on MAC OSX
It seems that the 7.2 version has solved the problem.
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
Re: library problem on MAC OSX
Sure?
Best regards, Michael
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
Re: library problem on MAC OSX
For my first simple application it works. But for a more heavy application it seems there is some more problems but I am not sure they are ZeosLib's problems.
I keep going on and many thanks for your help
I keep going on and many thanks for your help