Delphi+ZeosLib+Firebird on MacOS

113 views Asked by At

I am trying to use ZeosLib on my macOS application, the application works on Windows and I am now trying to adapt it to macOS, but when it starts it gives me the following error:

None of the dynamic libraries can be found or is not loadable: libcrypt.dll.25, libfbembed.dll.25, libfbclient.dll.25, libcrypt.dll.21, libfbembed.dll.21, libfbclient.dll.21, libcrypt.dll.20, libfbembed.dll.20, libfbclient.dll.20, libfbclient.dll.2, libfbembed.dll.15, libcrypt.dll.15, libfbclient.dll.15, libcrypt.dll,libfbembed.dll, libfbclient.dll, libcrypt.dll, libgds32.dll, libgds.dll !

Use TZConnection.LibraryLocation if the location is invalid.

Where can I find these DLL files?

This is the code that's causing the error (yes I need both TFDConnection and TZConnection):

unit MainDB;

interface

uses
  System.SysUtils, System.Classes, FireDAC.Stan.Intf, FireDAC.Stan.Option,
  FireDAC.Stan.Param, FireDAC.Stan.Error, FireDAC.DatS, FireDAC.Phys.Intf,
  FireDAC.DApt.Intf, FireDAC.Stan.Async, FireDAC.DApt, FireDAC.UI.Intf,
  FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.Phys, FireDAC.Phys.FB,
  FireDAC.Phys.FBDef, FireDAC.FMXUI.Wait, Data.DB, FireDAC.Comp.Client,
  FireDAC.Comp.DataSet, FireDAC.Phys.IBBase, ZAbstractRODataset,
  ZAbstractDataset, ZDataset, ZAbstractConnection, ZConnection;

type
  TMDB = class(TDataModule)
    FDConnection2: TFDConnection;
    FDQuery2: TFDQuery;
    DocConnection: TZConnection;
    FDQuery1: TZQuery;
    procedure DataModuleCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  MDB: TMDB;

implementation

{%CLASSGROUP 'FMX.Controls.TControl'}

{$R *.dfm}

procedure TMDB.DataModuleCreate(Sender: TObject);
begin
  //DocConnection.LibraryLocation := '/Library/Frameworks/Firebird.framework/Versions/A/Libraries';
  FDConnection2.Params.Add('Database='+ExtractFilePath(ParamStr(0))+'DATA.FDB');
  FDConnection2.Connected := True;
  DocConnection.Database := ExtractFilePath(ParamStr(0))+'DATA.FDB';
  DocConnection.Connected := True;
end;

end.
1

There are 1 answers

1
SergeGirard On

The error message is not

None of dynamic libraries can be found or is not loadable: libcrypt.dylib.25, libcrypt.dylib, libcrypt.dylib ! Use TZConnection.LibraryLocation if the location is invalid.

Surprising ! try what happens if you disable the INTERBASE_CRYPT define near the bottom of the Zeos.inc

{.$DEFINE INTERBASE_CRYPT}

recompile zeos components and see what happen.

If not solved then :

Depending of ZEOSLib version you use and perhaps Delphi version too
Have a look at ...ZeosLib\src\plain\ZPlainFirebirdInterbaseDriver.pas you will find some constants taking care of firebird version

  WINDOWS25_DLL_LOCATION   = 'fbclient25.dll';
  WINDOWS25_DLL_LOCATION_EMBEDDED = 'fbclientd25.dll';
  LINUX25_DLL_LOCATION   = 'libfbclient'+SharedSuffix+'.25';
  LINUX25_DLL_LOCATION_EMBEDDED = 'libfbembed'+SharedSuffix+'.25';
  LINUX25_IB_CRYPT_LOCATION = 'libcrypt'+SharedSuffix+'.25';

you can modify these LINUXxx_DLL locations (don't recommand this)

OR to understand that "Sharedsuffix" (in ...ZeosLib\src\core\ZCompatibility.pas) or

{$IFDEF WINDOWS}
const SharedSuffix='.dll';
 {$ELSE}
  {$IFDEF DARWIN}
   const SharedSuffix='.dylib';
   {$ELSE}
     {$IFDEF UNIX}
       const SharedSuffix='.so';
    {$ELSE}
      const SharedSuffix='.dll'; //Delphi
    {$ENDIF}
  {$ENDIF}
 {$ENDIF}

my guess this DARWIN def is not a delphi directive (Lazarus ?) should be MACOS ? One other solution is to edit ZCore.inc in ...ZeosLib\src\core directory and add

{$IFDEF MACOS}
   {$DEFINE DARWIN}
   {$DEFINE LINUX} // not sure of that 
{$ENDIF}

recompile zeos components and see what happen (I have no apple hardware to test)