Hi,

I'm a developer with the AstLinux project and we cross-compile for x86 embedded 
hardware using the "autoconf" version of sqlite.

When upgrading from SQLite 3.8.9 to 3.9.2 I noticed our binary image grew by 
about 600KB, the culprit was the /usr/bin/sqlite3 shell tool is now statically 
linked instead of dynamically linked as before.

Binary image size matters to us, and 600KB of duplicated code is not good.  We 
share the /usr/lib/libsqlite3.so library with a few packages.

The change seems to have occurred here:

Have the autoconf package build the shell tool with SQLite linked in statically.
http://www.sqlite.org/src/info/31834c3aa7deeafe

My current solution is to apply this build patch:
====
--- sqlite-3090200/Makefile.in.orig     2015-11-12 10:34:16.000000000 -0600
+++ sqlite-3090200/Makefile.in  2015-11-12 10:37:16.000000000 -0600
@@ -107,7 +107,7 @@
        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
        $(libsqlite3_la_LDFLAGS) $(LDFLAGS) -o $@
PROGRAMS = $(bin_PROGRAMS)
-am_sqlite3_OBJECTS = sqlite3-shell.$(OBJEXT) sqlite3-sqlite3.$(OBJEXT)
+am_sqlite3_OBJECTS = sqlite3-shell.$(OBJEXT) $(top_builddir)/libsqlite3.la
sqlite3_OBJECTS = $(am_sqlite3_OBJECTS)
sqlite3_DEPENDENCIES =
sqlite3_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
====

And that seems to restore the previous behavior to dynamically link the sqlite3 
shell tool.

It would be nice if like Fossil (--with-internal-sqlite), sqlite had a 
configure option to determine if the shell tool would be statically or 
dynamically linked, ex. --with-static-shell-tool

I would expect sqlite would default to dynamically linked (if --enable-shared 
is passed), not sure why the change to static.

Much appreciate the work here.

Lonnie

PS: Here is a related thread from another user a few weeks ago...

sqlite 3.8.11 - binary size
http://thread.gmane.org/gmane.comp.db.sqlite.general/97489

Reply via email to