Recent

Author Topic: [SOLVED] Firebird embedded  (Read 7710 times)

rvk

  • Hero Member
  • *****
  • Posts: 6893
Re: Firebird embedded
« Reply #30 on: April 26, 2023, 03:28:37 pm »
   
  • See the screenshot1 below for the run result.
I assume your program and the Firebird libraries are all 64 bit?

Can you try it with the 3.0.10 version:

Code: Bash  [Select][+][-]
  1. cd ~
  2. wget https://github.com/FirebirdSQL/firebird/releases/download/v3.0.10/Firebird-3.0.10.33601-0.amd64.tar.gz
  3. tar -xf Firebird-3.0.10.33601-0.amd64.tar.gz
  4. cd Firebird-3.0.10.33601-0.amd64
  5. tar -xf buildroot.tar.gz
  6. cd ~/Desktop/fbtest
  7. cp ~/Firebird-3.0.10.33601-0.amd64/opt/firebird/lib/libfbclient.so .
  8. cp ~/Firebird-3.0.10.33601-0.amd64/opt/firebird/lib/libib_util.so .
  9. cp ~/Firebird-3.0.10.33601-0.amd64/opt/firebird/plugins/libEngine12.so plugins
  10. export LD_LIBRARY_PATH=~/Desktop/fbtest
  11. export FIREBIRD=~/Desktop/fbtest
  12. ./testfirebird

(In that case the permissions are also kept the same as in the tar.gz.)

