mini6410下移植sqlite3.7.6.3

1、 下载SQLite 3.7.6.3,http://www.sqlite.org/sqlite-autoconf-3070603.tar.gz
2 、 解压到某个文件夹下
3 、 配置,这里安装到当前文件夹下的sqlite下
./configure CC=/usr/local/arm/4.4.1/bin/arm-linux-gcc  –prefix=./sqlite --disable-tcl --host=arm-linux
4 、make&&make install
    在sqlite下生成bin include lib share文件
5 、进入bin文件,执行arm-linux-strip  sqlite3
6 、将bin文件下的sqlite3执行文件拷至开发板bin文件下,lib文件夹下的所有文件拷至开发板的/lib文件夹下
7 、./sqlite3 打印如下

SQLite version 3.7.6.3                                                         
Enter ".help" for instructions                                                 
Enter SQL statements terminated with a ";"                                     
sqlite>



8 、编写C测试
hello.c
#include<stdio.h> #include"sqlite3.h" int main(void) { const char *dbfile = "test.db"; sqlite3 *pdb = NULL; int result; if ((result = sqlite3_open(dbfile, &pdb)) != 0) { printf("error: can't open %s/nerrmsg: %s/n", dbfile, sqlite3_errmsg(pdb)); return -1; } else { printf("opened!/n"); } if ((result = sqlite3_close(pdb)) != 0) { printf("error: can't close %s/nerrmsg: %s/n", dbfile, sqlite3_errmsg(pdb)); return -1; } else { printf("closed!/n"); } return 0; }

将编译生成的.so文件拷至hello.c文件夹下
arm-linux-gcc -o  hello{,.c} -L$PWD -lsqlite3
将hello拷至开发板 ./hello
打印:
opened!
closed!
同时生成test.db文件

你可能感兴趣的:(sql,c,sqlite,测试,null,include)