[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sqlite on devboard82




Hi,
    I'm using sqlite with an Axis 82 devboard without problems. Attached 
there is the makefile I use to compile 2.8.13 version.

Daniel Würfel wrote:

>Has anybody gained experience with sqlite? Has anybody a working Makefile?
>I tried to compile it, but I got some errors.
>It seems that a binary created by cris-gcc should be executed and this doesen't work.
>Thanks in advance,
>Daniel
>
>checking for library containing Tcl_Init... no
>checking TCL header files... not specified: still searching...
>checking tcl.h usability... no
>checking tcl.h presence... no
>checking for tcl.h... no
>checking for /usr/local/include/tcl.h...
>../configure: line 20030: test: =: unary operator expected
>checking for /usr/X11/include/tcl.h...
>../configure: line 20030: test: =: unary operator expected
>checking for /usr/X11R6/include/tcl.h...
>../configure: line 20030: test: =: unary operator expected
>checking for /usr/pkg/include/tcl.h...
>../configure: line 20030: test: =: unary operator expected
>checking for /usr/contrib/include/tcl.h...
>../configure: line 20030: test: =: unary operator expected
>checking for /usr/include/tcl.h...
>../configure: line 20030: test: =: unary operator expected
>checking for library containing tgetent... no
>checking for readline in -lreadline... no
>checking readline header files... not specified: still searching...
>checking readline.h usability... no
>checking readline.h presence... no
>checking for readline.h... no
>checking for /usr/include/readline.h...
>../configure: line 20437: test: =: unary operator expected
>checking for /usr/include/readline/readline.h...
>../configure: line 20463: test: =: unary operator expected
>checking for /usr/local/include/readline.h...
>../configure: line 20437: test: =: unary operator expected
>checking for /usr/local/include/readline/readline.h...
>../configure: line 20463: test: =: unary operator expected
>checking for /usr/local/readline/include/readline.h...
>../configure: line 20437: test: =: unary operator expected
>checking for /usr/local/readline/include/readline/readline.h...
>../configure: line 20463: test: =: unary operator expected
>checking for /usr/contrib/include/readline.h...
>../configure: line 20437: test: =: unary operator expected
>checking for /usr/contrib/include/readline/readline.h...
>../configure: line 20463: test: =: unary operator expected
>checking for /mingw/include/readline.h...
>../configure: line 20437: test: =: unary operator expected
>checking for /mingw/include/readline/readline.h...
>../configure: line 20463: test: =: unary operator expected
>checking for usleep... yes
>configure: creating ./config.status
>config.status: creating Makefile
>config.status: creating sqlite3.pc
>make -C sqlite/build
>make[2]: Entering directory `/var/axis/axis/devboard_82/apps/database/sqlite/build'
>sed -e s/--VERS--/`cat ../VERSION`/ \
>                 ../src/sqlite.h.in >sqlite3.h
>echo '#include <stdio.h>' >temp.c
>echo 'int main(){printf(' >>temp.c
>echo '"#define SQLITE_PTR_SZ %d",sizeof(char*));' >>temp.c
>echo 'exit(0);}' >>temp.c
>gcc-cris  -isystem /var/axis/axis/devboard_82/target/cris-axis-linux-gnu/include -mlinux -g -O2 -o temp temp.c
>./temp >config.h
>/bin/sh: line 1: ./temp: cannot execute binary file
>make[2]: *** [config.h] Error 126
>make[2]: Leaving directory `/var/axis/axis/devboard_82/apps/database/sqlite/build'
>make[1]: *** [buildsqlite] Error 2
>make[1]: Leaving directory `/var/axis/axis/devboard_82/apps/database'
>make: *** [install-recurse] Error 1
>[root@localhost devboard_82]#
>_________________________________________________________
>Mit WEB.DE FreePhone® mit höchster Qualität ab 0 Ct./Min.
>weltweit telefonieren! http://freephone.web.de/?mc=021201
>
>
>  
>

-- 
Daniel Fraile i Vergel
W-onesys, SL
WDM Optical NEtworks SYStems
c/ Francesc Vila Nave 11, Poligon Industrial Can Magi
08190 Sant Cugat del Vallés (Barcelona) - SPAIN
Tel. + 34 93 590 11 49
fax  + 34 93 590 11 57
www.w-onesys.com

AXIS_USABLE_LIBS = UCLIBC GLIBC

AXIS_TOP_DIR = /home/daniel/axis/devboard_82
AXIS_KERNEL_DIR = /home/daniel/axis/devboard_82/os/linux

# Set VERBOSE_FRAG to nothing to print that stuff if you want it,
# it clutters up the screen so it's @xxxxxxx.
VERBOSE_FRAG = @
makefrag_name = .target-makefrag

include $(AXIS_TOP_DIR)/tools/build/Rules.axis

PROGS = sqlite
#### The toplevel directory of the source tree.  This is the directory
#    that contains this "Makefile.in" and the "configure.in" script.
#
TOP = $(AXIS_TOP_DIR)/apps/sqlite

AR=ar r
RANLIB= /usr/bin/ranlib

#### If the target operating system supports the "usleep()" system
#    call, then define the HAVE_USLEEP macro for all C modules.
#
#USLEEP = 
USLEEP = -DHAVE_USLEEP=1

#### If you want the SQLite library to be safe for use within a 
#    multi-threaded program, then define the following macro
#    appropriately:
#
THREADSAFE = -DTHREADSAFE=1
#THREADSAFE = -DTHREADSAFE=0

#### Specify any extra linker options needed to make the library
#    thread safe
#
# THREADLIB = -lpthread

#### Leave MEMORY_DEBUG undefined for maximum speed.  Use MEMORY_DEBUG=1
#    to check for memory leaks.  Use MEMORY_DEBUG=2 to print a log of all
#    malloc()s and free()s in order to track down memory leaks.
#    
#    SQLite uses some expensive assert() statements in the inner loop.
#    You can make the library go almost twice as fast if you compile
#    with -DNDEBUG=1
#
#OPTS = -DMEMORY_DEBUG=2
#OPTS = -DMEMORY_DEBUG=1
#OPTS = 
OPTS = -DNDEBUG=1

# #### The suffix to add to executable files.  ".exe" for windows.
# #    Nothing for unix.
# #
# #EXE = .exe
# EXE =

# #### C Compile and options for use in building executables that 
# #    will run on the target platform.  This is usually the same
# #    as BCC, unless you are cross-compiling.
# #
# TCC = $(CC) $(CFLAGS)
# 
# #### C Compiler and options for use in building executables tha
# #    will run on the platform that is doing the build.
#BCC = $(CC) $(CFLAGS)
BCC = gcc -g -O2
# 
# #### Extra compiler options needed for programs that use the TCL library.
# #
# TCL_FLAGS =
# #TCL_FLAGS = -DSTATIC_BUILD=1
# 
# #### Linker options needed to link against the TCL library.
# #
# #LIBTCL = -ltcl -lm -ldl
# LIBTCL = 
# #### Compiler options needed for programs that use the readline() library.
# #
# #READLINE_FLAGS =
# READLINE_FLAGS = -DHAVE_READLINE=1 -I/usr/include/readline
# 
# #### Linker options needed by programs using readline() must link against.
# #
# #LIBREADLINE =
# LIBREADLINE = -static -lreadline -ltermcap

#### Should the database engine assume text is coded as UTF-8 or iso8859?
#
# ENCODING  = UTF8
ENCODING = ISO8859

LIB_MAJOR = 2
LIB_MINOR = 8.13
SHARED_LIB_NAME = sqlite
LIB_EXT = .so.$(LIB_MAJOR).$(LIB_MINOR)

CFLAGS = -fPIC -g -o2 -Wall $(THREADSAFE) $(USLEEP) $(OPTS) -I.
LDFLAGS = -L$(AXIS_TOP_DIR)/apps/sqlite -lpthread -lsqlite

# Object files for the SQLite library.
#
LIB_OBJS = attach.o auth.o btree.o btree_rb.o build.o copy.o date.o delete.o \
         expr.o func.o hash.o insert.o \
         main.o opcodes.o os.o pager.o parse.o pragma.o printf.o random.o \
         select.o table.o tokenize.o trigger.o update.o util.o \
         vacuum.o vdbe.o vdbeaux.o where.o 
#        tclsqlite.o

# All of the source code files.
# SRC = $(TOP)/attach.c $(TOP)/auth.c $(TOP)/btree.c $(TOP)/btree.h $(TOP)/btree_rb.c $(TOP)/build.c $(TOP)/copy.c \
#       $(TOP)/date.c $(TOP)/delete.c $(TOP)/expr.c $(TOP)/func.c $(TOP)/hash.c $(TOP)/hash.h $(TOP)/insert.c \
#       $(TOP)/main.c $(TOP)/os.c $(TOP)/pager.c $(TOP)/pager.h $(TOP)/parse.y $(TOP)/pragma.c $(TOP)/printf.c \
#       $(TOP)/random.c $(TOP)/select.c $(TOP)/shell.c $(TOP)/sqlite.h.in $(TOP)/sqliteInt.h $(TOP)/table.c \
#       $(TOP)/tclsqlite.c $(TOP)/tokenize.c $(TOP)/trigger.c $(TOP)/update.c $(TOP)/util.c $(TOP)/vacuum.c \
#       $(TOP)/vdbe.c $(TOP)/vdbe.h $(TOP)/vdbeaux.c $(TOP)/vdbeInt.h $(TOP)/where.c

# Header files used by all library source files.
HDR = sqlite.h $(TOP)/btree.h config.h $(TOP)/hash.h opcodes.h $(TOP)/os.h $(TOP)/sqliteInt.h $(TOP)/vdbe.h \
   parse.h

# Header files used by the VDBE submodule
VDBEHDR = $(HDR) $(TOP)/vdbeInt.h

all: sqlite.h config.h build-shared $(PROGS)

sqlite: $(TOP)/shell.c libsqlite.a sqlite.h
	$(CC) $(CFLAGS) $(LDFLAGS) -o sqlite $(TOP)/shell.c

attach.o:	$(TOP)/attach.c $(HDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

auth.o:	$(TOP)/auth.c $(HDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

btree.o:	$(TOP)/btree.c $(HDR) $(TOP)/pager.h
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

btree_rb.o:	$(TOP)/btree_rb.c $(HDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

build.o:	$(TOP)/build.c $(HDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

copy.o:	$(TOP)/copy.c $(HDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

date.o:	$(TOP)/date.c $(HDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

delete.o:	$(TOP)/delete.c $(HDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

expr.o:	$(TOP)/expr.c $(HDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

func.o:	$(TOP)/func.c $(HDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

hash.o:	$(TOP)/hash.c $(HDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

insert.o:	$(TOP)/insert.c $(HDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

main.o:	$(TOP)/main.c $(HDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

opcodes.o:	opcodes.c
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

opcodes.c:	$(TOP)/vdbe.c
	echo '/* Automatically generated file.  Do not edit */' >opcodes.c
	echo 'char *sqliteOpcodeNames[] = { "???", ' >>opcodes.c
	grep '^case OP_' $(TOP)/vdbe.c | \
	  sed -e 's/^.*OP_/  "/' -e 's/:.*$$/", /' >>opcodes.c
	echo '};' >>opcodes.c

opcodes.h:	$(TOP)/vdbe.h
	echo '/* Automatically generated file.  Do not edit */' >opcodes.h
	grep '^case OP_' $(TOP)/vdbe.c | \
	  sed -e 's/://' | \
	  awk '{printf "#define %-30s %3d\n", $$2, ++cnt}' >>opcodes.h

os.o:	$(TOP)/os.c $(HDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c
	
pager.o:	$(TOP)/pager.c $(HDR) $(TOP)/pager.h
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

parse.o:	parse.c $(HDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

parse.h:	parse.c

parse.c:	$(TOP)/parse.y lemon
# 	cp $(TOP)/parse.y .
	./lemon parse.y

pragma.o:	$(TOP)/pragma.c $(HDR)
	$(CC) $(CFLAGS) $(TCL_FLAGS) -c -o $@xxxxxxx.c

printf.o:	$(TOP)/printf.c $(HDR)
	$(CC) $(CFLAGS) $(TCL_FLAGS) -c -o $@xxxxxxx.c

random.o:	$(TOP)/random.c $(HDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

select.o:	$(TOP)/select.c $(HDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

table.o:	$(TOP)/table.c $(HDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

tokenize.o:	$(TOP)/tokenize.c $(HDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

trigger.o:	$(TOP)/trigger.c $(HDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

update.o:	$(TOP)/update.c $(HDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

util.o:	$(TOP)/util.c $(HDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

vacuum.o:	$(TOP)/vacuum.c $(HDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

vdbe.o:	$(TOP)/vdbe.c $(VDBEHDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

vdbeaux.o: $(TOP)/vdbeaux.c $(VDBEHDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

where.o: $(TOP)/where.c $(HDR)
	$(CC) $(CFLAGS) -c -o $@xxxxxxx.c

# tclsqlite.o: $(TOP)/tclsqlite.c $(HDR)
# 	$(CC) $(CFLAGS) $(TCL_FLAGS) -c $(TOP)/tclsqlite.c

# Rules to build the LEMON compiler generator
#
lemon: $(TOP)/tool/lemon.c $(TOP)/tool/lempar.c
	$(BCC) -o lemon $(TOP)/tool/lemon.c
	cp $(TOP)/tool/lempar.c .

# The config.h file will contain a single #define that tells us how
# many bytes are in a pointer.  This only works if a pointer is the
# same size on the host as it is on the target.  If you are cross-compiling
# to a target with a different pointer size, you'll need to manually
# configure the config.h file. gcc-cris: sizeof(char*)=4
#
config.h:
	echo '#include <stdio.h>' > temp.c
	echo 'int main(){printf(' >> temp.c
	echo '"#define SQLITE_PTR_SZ %d",sizeof(char*));' >> temp.c
	echo 'exit(0);}' >> temp.c
	$(BCC) -o temp temp.c
	./temp > config.h
	echo >> config.h
	rm -f temp.c temp
	
sqlite.h: $(TOP)/sqlite.h.in 
	sed -e s/--VERS--/`cat ${TOP}/VERSION`/ -e s/--ENCODING--/$(ENCODING)/ $(TOP)/sqlite.h.in > sqlite.h

lib$(SHARED_LIB_NAME).a: $(LIB_OBJS)
	$(AR) $@ $(LIB_OBJS)
	$(RANLIB) $@

clean:
	rm -f core ${LIB_OBJS}; rm -f lib$(SHARED_LIB_NAME).a; rm -f lib$(SHARED_LIB_NAME)$(LIB_EXT)
	rm -f lib$(SHARED_LIB_NAME).so.$(LIB_MAJOR); rm -f lib$(SHARED_LIB_NAME).so
	rm -f *.o sqlite sqlite.h opcodes.*; rm -f lemon lempar.c parse.c parse.h

build-shared: lib$(SHARED_LIB_NAME).a do-linux-share link-shared
	
$(SHARED_LIB_NAME).$(LIB_EXT): build-shared

do-linux-share: lib$(SHARED_LIB_NAME).a
	${CC} -lpthread -shared -o lib$(SHARED_LIB_NAME).so.${LIB_MAJOR}.${LIB_MINOR} -Wl,-soname=lib$(SHARED_LIB_NAME).so.${LIB_MAJOR}.${LIB_MINOR} $(LIB_OBJS)

link-shared:
	rm -f lib$(SHARED_LIB_NAME).so.$(LIB_MAJOR); ln -s lib$(SHARED_LIB_NAME)$(LIB_EXT) lib$(SHARED_LIB_NAME).so.$(LIB_MAJOR);
	rm -f lib$(SHARED_LIB_NAME).so; ln -s lib$(SHARED_LIB_NAME)$(LIB_EXT) lib$(SHARED_LIB_NAME).so;

lib$(SHARED_LIB_NAME).so.$(LIB_MAJOR).$(LIB_MINOR): build-shared

ifeq ($(AXIS_SHARE_LIBS), yes)
PERM = -m 0755
else
PERM = -m 0644
endif

INSTDIR   = $(prefix)/usr/lib
INSTDIRBIN = $(prefix)/bin
INSTMODE  = 0755
INSTOWNER = root
INSTGROUP = root

install: all
	$(INSTALL) -d $(INSTDIR)
	$(INSTALL) $(PERM) lib$(SHARED_LIB_NAME)$(LIB_EXT) $(INSTDIR)/lib$(SHARED_LIB_NAME)$(LIB_EXT)
	$(INSTALL) -d $(INSTDIRBIN)
	$(INSTALL) -m $(INSTMODE) -o $(INSTOWNER) -g $(INSTGROUP) $(PROGS) $(INSTDIRBIN)
	
images: install
	(cd $(AXIS_TOP_DIR); $(MAKE) images)
	
flash: images
	(cd $(AXIS_TOP_DIR); . ./flashit )
	
ktest: images
	(cd $(AXIS_TOP_DIR); . ./ktest )

cris:
	$(VERBOSE_FRAG)echo AXIS_BUILDTYPE=cris-axis-linux-gnu > $(makefrag_name)

no-cris:
	$(VERBOSE_FRAG)echo AXIS_BUILDTYPE=host > $(makefrag_name)