(I also tried a subdirectory on the Desktop)
Code: Bash  [Select][+][-]
  1. rik@rik-Virtual-Machine:~$ cd ~/Desktop
  2. rik@rik-Virtual-Machine:~/Desktop$ mkdir fbtest
  3. rik@rik-Virtual-Machine:~/Desktop$ cd ~/Desktop/fbtest
  4. rik@rik-Virtual-Machine:~/Desktop/fbtest$ mkdir plugins
  5. rik@rik-Virtual-Machine:~/Desktop/fbtest$ scp rik@192.168.2.96:/home/rik/d/test .
  6. rik@192.168.2.96`s password:
  7. test                                                                                                                                                 100% 1478KB 129.7MB/s   00:00
  8. rik@rik-Virtual-Machine:~/Desktop/fbtest$ cp ~/Firebird-3.0.10.33601-0.amd64/opt/firebird/lib/libfbclient.so .
  9. rik@rik-Virtual-Machine:~/Desktop/fbtest$ cp ~/Firebird-3.0.10.33601-0.amd64/opt/firebird/lib/libib_util.so .
  10. rik@rik-Virtual-Machine:~/Desktop/fbtest$ cp ~/Firebird-3.0.10.33601-0.amd64/opt/firebird/plugins/libEngine12.so plugins
  11. rik@rik-Virtual-Machine:~/Desktop/fbtest$ ls -lR
  12. .:
  13. total 3360
  14. -rwxr-xr-x 1 rik rik 1911800 apr 26 15:26 libfbclient.so
  15. -rwxr-xr-x 1 rik rik    4368 apr 26 15:26 libib_util.so
  16. drwxrwxr-x 2 rik rik    4096 apr 26 15:26 plugins
  17. -rwx------ 1 rik rik 1513064 apr 26 15:26 test
  18.  
  19. ./plugins:
  20. total 7336
  21. -rwxr-xr-x 1 rik rik 7511904 apr 26 15:26 libEngine12.so
  22. rik@rik-Virtual-Machine:~/Desktop/fbtest$ export LD_LIBRARY_PATH=~/Desktop/fbtest
  23. rik@rik-Virtual-Machine:~/Desktop/fbtest$ export FIREBIRD=~/Desktop/fbtest
  24. rik@rik-Virtual-Machine:~/Desktop/fbtest$ ./test
  25. creating DEMO.FBD
  26. a
  27. b
  28. c
  29. done
  30.  
  31. rik@rik-Virtual-Machine:~/Desktop/fbtest$ echo $FIREBIRD
  32. /home/rik/Desktop/fbtest
  33. rik@rik-Virtual-Machine:~/Desktop/fbtest$ echo $LD_LIBRARY_PATH
  34. /home/rik/Desktop/fbtest
  35. rik@rik-Virtual-Machine:~/Desktop/fbtest$

rvk

  • Hero Member
  • *****
  • Posts: 6893
Re: Firebird embedded
« Reply #31 on: April 26, 2023, 03:54:44 pm »
BTW. Your libib_util.so seems very large. Mine is only 4368 bytes.

I downloaded 3.0.5.33220 and that one also works (and has a smaller libib_util.so than yours).

Code: Bash  [Select][+][-]
  1. rik@rik-Virtual-Machine:~/Desktop/fbtest$ cd ~
  2. rik@rik-Virtual-Machine:~$ wget https://github.com/FirebirdSQL/firebird/releases/download/R3_0_5/Firebird-3.0.5.33220-0.amd64.tar.gz
  3. <snip>
  4. 2023-04-26 15:50:07 (34,7 MB/s) - ‘Firebird-3.0.5.33220-0.amd64.tar.gz’ saved [8561290/8561290]
  5.  
  6. rik@rik-Virtual-Machine:~$ tar -xf Firebird-3.0.5.33220-0.amd64.tar.gz
  7. rik@rik-Virtual-Machine:~$ cd Firebird-3.0.5.33220-0.amd64/
  8. rik@rik-Virtual-Machine:~/Firebird-3.0.5.33220-0.amd64$ tar -xf buildroot.tar.gz
  9. rik@rik-Virtual-Machine:~/Firebird-3.0.5.33220-0.amd64$ cd ~/Desktop/fbtest/
  10. rik@rik-Virtual-Machine:~/Desktop/fbtest$ cp ~/Firebird-3.0.5.33220-0.amd64/opt/firebird/lib/libfbclient.so .
  11. rik@rik-Virtual-Machine:~/Desktop/fbtest$ cp ~/Firebird-3.0.5.33220-0.amd64/opt/firebird/lib/libib_util.so .
  12. rik@rik-Virtual-Machine:~/Desktop/fbtest$ cp ~/Firebird-3.0.5.33220-0.amd64/opt/firebird/plugins/libEngine12.so plugins
  13. rik@rik-Virtual-Machine:~/Desktop/fbtest$ export LD_LIBRARY_PATH=~/Desktop/fbtest
  14. rik@rik-Virtual-Machine:~/Desktop/fbtest$ export FIREBIRD=~/Desktop/fbtest
  15. rik@rik-Virtual-Machine:~/Desktop/fbtest$ ./test
  16. a
  17. b
  18. c
  19. done
  20.  
  21. rik@rik-Virtual-Machine:~/Desktop/fbtest$ ls -lR
  22. .:
  23. total 4824
  24. -rw-rw---- 1 rik rik 1515520 apr 26 15:51 DEMO.FDB
  25. -rwxr-xr-x 1 rik rik 1895096 apr 26 15:51 libfbclient.so
  26. -rwxr-xr-x 1 rik rik    4368 apr 26 15:51 libib_util.so
  27. drwxrwxr-x 2 rik rik    4096 apr 26 15:26 plugins
  28. -rwx------ 1 rik rik 1513064 apr 26 15:26 test
  29.  
  30. ./plugins:
  31. total 7236
  32. -rwxr-xr-x 1 rik rik 7408160 apr 26 15:51 libEngine12.so
  33. rik@rik-Virtual-Machine:~/Desktop/fbtest$


And unsetting FIREBIRD gives the same error for me.

Code: Bash  [Select][+][-]
  1. rik@rik-Virtual-Machine:~/Desktop/fbtest$ unset FIREBIRD
  2. rik@rik-Virtual-Machine:~/Desktop/fbtest$ ./test
  3. An unhandled exception occurred at $000000000044BA77:
  4. EIBDatabaseError: TIBConnection : CreateDB :
  5.  -Unable to complete network request to host "localhost".
  6.  -Failed to establish a connection.
  7.   $000000000044BA77
  8.   $000000000044C84F
  9.  
  10. rik@rik-Virtual-Machine:~/Desktop/fbtest$ export FIREBIRD=~/Desktop/fbtest
  11. rik@rik-Virtual-Machine:~/Desktop/fbtest$ ./test
  12. a
  13. b
  14. c
  15. done
  16.  
  17. rik@rik-Virtual-Machine:~/Desktop/fbtest$
« Last Edit: April 26, 2023, 03:58:55 pm by rvk »

Handoko

  • Hero Member
  • *****
  • Posts: 5506
  • My goal: build my own game engine using Lazarus
Re: Firebird embedded
« Reply #32 on: April 27, 2023, 07:20:20 am »
I followed your instructions trying both version 3.0.10.33601 and 3.0.5.33220, but both gave the same error. See screenshot1.

After inspection I found libfbclient had 2 missing requirements: libncurses5 version5 and libtommath version0. The virtual machine (Ubuntu 23.04 64-bit) had libncurses6 and libtommath1 installed. I could instal libncurses5 easily but libtommath version 0 was no where to be found in the Ubuntu repository, I used Synaptic Package Manager. See screenshot2.

I checked the libfbclient copied from the host computer, no dependency issue. It used libtommath version 1. See screenshot3.

I assume your program and the Firebird libraries are all 64 bit?

I am not sure. The Firebird on the host computer (Ubuntu Mate 19.10 64-bit) was installed using my Ubuntu default repository using Synaptic Package Manager. See screenshot4.
I haven't tested much but it seems working good if my program runs using server-client connection.


BTW. Your libib_util.so seems very large. Mine is only 4368 bytes.

I also had tried to combine:
- libfbclient and libEngine12 from the host computer, version 3.0.5.33100 from Ubuntu repository
- libib_util version 3.0.5.33220 downloaded from your recommendation

Still error but got different error message, see screenshot5.

Did you think that was bitness issue? How to check the bitness of the libraries copied from the host computer?

Handoko

  • Hero Member
  • *****
  • Posts: 5506
  • My goal: build my own game engine using Lazarus
Re: Firebird embedded
« Reply #33 on: April 27, 2023, 07:20:49 am »
Screenshot5

rvk

  • Hero Member
  • *****
  • Posts: 6893
Re: Firebird embedded
« Reply #34 on: April 27, 2023, 07:32:39 am »
After inspection I found libfbclient had 2 missing requirements: libncurses5 version5 and libtommath version0. The virtual machine (Ubuntu 23.04 64-bit) had libncurses6 and libtommath1 installed. I could instal libncurses5 easily but libtommath version 0 was no where to be found in the Ubuntu repository, I used Synaptic Package Manager. See screenshot2.
In my first post where I said to check the dependencies I showed how you needed to create the symlink to libtommath.so.0 with ln. Did you miss that? The installer does that automatically but for embedded you need to do it manually. That's why I showed you all my steps on a very new clean Ubuntu install.

You can check bitness with the file command. But then the .so wouldn't load. It would not explain the localhost error unless you are combining different versions.

That's also the reason why I asked you to perform the exact steps with downloading 3.0.10 and the exact commands to copy the correct files.

I'll check in your screenshots if I can see if you missed some a bit later today.
« Last Edit: April 27, 2023, 07:36:19 am by rvk »

rvk

  • Hero Member
  • *****
  • Posts: 6893
Re: Firebird embedded
« Reply #35 on: April 27, 2023, 07:39:21 am »
Screenshot5
In this screenshot the engine.so has no x permission.
So this is not after following my instructions with downloading a clean Firebird.tar.gz and copying the files with my instructions.

Here was my complete log on a clean system.
Including the fix for libtommath.so.0.
https://forum.lazarus.freepascal.org/index.php/topic,63142.msg478363.html#msg478363
Try to follow those steps.

(From seeing screenshot1 and 2 you were very close, you only needed to do the sudo ln on libtommath.so.0 to make it work there.)
« Last Edit: April 27, 2023, 09:23:02 am by rvk »

rvk

  • Hero Member
  • *****
  • Posts: 6893
Re: Firebird embedded
« Reply #36 on: April 27, 2023, 04:52:01 pm »
Ok. I've now testes multiple versions multiple times. Firebird 3.0.10, 4.0.2 and 5.0 Beta 1.

Here are the commands I used on a clean Ubuntu 23.04 (base install) in Hyper-V (each time restored to clean base).
All versions worked as embedded without any problems.
(Note: for Firebird 4 and higher you also need libtomcrypt1 besides libncurses5 and libtommath1/0.)

Code: Bash  [Select][+][-]
  1. # ---------
  2. # for Firebird 3.0.10
  3. # ---------
  4. # prepare directories
  5. cd ~
  6. mkdir ~/Desktop/fbtest
  7. mkdir ~/Desktop/fbtest/plugins
  8. # download Firebird embedded
  9. wget https://github.com/FirebirdSQL/firebird/releases/download/v3.0.10/Firebird-3.0.10.33601-0.amd64.tar.gz
  10. tar -xf Firebird-3.0.10.33601-0.amd64.tar.gz
  11. cd Firebird-3.0.10.33601-0.amd64
  12. tar -xf buildroot.tar.gz
  13. # copying the needed files
  14. cd ~/Desktop/fbtest
  15. cp ~/Firebird-3.0.10.33601-0.amd64/opt/firebird/lib/libfbclient.so .
  16. cp ~/Firebird-3.0.10.33601-0.amd64/opt/firebird/lib/libib_util.so .
  17. cp ~/Firebird-3.0.10.33601-0.amd64/opt/firebird/plugins/libEngine12.so plugins
  18. scp rik@192.168.2.96:/home/rik/d/testfirebird .
  19. # install dependencies
  20. sudo apt-get install libncurses5
  21. sudo apt-get install libtommath1
  22. sudo ln -s libtommath.so.1 /usr/lib/x86_64-linux-gnu/libtommath.so.0 # we need libtommath0
  23. # prepare and execute
  24. export LD_LIBRARY_PATH=~/Desktop/fbtest
  25. export FIREBIRD=~/Desktop/fbtest
  26. ./testfirebird

Code: Bash  [Select][+][-]
  1. # ---------
  2. # for Firebird 4.0.2
  3. # ---------
  4. # prepare directories
  5. cd ~
  6. mkdir ~/Desktop/fbtest
  7. mkdir ~/Desktop/fbtest/plugins
  8. # download Firebird embedded
  9. wget https://github.com/FirebirdSQL/firebird/releases/download/v4.0.2/Firebird-4.0.2.2816-0.amd64.tar.gz
  10. tar -xf Firebird-4.0.2.2816-0.amd64.tar.gz
  11. cd Firebird-4.0.2.2816-0.amd64
  12. tar -xf buildroot.tar.gz
  13. # copying the needed files
  14. cd ~/Desktop/fbtest
  15. cp ~/Firebird-4.0.2.2816-0.amd64/opt/firebird/lib/libfbclient.so .
  16. cp ~/Firebird-4.0.2.2816-0.amd64/opt/firebird/lib/libib_util.so .
  17. cp ~/Firebird-4.0.2.2816-0.amd64/opt/firebird/plugins/libEngine13.so plugins
  18. scp rik@192.168.2.96:/home/rik/d/testfirebird .
  19. # install dependencies
  20. sudo apt-get install libncurses5
  21. sudo apt-get install libtommath1
  22. sudo apt-get install libtomcrypt1 # extra for Firebird 4.0
  23. sudo ln -s libtommath.so.1 /usr/lib/x86_64-linux-gnu/libtommath.so.0 # we need libtommath0
  24. # prepare and execute
  25. export LD_LIBRARY_PATH=~/Desktop/fbtest
  26. export FIREBIRD=~/Desktop/fbtest
  27. ./testfirebird

Code: Bash  [Select][+][-]
  1. # ---------
  2. # for Firebird 5.0.0 Beta 1
  3. # ---------
  4. # prepare directories
  5. cd ~
  6. mkdir ~/Desktop/fbtest
  7. mkdir ~/Desktop/fbtest/plugins
  8. # download Firebird embedded
  9. wget https://github.com/FirebirdSQL/firebird/releases/download/v5.0.0-Beta1/Firebird-5.0.0.973-Beta1-linux-x64.tar.gz
  10. tar -xf Firebird-5.0.0.973-Beta1-linux-x64.tar.gz
  11. cd Firebird-5.0.0.973-Beta1-linux-x64
  12. tar -xf buildroot.tar.gz
  13. # copying the needed files
  14. cd ~/Desktop/fbtest
  15. cp ~/Firebird-5.0.0.973-Beta1-linux-x64/opt/firebird/lib/libfbclient.so .
  16. cp ~/Firebird-5.0.0.973-Beta1-linux-x64/opt/firebird/lib/libib_util.so .
  17. cp ~/Firebird-5.0.0.973-Beta1-linux-x64/opt/firebird/plugins/libEngine13.so plugins # note: Still called 13
  18. scp rik@192.168.2.96:/home/rik/d/testfirebird .
  19. # install dependencies
  20. sudo apt-get install libncurses5
  21. sudo apt-get install libtommath1
  22. sudo apt-get install libtomcrypt1 # extra for Firebird 5.0
  23. sudo ln -s libtommath.so.1 /usr/lib/x86_64-linux-gnu/libtommath.so.0 # we need libtommath0
  24. # prepare and execute
  25. export LD_LIBRARY_PATH=~/Desktop/fbtest
  26. export FIREBIRD=~/Desktop/fbtest
  27. ./testfirebird

Handoko

  • Hero Member
  • *****
  • Posts: 5506
  • My goal: build my own game engine using Lazarus
Re: Firebird embedded
« Reply #37 on: May 01, 2023, 05:47:11 pm »
Finally, it works!

Sorry for the late reply.
Thank you very much rvk for patiently guiding me providing detailed instructions.
I learned a lot of thing, I feel like I've grown 1 inch taller :D


And thank you everyone's suggestions. I'll try SQLite and Zeos when I'm not busy.

 

TinyPortal © 2005-2018