You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MacOS下Delphi+ZeosLib+Firebird动态库缺失问题求助

适配MacOS时ZeosLib启动报错:找不到动态库

我正尝试在MacOS应用中使用ZeosLib,该应用在Windows上可正常运行,现在适配MacOS时启动报错,错误信息如下:

找不到任何可加载的动态库:
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 !

若路径无效,请使用TZConnection.LibraryLocation设置。

请问我可以在哪里找到这些DLL文件?

以下是引发错误的代码(我确实需要同时使用TFDConnection和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. 明确平台差异
    MacOS没有DLL文件,DLL是Windows专属的动态库格式,MacOS对应的是.dylib或框架文件。你看到的这些libfbclient.dll等都是Windows下的Firebird客户端库,MacOS需要用Firebird的Mac版本库。

  2. 获取Mac版Firebird库

    • 直接安装Firebird for Mac,安装后库文件默认路径为/Library/Frameworks/Firebird.framework/Versions/A/Libraries,里面包含libfbclient.dylib等对应文件。
    • 也可以单独下载Firebird的Mac客户端包,提取其中的动态库文件。
  3. 配置ZeosLib的库路径
    取消代码中LibraryLocation的注释,修改为指向Mac版的具体库文件(部分ZeosLib版本需要指定到文件而非目录):

    DocConnection.LibraryLocation := '/Library/Frameworks/Firebird.framework/Versions/A/Libraries/libfbclient.dylib';
    
  4. 版本与架构兼容

    • 确保Firebird版本和ZeosLib搜索的版本匹配,比如ZeosLib找25版本的库,就安装Firebird 2.5;对应版本才能正常加载。
    • 检查应用架构(Intel/Apple Silicon)和Firebird库的架构一致,避免因架构不兼容导致加载失败。
  5. 分发应用的处理
    如果要打包分发应用,需将Firebird的.dylib文件放入应用包内,然后调整LibraryLocation指向包内路径,示例:

    DocConnection.LibraryLocation := ExtractFilePath(ParamStr(0)) + 'Contents/Frameworks/libfbclient.dylib';
    

内容的提问来源于stack exchange,提问作者Adel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.04 05:35:01