Work with previous updates and these:
function TFB30ClientAPI.LoadInterface: boolean;
var
fb_get_master_interface: Tfb_get_master_interface;
legacy_result: boolean;
begin
Writeln('DEBUG FB30: Entro in TFB30ClientAPI.LoadInterface');
{ 1. Testiamo il blocco legacy }
legacy_result := inherited LoadInterface;
Writeln('DEBUG FB30: inherited LoadInterface ha restituito: ', legacy_result);
{ 2. Estrazione della Master Interface di Firebird 5 }
if (FMaster = nil) and (GetFBLibrary <> nil) then
begin
Writeln('DEBUG FB30: Cerco l''esportazione ''fb_get_master_interface'' nella dylib...');
fb_get_master_interface := GetProcAddress(GetFBLibrary.GetHandle, 'fb_get_master_interface');
if assigned(fb_get_master_interface) then
begin
Writeln('DEBUG FB30: fb_get_master_interface TROVATA con successo!');
FMaster := fb_get_master_interface;
end
else
Writeln('DEBUG FB30: FALLIMENTO! GetProcAddress non ha trovato fb_get_master_interface!');
end;
{ 3. Caricamento delle sotto-interfacce }
if FMaster <> nil then
begin
Writeln('DEBUG FB30: FMaster assegnato, recupero le sotto-interfacce...');
FUtil := FMaster.getUtilInterface;
if FUtil = nil then Writeln('DEBUG FB30: ATTENZIONE - FUtil e'' NIL');
FProvider := FMaster.getDispatcher;
if FProvider = nil then Writeln('DEBUG FB30: ATTENZIONE - FProvider e'' NIL');
FConfigManager := FMaster.getConfigManager;
if FConfigManager = nil then Writeln('DEBUG FB30: ATTENZIONE - FConfigManager e'' NIL');
CheckPlugins;
end
else
Writeln('DEBUG FB30: FMaster e'' NIL, impossibile proseguire.');
Result := HasMasterIntf;
Writeln('DEBUG FB30: Esco da LoadInterface. Result = ', Result);
end;
The issue was caused by macOS blocking the LoadLibrary call due to missing secondary dependencies in the new Firebird 5 path. To fix this, you need to tell macOS where to find those dependencies by setting an environment variable directly in Lazarus.
Here are the steps that made it work:
In Lazarus, go to the menu Run -> Run Parameters...
Switch to the Environment tab.
Click on the Add button and enter the following details:
Name: DYLD_LIBRARY_PATH
Value: /Library/Frameworks/Firebird.framework/Versions/A/Resources/lib/
Click OK and run/debug the project again.
After doing this, IBX successfully loads the Firebird 5 libfbclient.dylib without any SIGABRT errors.
The definitive solution for now without modifying the component sources, even if the improvement works I posted above are interesting, is to follow these commands in the terminal before starting Lazarus: echo 'export DYLD_LIBRARY_PATH="/Library/Frameworks/Firebird.framework/Versions/A/Resources/lib/"' >> ~/.zshrc
Create text file in ~/Desktop/AvviaLazarus.command
#!/bin/bash
export DYLD_LIBRARY_PATH="/Library/Frameworks/Firebird.framework/Versions/A/Resources/lib/"
/Users/scozzaro/lazarus_src/lazarus.app/Contents/MacOS/lazarus --no-splash-screen
Run:
chmod +x ~/Desktop/AvviaLazarus.command
Setting a global DYLD_LIBRARY_PATH on macOS requires updating both the terminal environment and the graphical interface layer. This ensures locally compiled applications like Lazarus or TurboBird can seamlessly locate Firebird 5 dynamic libraries regardless of how they are launched.
For the Terminal (All Users)
macOS uses Zsh as the default shell. To make the variable available globally across all terminal sessions, you must modify the system-wide environment file.
Open your terminal and execute:
sudo nano /etc/zshenv
Add the following export path at the very bottom of the file:
export DYLD_LIBRARY_PATH="/Library/Frameworks/Firebird.framework/Versions/A/Resources/lib/"
Save and exit the editor (Press Ctrl + O, Enter, and then Ctrl + X).
For GUI Applications (Finder/Dock - All Users)
macOS strictly isolates graphical applications from terminal configurations. To inject the environment variable into the GUI layer at login, you need to create a system LaunchAgent.
Create a new configuration file:
sudo nano /Library/LaunchAgents/com.firebird.env.plist
Paste this XML configuration block to instruct macOS to set the variable upon loading:
XML
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.firebird.env</string>
<key>ProgramArguments</key>
<array>
<string>launchctl</string>
<string>setenv</string>
<string>DYLD_LIBRARY_PATH</string>
<string>/Library/Frameworks/Firebird.framework/Versions/A/Resources/lib/</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Save and exit the editor.
Apply the mandatory system permissions to the file to ensure macOS trusts it:
sudo chown root:wheel /Library/LaunchAgents/com.firebird.env.plist
sudo chmod 644 /Library/LaunchAgents/com.firebird.env.plist
Load the service immediately (a system reboot achieves the same result):
launchctl load /Library/LaunchAgents/com.firebird.env.plist
A Note on macOS System Integrity Protection (SIP)
Due to macOS SIP protocols, the operating system intentionally strips or ignores environment variables starting with DYLD_ when launching protected system binaries. This security restriction does not affect locally compiled executables like your Lazarus IDE or custom projects, which will continue to inherit the path perfectly to hook into Firebird 5.