Recent

Author Topic: sqlitelaz.lpk linking error  (Read 4592 times)

Aruna

  • Hero Member
  • *****
  • Posts: 513
sqlitelaz.lpk linking error
« on: July 11, 2024, 03:54:27 am »
Hello, I am trying to compile then install sqlitelaz.lpk. Compiling is a success. When trying to link I get the errors below:
Code: Pascal  [Select][+][-]
  1. Build IDE: Exit code 2, Errors: 3, Warnings: 1
  2. Warning: svn not in path.
  3. Error: /usr/bin/ld.bfd: cannot find -lsqlite
  4. make[2]: *** [Makefile:4667: lazarus] Error 1
  5. make[1]: *** [Makefile:5105: idepkg] Error 2
  6. Error: make: *** [Makefile:3793: idepkg] Error 2
  7. lazarus.pp(167,1) Error: Error while linking

Any guidance or workarounds would be most welcome. Thank you.
Aruna

TRon

  • Hero Member
  • *****
  • Posts: 3623
Re: sqlitelaz.lpk linking error
« Reply #1 on: July 11, 2024, 04:13:52 am »
Do you run a Debian based distro ?

If answered yes then try installing the libsqlite dev package.

PS: Also make sure the FPC configuration contains the library path that matches your system.
« Last Edit: July 11, 2024, 04:18:59 am by TRon »
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

Aruna

  • Hero Member
  • *****
  • Posts: 513
Re: sqlitelaz.lpk linking error
« Reply #2 on: July 11, 2024, 04:45:55 am »
Do you run a Debian based distro ?Yes I do
Code: Pascal  [Select][+][-]
  1. aruna@debian:~$ uname -a
  2. Linux debian 6.4.8-usb #8 SMP PREEMPT_DYNAMIC Fri Feb  9 17:21:43 EST 2024 x86_64 GNU/Linux
  3.  
Code: Pascal  [Select][+][-]
  1. aruna@debian:~$ lsb_release -a
  2. No LSB modules are available.
  3. Distributor ID: Debian
  4. Description:    Debian GNU/Linux 11 (bullseye)
  5. Release:        11
  6. Codename:       bullseye

If answered yes then try installing the libsqlite dev package.
I already did :-)
Code: Pascal  [Select][+][-]
  1. aruna@debian:~$ dpkg -s libsqlite3-dev
  2. Package: libsqlite3-dev
  3. Status: install ok installed
  4.  
Code: Pascal  [Select][+][-]
  1. aruna@debian:~$ apt list --installed | grep libsqlite3
  2. libsqlite3-0/oldstable,now 3.34.1-3 amd64 [installed,automatic]
  3. libsqlite3-dev/oldstable,now 3.34.1-3 amd64 [installed]
  4.  


PS: Also make sure the FPC configuration contains the library path that matches your system.
This is where I can use some help, please. How does one access and edit the FPC configuration file?
« Last Edit: July 11, 2024, 04:54:21 am by Aruna »

TRon

  • Hero Member
  • *****
  • Posts: 3623
Re: sqlitelaz.lpk linking error
« Reply #3 on: July 11, 2024, 04:57:01 am »
I applaud the contents of your reply but not the quoting  :P so I'll refrain from quoting on those answers I considered to be correct :-)

This is where I can use some help, please. How does one access and edit the FPC configuration file?
Do you know how to invoke the fpc command line compiler from the terminal ? (PS: make sure it is the same fpc command line compiler that your Lazarus is configured to use)

If so then run that command with the option -va (you do not have to provide a file to compile). It will output a lot of output from the compiler including which fpc.cfg file is used (the location and name).

If you have the location and name of the fpc.cfg file then edit that file and look for an entry that reads something like:
Code: [Select]
-Fl/usr/lib/gcc/x86_64-linux-gnu/12
That is what my own setup uses for library path but yours might differ. Make sure that path actually exist and in case not then modify it accordingly to your setup.
« Last Edit: July 11, 2024, 04:59:21 am by TRon »
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

Aruna

  • Hero Member
  • *****
  • Posts: 513
