But on Linux, it didn't. My program and the fdb file is located in Desktop/fbtest. I copied them to both Desktop/fbtest and Desktop/fbtest/bin, also duplicated libfbclient.so to name it as libfbclient.so.02, libfbclient.so.3.0.5 in those folders and also to the /bin folder. I also did the same thing on libEngine12.so. No luck so far.
You might have had more luck asking this on the Firebird forum.
But I took a stab at it...
The reason why it didn't work for you could be seen by examining libfbclient.so.3.0.10.so with lddtree (from pax-utils).
(try it and see what you are missing if it still doesn't work)
$ sudo apt install pax-utils
$ lddtree lib/libfbclient.so.3.0.10
libgds.so => ./libgds.so (interpreter => none)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2
libncurses.so.5 => not found
libtommath.so.0 => not found
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6
ld-linux-x86-64.so.2 => /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
So you will need libncurses5 and libtommath1 libraries too.
sudo apt-get install libncurses5 libtommath1
It could be that libtommath1 is already installed. In that case you need to create an extra symlink:
sudo ln -s libtommath.so.1 /usr/lib/x86_64-linux-gnu/libtommath.so.0
After that it should work.
Also don't forget to set the LD_LIBRARY_PATH accordingly.
export LD_LIBRARY_PATH=~/Firebird-3.0.10.33601-0.amd64/opt/firebird/lib
export FIREBIRD=~/Firebird-3.0.10.33601-0.amd64/opt/firebird
(with Firebird-3.0.10.33601-0.amd64 being the unpacked directory , including the buildroot.tar.gz)
Let me know if it doesn't work and I can see if I missed something.
~~
I tested this with a clean Ubuntu 22.04 version.
Here is the complete script I followed:
# ---------
# download and unpack firebird embedded
# ---------
wget https://github.com/FirebirdSQL/firebird/releases/download/v3.0.10/Firebird-3.0.10.33601-0.amd64.tar.gz
tar -xf Firebird-3.0.10.33601-0.amd64.tar.gz
cd Firebird-3.0.10.33601-0.amd64
tar -xf buildroot.tar.gz
cd opt/firebird
# ---------
# check dependencies
# ---------
sudo apt install pax-utils
lddtree lib/libfbclient.so.3.0.10
# ---------
# install dependencies for firebird embedded ("not found")
# ---------
sudo apt-get install libncurses5 libtommath1
sudo ln -s libtommath.so.1 /usr/lib/x86_64-linux-gnu/libtommath.so.0
# ---------
# install fpc, set environment and test. fpc only needed for compilation
# ---------
sudo apt-get install fpc
export LD_LIBRARY_PATH=~/Firebird-3.0.10.33601-0.amd64/opt/firebird/lib
export FIREBIRD=/home/rik/Firebird-3.0.10.33601-0.amd64/opt/firebird
nano test.pp
fpc -MObjFPC test.pp
./test
Result:
a
b
c
done
test.pp looks like this:
program testfirebird;
uses SQLDB, DB, IBConnection;
var
FB: TIBConnection;
SQL: TSQLQuery;
begin
FB := TIBConnection.Create(nil);
SQL := TSQLQuery.Create(FB);
try
FB.Transaction := TSQLTransaction.Create(FB);
FB.Transaction.Database := FB;
FB.LoginPrompt := False;
// FB.HostName := 'localhost';
FB.DatabaseName := 'DEMO.FDB';
FB.UserName := 'SYSDBA';
FB.Password := 'masterkey';
try
FB.Connected := True;
except
on E: EDatabaseError do
begin
FB.CreateDB;
FB.Connected := True;
writeln('creating DEMO.FBD');
FB.ExecuteDirect('CREATE TABLE TEST(ID BIGINT, CODE VARCHAR(80));');
if FB.Transaction.Active then FB.Transaction.Commit;
FB.ExecuteDirect('INSERT INTO TEST VALUES(1, ''a'');');
FB.ExecuteDirect('INSERT INTO TEST VALUES(2, ''b'');');
FB.ExecuteDirect('INSERT INTO TEST VALUES(3, ''c'');');
if FB.Transaction.Active then FB.Transaction.Commit;
end;
end;
SQL := TSQLQuery.Create(FB);
SQL.Database := FB;
SQL.Transaction := FB.Transaction;
SQL.SQL.Text := 'SELECT * FROM TEST';
SQL.Open;
while not SQL.EOF do
begin
writeln(SQL.FieldByName('CODE').asString);
SQL.Next;
end;
SQL.Close;
finally
FB.Free;
end;
writeln('done');
readln;
end.
BTW There is no need for a symlink or something because the tar already contains a symlink for libfbclient.so to the correct version.
So this should work 'out of the box'.
Also... if you need to keep the current LD_LIBRARY_PATH then you should do:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/firebird_embedded/opt/firebird/lib
You can also add it to your ~/.bashrc:
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/firebird_embedded/opt/firebird/lib' >> ~/.bashrc
Just do not use Firebird.
I didn't believe it but it seems I now have to agree with Thaddy.
Someone, please prove me wrong!
Hope your faith is restored after this