1,设置好交叉编译环境(这里不讲了)
2,进入sqlite3目录
./configure --host=arm-linux --disable-tcl
make
3,进入.libs/
拷贝libsqlite3.a sqlite3.h 到sqlite工程目录
4,修改Makefile
all:
arm-linux-gcc -o sqlite sqlite.c -g -lsqlite3 -L. -I. -lpthread
5,编译嵌入式数据库--SQLite简单应用(一)的代码
[root@localhost sqlite]# make
arm-linux-gcc -o sqlite sqlite.c -g -lsqlite3 -L. -I. -lpthread
[root@localhost sqlite]# ll
总计 1760
-rwxrwxrwx 1 root root 1760662 12-05 15:04 libsqlite3.a
-rwxrwxrwx 1 root root 70 12-05 15:25 Makefile
-rwxrwxrwx 1 root root 1510933 12-05 16:14 sqlite
-rwxrwxrwx 1 root root 324759 12-05 15:04 sqlite3.h
-rwxrwxrwx 1 root root 1260 2008-04-24 sqlite.c
-rwxrwxrwx 1 root root 2048 2008-04-24 stu.db
1.5m比较大。
6,去除程序中的符号
[root@localhost sqlite]# arm-linux-strip sqlite
去除后得475k
7,下载到开发板上
Qtopia lib qt_exmaples sys
bin linux_examples sbin tmp
dev linuxrc sqlite tslib
etc proc stu.db usr
bash-4.0# arm-linux-gcc
bash: arm-linux-gcc: command not found
bash-4.0# ./sqlite "select * from stu"
column=2
baihaowen 1001
column=2
anjincang 1002
pos = 0
name num
baihaowen 1001
anjincang 1002
bash-4.0# ./sqlite "insert into stu values(\"xiaoming\",\"1003\");"
pos = 3
name num
baihaowen 1001
anjincang 1002
xiaoming 1003
bash-4.0#
ok!