Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-10

sqlite3 app on linux

5 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Andrea Mauri

dear all,
I am working on an app using sqlite. I use sqlite3connection. My app is actually completed and I am preparing the "installer". For Linux I made a deb and a rpm package including the dependency to libsqlite3-0.
The installing procedure works fine but when I run my app I get:

can not load sqlite client library libsqlite3.so

In usr/lib I have only libsqlite3.so.0, if a make a symlink libsqlite3.so.0 to libsqlite3.so the app works fine.

My questions are:
why sqlite3connection looks specifically to libsqlite3.so? I am not a linux expert but I found that also on another pc with ubuntu I have libsqlite3.so.0 and not libsqlite3.so.

how can I resolve this issue? may I put a postinst script in the deb package in order to create the symlink? if the symlink already exists? someone can suggest me how this script should be?

there are some others workaround?

thanks,
andrea

Reply by email

Michael Van Canneyt
to Andrea Mauri
Andrea Mauri wrote 22 lines
dear all, I am working on an app using sqlite. I use sqlite3connection. My app is actually completed and I am preparing the "installer". For Linux I made a deb and a rpm package including the dependency to libsqlite3-0. The installing procedure works fine but when I run my app I get: can not load sqlite client library libsqlite3.so In usr/lib I have only libsqlite3.so.0, if a make a symlink libsqlite3.so.0 to libsqlite3.so the app works fine. My questions are: why sqlite3connection looks specifically to libsqlite3.so? I am not a linux expert but I found that also on another pc with ubuntu I have libsqlite3.so.0 and not libsqlite3.so. how can I resolve this issue? may I put a postinst script in the deb package in order to create the symlink? if the symlink already exists? someone can suggest me how this script should be? there are some others workaround?

Yes. Put the following in the startup code of your app:

uses sqlite3dyn;
begin
   InitializeSqlite('libsqlite3.so.0');
end;

More sophisticated would be to detect which file actually exists, and use the correct filename.

Michael.

Reply by email

Andrea Mauri
to Michael Van Canneyt

Il 14/10/2010 15:51, Michael Van Canneyt ha scritto:

Show quoted text 9 lines
Yes. Put the following in the startup code of your app: uses sqlite3dyn; begin InitializeSqlite('libsqlite3.so.0'); end;

I tried but now I get the following error when I create at runtime the sqlite db and related tables:

sqlite interface already initialized from library libsqlite3.so.0

More sophisticated would be to detect which file actually exists, and use the correct filename.

How can I do that? Suggestions?

Reply by email

Michael Van Canneyt
to Andrea Mauri
Andrea Mauri wrote 14 lines
Il 14/10/2010 15:51, Michael Van Canneyt ha scritto: > > Yes. Put the following in the startup code of your app: > > uses sqlite3dyn; > > begin > InitializeSqlite('libsqlite3.so.0'); > end; > I tried but now I get the following error when I create at runtime the sqlite db and related tables: sqlite interface already initialized from library libsqlite3.so.0

Hm. This is a bug. Or rather, a shortcoming. The connection should detect whether the library is already loaded, and if so, re-use that name. (The sqliteLibrary variable can be used for that). Better yet, the library name should be configurable in the connection instance.

Can you please enter a bugreport for this ?

> More sophisticated would be to detect which file actually exists, and use > the correct filename. How can I do that? Suggestions?

The above bug prevents you from doing this.

What you can try to do is create the symbolic link yourself, in the installation procedure - I assume it will be executed as root.

If it is not executed as root, you can still create the link in the application install directory, and start the application with a shell script that sets the LD_LIBRARY_PATH containing the application install directory prior to starting the actual binary.

This is currently the best option, till we fix the above bug.

Michael.

Reply by email

Andrea Mauri
to Michael Van Canneyt

Il 14/10/2010 16:55, Michael Van Canneyt ha scritto:

Show quoted text 26 lines
On Thu, 14 Oct 2010, Andrea Mauri wrote: > Il 14/10/2010 15:51, Michael Van Canneyt ha scritto: >> >> Yes. Put the following in the startup code of your app: >> >> uses sqlite3dyn; >> >> begin >> InitializeSqlite('libsqlite3.so.0'); >> end; >> > I tried but now I get the following error when I create at runtime the > sqlite db and related tables: > > sqlite interface already initialized from library libsqlite3.so.0 Hm. This is a bug. Or rather, a shortcoming. The connection should detect whether the library is already loaded, and if so, re-use that name. (The sqliteLibrary variable can be used for that). Better yet, the library name should be configurable in the connection instance. Can you please enter a bugreport for this ?

ok, bug id 0017633 in [FPC] Database Components

Show quoted text 11 lines
>> More sophisticated would be to detect which file actually exists, and >> use >> the correct filename. > > How can I do that? Suggestions? The above bug prevents you from doing this. What you can try to do is create the symbolic link yourself, in the installation procedure - I assume it will be executed as root.

ok. I prepared a deb package so I will try to prepare a postinst script in order to create the symbolic link (if it does not exist yet).

thanks,
andrea

Reply by email