Re: sqlitelaz.lpk linking error
« Reply #4 on: July 11, 2024, 04:11:37 pm »
I applaud the contents of your reply but not the quoting  :P so I'll refrain from quoting on those answers I considered to be correct :-)
It has been a while since I last visited the forum and apologies about the quoting :-) and yes all your answers so far have been correct :D
I just wanted to give you as much information as I can to help resolve this  :P

Quote
This is where I can use some help, please. How does one access and edit the FPC configuration file?
Do you know how to invoke the fpc command line compiler from the terminal ? (PS: make sure it is the same fpc command line compiler that your Lazarus is configured to use)

If so then run that command with the option -va (you do not have to provide a file to compile). It will output a lot of output from the compiler including which fpc.cfg file is used (the location and name).
No I have never used the command line compiler. Guess now is the time to start  :D

Quote
If you have the location and name of the fpc.cfg file then edit that file and look for an entry that reads something like:
Quote
Code: [Select]
-Fl/usr/lib/gcc/x86_64-linux-gnu/12
I used Projects-->Project Options and plugged in the path there under compiler options. I have attached a screenshot. Still getting the error :-(

Quote
That is what my own setup uses for library path but yours might differ. Make sure that path actually exist and in case not then modify it accordingly to your setup.
Many thanks for all the guidance. I will try again and get back to you.

TRon

  • Hero Member
  • *****
  • Posts: 3623
Re: sqlitelaz.lpk linking error
« Reply #5 on: July 12, 2024, 05:01:10 am »
It has been a while since I last visited the forum and apologies about the quoting :-) and yes all your answers so far have been correct :D
I just wanted to give you as much information as I can to help resolve this  :P
That is why I applauded the information you posted. All is good :)

never used the command line compiler. Guess now is the time to start  :D
A little tradesecret: If you use Lazarus to build and compile projects then you use the commandline compiler (though indirectly and under the hood, but still  ;) ).

Quote
I used Projects-->Project Options and plugged in the path there under compiler options. I have attached a screenshot. Still getting the error :-(
That is an interesting approach and one I did not used myself.

Are you sure you do not need a version directory appended to that path as per my setup example (12, most likely 11 for your specific version of debian) ? (not all debian based distros install it in a similar manner so it might indeed be different for you but it has been a long time I saw libs installed in a path without a version number explicitly mentioned)

BTW from what I am able to tell you seem to explicitly use unit sqlite ? If that is the case and you have no apparent reason for doing so then use unit sqlite3 instead.

If all else fails, try to add the option -k--verbose to the compiler options as it shows all the paths that the linker is using to attempt to locate the library. If you look a the the output log with Lazarus then make sure to copy /all/ the messages out of the message window (and paste them in to a text editor or similar) as many messages are filtered by default.
« Last Edit: July 12, 2024, 05:11:38 am by TRon »
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

TRon

  • Hero Member
  • *****
  • Posts: 3623
Re: sqlitelaz.lpk linking error
« Reply #6 on: July 12, 2024, 05:16:44 am »
BTW from what I am able to tell you seem to explicitly use unit sqlite ? If that is the case and you have no apparent reason for doing so then use unit sqlite3 instead.
Ok, I now tried to install the same Lazarus package and ran into the exact same issue. Me thinks an oversight.

This requires further investigation e.g. meaning not your fault or related to your setup.

edit: try to install package sqlite3laz instead.

Which version (please be exact) of the Lazarus IDE do you use ?
« Last Edit: July 12, 2024, 05:24:04 am by TRon »
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

Thaddy

  • Hero Member
  • *****
  • Posts: 16154
  • Censorship about opinions does not belong here.
Re: sqlitelaz.lpk linking error
« Reply #7 on: July 12, 2024, 06:11:01 am »
It has nothing to do with lazarus itself, it is the package that is broken or easily broken for many years. For sqlite, plz use sqldb and the sqlite3 connector, that is way more stable and totally different code. I know how to fix the problem: it is a design time load and versioning problem. The best way out is to use static linking, but that is uncomfortable for most. The other way out is to try and merge the sqlite3 code for sqldb into the old sqlitedb code.
Again: sqlitedb is broken for years and most would even say deprecated. You really have to know what you are doing to get it working. It is not very comfortable to use, because of various design issues.
But if you want to use sqlite 2 it is still the only option, since there is no sqldb connector for sqlite 2. (sqlite 2 is much lighter at less than 100k)
BTW if you use it from code, so no design time component, the issue magically disappears..in most cases. Be aware of that.
This old package is written with too many assumptions by the author. It is those assumptions that breaks it for many.
« Last Edit: July 12, 2024, 06:27:50 am by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

TRon

  • Hero Member
  • *****
  • Posts: 3623
Re: sqlitelaz.lpk linking error
« Reply #8 on: July 12, 2024, 06:27:26 am »
Ah you revised your answer Thaddy as I was going to mention that the 'old' package still exist only for using the sqlite before v3.

At this pojnt I am inclined to agree with the deprecated remark as Debian itself does not seem to support libsqlite < 3 out of the box.

I simply overlooked so this issue took longer than necessary for which my apologies.
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

Thaddy

  • Hero Member
  • *****
  • Posts: 16154
  • Censorship about opinions does not belong here.
Re: sqlitelaz.lpk linking error
« Reply #9 on: July 12, 2024, 06:29:39 am »
Yes, I had to add to my answer, because I was testing and remembered all kinds of horror stories.... :o sorry that I was editting and caused a posts crossed..
If I smell bad code it usually is bad code and that includes my own code.

Thaddy

  • Hero Member
  • *****
  • Posts: 16154
  • Censorship about opinions does not belong here.
Re: sqlitelaz.lpk linking error
« Reply #10 on: July 12, 2024, 06:34:52 am »
You can still get sqlite 2 from sqlite.org. Compile from source.
If I smell bad code it usually is bad code and that includes my own code.

TRon

  • Hero Member
  • *****
  • Posts: 3623
Re: sqlitelaz.lpk linking error
« Reply #11 on: July 12, 2024, 06:44:17 am »
...sorry that I was editting and caused a posts crossed..
These things tend to happen from time to time so no problem  :) . Thank you for your input.
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

