Static sqlite3 library for Linux.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Static sqlite3 library for Linux.

Petros Marinos
Greetings!

While I am trying to build a static library of another tool which is dependent to sqlite, I need to use an sqlite3 static library as well. Still, in my Centos 7.4 system, I cannot find one. The error is shown below:

/bin/ld: cannot find -lsqlite3
collect2: error: ld returned 1 exit status
make[1]: *** [astdb2sqlite3] Error 1
make: *** [utils] Error 2

When I look for one with:
yum provides */libsqlite*.a

I find the Windows version:
/usr/x86_64-w64-mingw32/sys-root/mingw/lib/libsqlite3.a

Which of course is useless:
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/…/…/…/…/lib64/libsqlite3.a: error adding symbols: File format not recognized
collect2: error: ld returned 1 exit status
make[1]: *** [astdb2sqlite3] Error 1
make: *** [utils] Error 2

Is there any chance that I can find a Linux flavour static sqlite3 library, or do I have to build from source?
And if I have to build from source, is it recommended to use the sqlite-autoconf or the sqlite-src pkg? Or does the amalgamation file could be of any use, so as to avoid compilation etc?

PS: One final relevant question, does the resulting libsqlite3.a file (when built from source), includes any other libraries like libc.a, libthread.a etc? Is there a way to avoid this?
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Static sqlite3 library for Linux.

Simon Slavin-3
On 13 Feb 2018, at 10:55am, Petros Marinos <[hidden email]> wrote:

> Is there any chance that I can find a Linux flavour static sqlite3 library, or do I have to build from source?
> And if I have to build from source, is it recommended to use the sqlite-autoconf or the sqlite-src pkg? Or does the amalgamation file could be of any use, so as to avoid compilation etc?

It is recommended, in all possible cases, that you include the amalgamation source code (one .c file and one .h file) in your project.  Make sure your compiler understands that a .c file is C source code, not C++ source code.  The object code size of sqlite.c is very small and should not bulk up your program by much.

SQLite (talking about the API rather than the stand-alone tools) has no dependencies.  Therefore if you include the source code in your project rather than using SQLite as a library, you are adding no dependencies to your project.  This is important since a /lot/ of projects include SQLite and you can easily run into version disputes if you depend on a peculiarity of a certain version of SQLite.

Simon.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users