SQLite3 and Linux lazarus / 1-Linux ---------------------------------------------------------------------- adamski · 2009-11-03 23:22 Hi; I would love to use SQLite in a new Lazarus project, but I'm finding it suprisingly difficult to use. I'm using the latest 0.9.28 release, which has the tsqlite3connection component, already installed. I've found a copy of the "libsqlite3.so" file, and have placed that in my project directory - i.e next to my executable. However, as soon I as try to set the component property "connected" to true - via the object inspector or programmatically - I get the following error: " Cannot not load SQLite client library "libsqlite3.so " If it's next to the executable I cannot understand why it cannot be found. Also how do you specify the db file to use - in my case it's "test.db" Thanks for any help, Marc ---------------------------------------------------------------------- theo · 2009-11-03 23:38 Quote from: adamski on November 04, 2009, 12:22:28 amI've found a copy of the "libsqlite3.so" file, and have placed that in my project directory - i.e next to my executable. Linux doesn't look for libraries "next to the executable". It has to go to /usr/lib/ or a path which you define in a start script like export LD_LIBRARY_PATH=$LD_LIBRARY_PATH: ---------------------------------------------------------------------- adamski · 2009-11-04 00:11 Hi Theo - thanks for the quick reply. I'm not that familiar with Lazarus under linux. I've set the following under the compiler options: paths -> libraries = $(ProjOutDir)/lib/ I would have thought, the project would now include any libs in the project's "lib" subdirectory. ( and I've placed the required library in this sub dir ) Unfortunately, the application still cannot find the library. ---------------------------------------------------------------------- LuizAmérico · 2009-11-04 01:07 It's necessary to install the dev package in the developer machine. See http://sqlite4fpc.yolasite.com/install-sqlite.php ---------------------------------------------------------------------- alter · 2009-11-04 02:13 Quote from: LuizAmérico on November 04, 2009, 02:07:45 amIt's necessary to install the dev package in the developer machine. See http://sqlite4fpc.yolasite.com/install-sqlite.php All required headers come with Lazarus+fpc. Problem is that there is no libsqlite3.so in system. Basically it all depends on system but in general you must type as root (network connection required): On Debian/Ubuntu like systems: apt-get install sqlite3 On RedHat and other yum based: yum install sqlite3 On openSUSE: zypper install sqlite3 Eventually it can be sqlite package not sqlite3. Just to clarify it what distribution are you using? ---------------------------------------------------------------------- adamski · 2009-11-04 08:26 Thanks Alter; I'm using Ubuntu, and I've already installed the "sqlite3" package. I suppose I have to add a path into my project, to point to where this library it installed? Is this done through : compiler options -> paths -> libraries? I'll try tonight.. ---------------------------------------------------------------------- alter · 2009-11-04 11:56 So another one thing. Check if you have libsqlite3.so (or something like this) in /usr/lib or /usr/lib64 (if distro is 64bit then I don't remember where Ubunty stored 64bit libraries). Just fo sure as root run ldconfig if there is libsqlite3.so-something but no symlink to it with the name libsqlite3.so (it is required to have either library with this name or symlink to existing file) Also if you have 64bit Ubuntu then make sure that both Lazarus environment (IDE, units, fpc) and sqlite3 library are either 64bit or 32bit ---------------------------------------------------------------------- adamski · 2009-11-04 23:45 Hi Alter; Thanks for the help - i've created a softlink in the /usr/lib directory, and now lazarus is picking up the file. Just one other question: I plan to write a small application and deploy on both windows and linux. How easy is it to deploy libraries (e.g. sqlite), as part of an installation (on windows and linux)? If it's easy, I'll write my app using sqlite, and worry about the deployment later. Thanks for everyone's help, Marc ---------------------------------------------------------------------- alter · 2009-11-05 01:05 Actually in case of Linux it is complicated. First you should most likely learn something about creating deb and rpm packages. Second way is to distribute as source code (if your licence for your application allows that) or eventually you may distribute as archive (like tar.gz or so).