Aruna

  • Hero Member
  • *****
  • Posts: 513
Re: sqlitelaz.lpk linking error
« Reply #12 on: July 12, 2024, 08:00:43 pm »
A little tradesecret: If you use Lazarus to build and compile projects then you use the commandline compiler (though indirectly and under the hood, but still  ;) ).

I tried compiling at the command line, please see below:
Code: Pascal  [Select][+][-]
  1. aruna@debian:~/lazarus/csv$ fpc -MObjFPC unit1.pas
  2. Free Pascal Compiler version 3.2.0+dfsg-12 [2021/01/25] for x86_64
  3. Copyright (c) 1993-2020 by Florian Klaempfl and others
  4. Target OS: Linux for x86-64
  5. Compiling unit1.pas
  6. unit1.pas(8,38) Fatal: Can't find unit Forms used by Unit1
  7. Fatal: Compilation aborted
  8. Error: /usr/bin/ppcx64 returned an error exitcode

I am assuming it is complaining about
Code: Pascal  [Select][+][-]
  1. uses
  2.   Classes, SysUtils, db, csvdataset, Forms, Controls, Graphics, Dialogs,
  3.   DBGrids, ExtDlgs, StdCtrls, FileUtil ;
  4.  
As that is what I use in my project. For now I think I will use the IDE as it works smoothly and I do not have to tinker with the internals. At some point in time I will start using fpc at the commandline ;D
Quote
I used Projects-->Project Options and plugged in the path there under compiler options. I have attached a screenshot. Still getting the error :-(

Quote
That is an interesting approach and one I did not used myself.
I asked Google and that is what it showed me as a possible solution, so I went with it.

Quote
Are you sure you do not need a version directory appended to that path as per my setup example (12, most likely 11 for your specific version of debian) ? (not all debian based distros install it in a similar manner so it might indeed be different for you but it has been a long time I saw libs installed in a path without a version number explicitly mentioned)
Well, this is what my system has:
Code: Pascal  [Select][+][-]
  1. aruna@debian:~/lazarus/csv$ sudo find /usr/lib/ -type f -name "libsqlite*"
  2. [sudo] password for aruna:
  3. /usr/lib/x86_64-linux-gnu/libsqlite3.so.0.8.6
  4. /usr/lib/x86_64-linux-gnu/libsqlite3.a
  5.  
and..
Code: Pascal  [Select][+][-]
  1. aruna@debian:~/lazarus/csv$ ls -1alh /usr/lib/x86_64-linux-gnu/*sql*
  2. -rw-r--r-- 1 root  root  1.7M Feb 24  2021 /usr/lib/x86_64-linux-gnu/libsqlite3.a
  3. lrwxrwxrwx 1 root  root    19 Feb 24  2021 /usr/lib/x86_64-linux-gnu/libsqlite3.so -> libsqlite3.so.0.8.6
  4. lrwxrwxrwx 1 aruna aruna   19 Feb 24  2021 /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 -> libsqlite3.so.0.8.6
  5. -rw-r--r-- 1 aruna aruna 1.3M Feb 24  2021 /usr/lib/x86_64-linux-gnu/libsqlite3.so.0.8.6



Quote
BTW from what I am able to tell you seem to explicitly use unit sqlite ? If that is the case and you have no apparent reason for doing so then use unit sqlite3 instead.
Let me give you some context so you know exactly what happened. I opened the Lazarus IDE and I did not see a SQLdb tab in the component palette. Then I searched on how to enable that. And I just tried the unit SQLite to see if it would work and give me the SQLdb tab. No luck. This is when I decided to ask on the forum. If anyone knows a way to enable this SQLdb tab on the component palette please do share?
Quote
If all else fails, try to add the option -k--verbose to the compiler options as it shows all the paths that the linker is using to attempt to locate the library. If you look a the the output log with Lazarus then make sure to copy /all/ the messages out of the message window (and paste them in to a text editor or similar) as many messages are filtered by default.
I will definitely give it a try. Thank you.
« Last Edit: July 12, 2024, 08:13:43 pm by Aruna »

Aruna

  • Hero Member
  • *****
  • Posts: 513
Re: sqlitelaz.lpk linking error
« Reply #13 on: July 12, 2024, 08:50:57 pm »
Ok, I now tried to install the same Lazarus package and ran into the exact same issue. Me thinks an oversight.
Really? This is starting to get interesting  :o

Quote
This requires further investigation e.g. meaning not your fault or related to your setup.
Don't be so sure it is not my fault. Quite possibly I may have done something I should not have in the name of learning, gaining more knowledge and wisdom.

Or simply mucking around tweaking stuff to see oh-kay let's see what changing this will do? Like when long years ago I closed all the IDE's windows. I must have spent a good week trying to put things back the way they were. Luckily I found an article https://wiki.freepascal.org/Anchor_Docking#Usage_I._.28Add_docking_support_to_the_Lazarus_IDE.29 that showed how to drag and dock the windows again. Phew,that was fun.! By the way,

I have multiple linux kernels and multiple versions of Lazarus on this box  %)

Quote
edit: try to install package sqlite3laz instead
I tried and I am getting a weird error. I have attached a screenshot.

Quote
Which version (please be exact) of the Lazarus IDE do you use ?
Version 2.2.5. Screenshot attached
« Last Edit: July 12, 2024, 09:35:46 pm by Aruna »

TRon

  • Hero Member
  • *****
  • Posts: 3623
Re: sqlitelaz.lpk linking error
« Reply #14 on: July 13, 2024, 10:43:35 am »
I tried compiling at the command line, please see below:
Note that I was only suggesting to use the fpc commandline compiler to get information about which fpc.cfg file is in use by it.

Actually compiling a whole Lazarus project requires a bit more incentive and is much easier to accomplish using lazbuild (which indirectly uses FPC again).

Quote
I am assuming it is complaining about
Indeed the error about the missing Form's unit is because PFC itself is not configured to use Lazarus components (that is what Lazarus does for us/FPC, or better said the lazarus project file information, of which FPC itself has no notion whatsoever).

If you know what you're doing then it is possible to compile Lazarus projects with the FPC commandline compiler but it is tedious because it requires quite a lot of knowledge and manual configuration regarding Lazarus components.

As said, it is much easier (and exactly intended for that puspose) to use lazbuild to build Lazarus projects from the commandline.
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

 

TinyPortal © 2005-2018