Re: [sqlite] Reducing compiled size
For the record, I know that the documentation says the OMIT_* flags don't work with the regular amalgamation, but I have in fact used many of them and they seem to work. Two that only partially worked (a bug?) are SQLITE_OMIT_AUTOVACUUM and SQLITE_OMIT_AUTHORIZATION (I am not sure about that second one, as I am writing this from memory. I think it was that one) They gave a warning when compiling sqlite3.c and an error when linking it to my program. On Mon, Jul 25, 2011 at 6:16 PM, Dave Hope wrote: > Hi Richard, > > I'm using gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5). Also tried with > VC9 which yields very similar sizes. > > $ gcc main.c sqlite3.c -lpthread -ldl > $ size a.out > textdata bss dec hex filename > 51447536881168 519331 7eca3 a.out > > It looks like this could have been because I wasn't optimizing for size: > > $ gcc main.c sqlite3.c -lpthread -ldl -Os > $ size a.out > textdata bss dec hex filename > 32648735881000 331075 50d43 a.out > > Thanks for pointing out what I missed, > > Dave > > On Mon, Jul 25, 2011 at 4:07 PM, Richard Hipp wrote: > > On Mon, Jul 25, 2011 at 10:39 AM, Dave Hope wrote: > > > >> Hi all, > >> > >> I read on the sqlite website that the compiled size can be reduced to > >> 275KiB ( http://www.sqlite.org/different.html#small ), however I'm > >> struggling to get it much below 500 KiB using the SQLITE_OMIT_* > >> options. I'm producing my own amalgamation, which I believe you can > >> use the OMIT options with: > >> > > > > So I type: > > > >gcc -Os -c sqlite3.c; size sqlite3.o > > > > And on Linux with gcc 4.1.0 I get 333802 bytes. This is without any OMIT > > options. And you cannot get it below 500KB? What compiler are you > using? > > > > > > -- > > D. Richard Hipp > > d...@sqlite.org > > ___ > > sqlite-users mailing list > > sqlite-users@sqlite.org > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Reducing compiled size
Hi Richard, I'm using gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5). Also tried with VC9 which yields very similar sizes. $ gcc main.c sqlite3.c -lpthread -ldl $ size a.out textdata bss dec hex filename 51447536881168 519331 7eca3 a.out It looks like this could have been because I wasn't optimizing for size: $ gcc main.c sqlite3.c -lpthread -ldl -Os $ size a.out textdata bss dec hex filename 32648735881000 331075 50d43 a.out Thanks for pointing out what I missed, Dave On Mon, Jul 25, 2011 at 4:07 PM, Richard Hipp wrote: > On Mon, Jul 25, 2011 at 10:39 AM, Dave Hope wrote: > >> Hi all, >> >> I read on the sqlite website that the compiled size can be reduced to >> 275KiB ( http://www.sqlite.org/different.html#small ), however I'm >> struggling to get it much below 500 KiB using the SQLITE_OMIT_* >> options. I'm producing my own amalgamation, which I believe you can >> use the OMIT options with: >> > > So I type: > > gcc -Os -c sqlite3.c; size sqlite3.o > > And on Linux with gcc 4.1.0 I get 333802 bytes. This is without any OMIT > options. And you cannot get it below 500KB? What compiler are you using? > > > -- > D. Richard Hipp > d...@sqlite.org > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Reducing compiled size
On Mon, Jul 25, 2011 at 10:39 AM, Dave Hope wrote: > Hi all, > > I read on the sqlite website that the compiled size can be reduced to > 275KiB ( http://www.sqlite.org/different.html#small ), however I'm > struggling to get it much below 500 KiB using the SQLITE_OMIT_* > options. I'm producing my own amalgamation, which I believe you can > use the OMIT options with: > So I type: gcc -Os -c sqlite3.c; size sqlite3.o And on Linux with gcc 4.1.0 I get 333802 bytes. This is without any OMIT options. And you cannot get it below 500KB? What compiler are you using? -- D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Reducing compiled size
Thanks Stephan Sorry, you're quite right. I was actually using OPTS="" but omitted it when I pasted it into my e-mail. Thanks Dave On Mon, Jul 25, 2011 at 3:55 PM, Stephan Beal wrote: > On Mon, Jul 25, 2011 at 4:51 PM, Dave Hope wrote: > >> Hi Stephan, >> >> I initially added these to the Makefile, but looking at the mailing >> list suggested otherwise: >> >> http://www.mail-archive.com/sqlite-users@sqlite.org/msg37813.html > > > That post says to use: > > make "OPTS=-..." > > So it seems that OPTS= is missing. > > -- > - stephan beal > http://wanderinghorse.net/home/stephan/ > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Reducing compiled size
On Mon, Jul 25, 2011 at 4:51 PM, Dave Hope wrote: > Hi Stephan, > > I initially added these to the Makefile, but looking at the mailing > list suggested otherwise: > > http://www.mail-archive.com/sqlite-users@sqlite.org/msg37813.html That post says to use: make "OPTS=-..." So it seems that OPTS= is missing. -- - stephan beal http://wanderinghorse.net/home/stephan/ ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Reducing compiled size
Hi Stephan, I initially added these to the Makefile, but looking at the mailing list suggested otherwise: http://www.mail-archive.com/sqlite-users@sqlite.org/msg37813.html Thanks Dave On Mon, Jul 25, 2011 at 3:46 PM, Stephan Beal wrote: > On Mon, Jul 25, 2011 at 4:39 PM, Dave Hope wrote: > >> make sqlite3.c "-DSQLITE_OMIT_ALTERTABLE -DSQLITE_OMIT_ANALYZE >> > > Shouldn't that be: > > make sqlite3.c CPPFLAGS="..." > > ? > > Make doesn't understand -D (no, that's not a smiley). > > -- > - stephan beal > http://wanderinghorse.net/home/stephan/ > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Reducing compiled size
On Mon, Jul 25, 2011 at 4:39 PM, Dave Hope wrote: > make sqlite3.c "-DSQLITE_OMIT_ALTERTABLE -DSQLITE_OMIT_ANALYZE > Shouldn't that be: make sqlite3.c CPPFLAGS="..." ? Make doesn't understand -D (no, that's not a smiley). -- - stephan beal http://wanderinghorse.net/home/stephan/ ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Reducing compiled size
Hi all, I read on the sqlite website that the compiled size can be reduced to 275KiB ( http://www.sqlite.org/different.html#small ), however I'm struggling to get it much below 500 KiB using the SQLITE_OMIT_* options. I'm producing my own amalgamation, which I believe you can use the OMIT options with: "Special versions of the SQLite amalgamation that do work with a predetermined set of SQLITE_OMIT_* options can be generated." ( http://www.sqlite.org/compile.html#omitfeatures ). Here's what I'm doing to compile: ./configure CFLAGS="-DSQLITE_OMIT_ALTERTABLE -DSQLITE_OMIT_ANALYZE -DSQLITE_OMIT_ATTACH -DSQLITE_OMIT_AUTHORIZATION -DSQLITE_OMIT_AUTOINCREMENT -DSQLITE_OMIT_AUTOMATIC_INDEX -DSQLITE_OMIT_AUTORESET -DSQLITE_OMIT_AUTOVACUUM -DSQLITE_OMIT_BETWEEN_OPTIMIZATION -DSQLITE_OMIT_BLOB_LITERAL -DSQLITE_OMIT_BTREECOUNT -DSQLITE_OMIT_BUILTIN_TEST -DSQLITE_OMIT_CAST -DSQLITE_OMIT_CHECK -DSQLITE_OMIT_COMPILEOPTION_DIAGS -DSQLITE_OMIT_COMPLETE -DSQLITE_OMIT_DATETIME_FUNCS -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_EXPLAIN -DSQLITE_OMIT_FLAG_PRAGMAS -DSQLITE_OMIT_FLOATING_POINT -DSQLITE_OMIT_FOREIGN_KEY -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_INCRBLOB -DSQLITE_OMIT_INTEGRITY_CHECK -DSQLITE_OMIT_LIKE_OPTIMIZATION -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_OMIT_LOCALTIME -DSQLITE_OMIT_MEMORYDB -DSQLITE_OMIT_OR_OPTIMIZATION -DSQLITE_OMIT_PAGER_PRAGMAS -DSQLITE_OMIT_PRAGMA -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_QUICKBALANCE -DSQLITE_OMIT_REINDEX -DSQLITE_OMIT_SCHEMA_PRAGMAS -DSQLITE_OMIT_SCHEMA_VERSION_PRAGMAS -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_TCL_VARIABLE -DSQLITE_OMIT_TEMPDB -DSQLITE_OMIT_TRACE -DSQLITE_OMIT_TRIGGER -DSQLITE_OMIT_TRUNCATE_OPTIMIZATION -DSQLITE_OMIT_UTF16 -DSQLITE_OMIT_VACUUM -DSQLITE_OMIT_VIEW -DSQLITE_OMIT_VIRTUALTABLE -DSQLITE_OMIT_WAL -DSQLITE_OMIT_WSD -DSQLITE_OMIT_XFER_OPT" make sqlite3.c "-DSQLITE_OMIT_ALTERTABLE -DSQLITE_OMIT_ANALYZE -DSQLITE_OMIT_ATTACH -DSQLITE_OMIT_AUTHORIZATION -DSQLITE_OMIT_AUTOINCREMENT -DSQLITE_OMIT_AUTOMATIC_INDEX -DSQLITE_OMIT_AUTORESET -DSQLITE_OMIT_AUTOVACUUM -DSQLITE_OMIT_BETWEEN_OPTIMIZATION -DSQLITE_OMIT_BLOB_LITERAL -DSQLITE_OMIT_BTREECOUNT -DSQLITE_OMIT_BUILTIN_TEST -DSQLITE_OMIT_CAST -DSQLITE_OMIT_CHECK -DSQLITE_OMIT_COMPILEOPTION_DIAGS -DSQLITE_OMIT_COMPLETE -DSQLITE_OMIT_DATETIME_FUNCS -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_EXPLAIN -DSQLITE_OMIT_FLAG_PRAGMAS -DSQLITE_OMIT_FLOATING_POINT -DSQLITE_OMIT_FOREIGN_KEY -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_INCRBLOB -DSQLITE_OMIT_INTEGRITY_CHECK -DSQLITE_OMIT_LIKE_OPTIMIZATION -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_OMIT_LOCALTIME -DSQLITE_OMIT_MEMORYDB -DSQLITE_OMIT_OR_OPTIMIZATION -DSQLITE_OMIT_PAGER_PRAGMAS -DSQLITE_OMIT_PRAGMA -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_QUICKBALANCE -DSQLITE_OMIT_REINDEX -DSQLITE_OMIT_SCHEMA_PRAGMAS -DSQLITE_OMIT_SCHEMA_VERSION_PRAGMAS -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_TCL_VARIABLE -DSQLITE_OMIT_TEMPDB -DSQLITE_OMIT_TRACE -DSQLITE_OMIT_TRIGGER -DSQLITE_OMIT_TRUNCATE_OPTIMIZATION -DSQLITE_OMIT_UTF16 -DSQLITE_OMIT_VACUUM -DSQLITE_OMIT_VIEW -DSQLITE_OMIT_VIRTUALTABLE -DSQLITE_OMIT_WAL -DSQLITE_OMIT_WSD -DSQLITE_OMIT_XFER_OPT" Any suggestions as to where I'm going wrong? Thanks Dave ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users