嵌入式数据库--SQLite简单应用(二)--移植到开发板

来源:互联网 发布:华为数据恢复 编辑:程序博客网 时间:2024/05/21 14:08

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]# makearm-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     sysbin             linux_examples  sbin            tmpdev             linuxrc         sqlite          tslibetc             proc            stu.db          usrbash-4.0# arm-linux-gccbash: arm-linux-gcc: command not foundbash-4.0# ./sqlite "select * from stu"column=2baihaowen       1001column=2anjincang       1002pos = 0name    numbaihaowen       1001anjincang       1002bash-4.0# ./sqlite "insert into stu values(\"xiaoming\",\"1003\");"pos = 3name    numbaihaowen       1001anjincang       1002xiaoming        1003bash-4.0#

ok!

原创粉丝点击