wiki:Packages/SQLite

Version 13 (modified by C Rempel, on 06/25/12 at 20:28:50) (diff)

/* Makefile.sqlite */

SQLite

SQLite was originally designed to be an embedded database for on-board guided missile destroyers, for the US Navy The Definitive Guide to Sqlite By Michael Owens. Unlike many database program, SQLite is designed to be an itegral part of the embedded system. SQLite doesn't use interprocess communication, which makes it much faster than a database system that does.

Some quick notes

For a developer that might be interested in porting SQLite to RTEMS...

To build SQLite from the development repository, you need TCL and fossil. TCL is part of the SQLite build system, while fossil is another version control system.

~$ sudo apt-get install tcl8.5 fossil

SQLite uses fossil for their development branch, so if you use their development branch, you have some steps to go through:

First, check out a "fossil" which is a single file with all the information

~/sqlite$ fossil clone http://www.sqlite.org/cgi/src/dir trunk.fossil

Second, make and navigate into an sqlite directory:

~$ mkdir sqlite ~$ cd sqlite

Third, open the fossil file

~/sqlite$ fossil open ../trunk.fossil

Fourth, archaive the sqlite folder (so you have an old copy to fall back on)...

~/sqlite$ cd .. ~$ tar -acf sqlite.fossil.tar.bz2 sqlite

DO NOT close the fossil file! It will remove manifest.uuid and not compile!

Makefile.sqlite

Just figured out how to get SQLite to compile!

First, install the rtems-graphics-toolkit/mman_kit. This is so that SQLite can use shared memory, (shm).

Second, comment out the references to popen and pclose in rtems-addon-packages/sqlite/src/shell.c

Third, copy the Makefile below into rtems-addon-packages/RTEMS_Makefiles/Makefile.sqlite

#
# Configure/build/install the sqlite library
# note: comment out the references to popen and pclose in src/shell.c
# until a reasonable substitution can be found

include ../RTEMS_Makefiles/Makefile.common

all:
	CFLAGS='-DPROT_READ=0x01' \
	CFLAGS='-DPROT_WRITE=0x02' \
	CFLAGS='-DMAP_SHARED=0x001' \
	CFLAGS='-DSQLITE_OMIT_ALTERTABLE=2 ' \
	LDFLAGS='-lmmap_kit' \
	../sqlite/configure \
		--prefix=$(exec_prefix) \
		--build=i686-linux-gnu \
		--host=i386-rtems4.11 \
		--disable-largefile \
		--enable-cross-thread-connections \
		--disable-tcl \
		--disable-readline \
		--disable-amalgamation \
		--libdir=$(exec_prefix)/$(RTEMS_BSP)/lib \
		--includedir=$(exec_prefix)/$(RTEMS_BSP)/lib/include
	make 
	make install

SQLite "Almalgamates" the source code before building, which can complicate finding required configuration changes, so using --disable-amalgamate seems to make it easier to find where needed changes are.

An existing demo that may be helpful for making a demo package looks to be the Network File System demo, network-demos/nfsClient, because SQLite's OS initialization uses a file system, and nfsClient has a file system.

So far, one of the first major porting issues I've found was the OS backend -- copying os_unix to os_rtems, and finding the corresponding rtems structures seems like a reasonable next step. C Rempel is currently working on porting the OpenLDAP testsuite to RTEMS, so if this looks interesting...

Haven't gotten any farther, but I thought that was rather interesting...

References