UBUNTU 10.04环境下交叉编译sqlite3.20.1源码

来源:互联网 发布:windows下安装mysql 编辑:程序博客网 时间:2024/05/14 22:44
1、下载 SQLite3源码
地址:http://www.sqlite.org/download.html
完整版: sqlite-src-3200100.zip (PS: sqlite-autoconf-3200100.tar.gz可以直接configure编译通过, 这里下载完整版编译是为了比较产生的sqlite3.c文件之间的差异)


2、编译
2.1 解码
 cd 
 cd rookie
 mkdir 3.20.1-full
 cp 源码目录/sqlite-src-3200100.zip ./3.20.1-full
 unzip -x sqlite-src-3200100.zip 


2.2 配置
 然后,在unzip出来的源码目录中
 mkdir ../install                                        #创建安装目录
 ./configure --disable-tcl --host=arm-none-linux-gnueabi --prefix=/coral/rookie/3.20.1-full/install


其中,
    --host: 指定交叉编译工具,一般为arm-linux、arm-linux-gnueabihf、arm-none-linux-gnueabi等,具体要和板子用的交叉编译工具对应。
    --prefix: 指定安装目录,编译后的文件会全部放在安装目录中。必须是绝对路径




2.3 编译
make


报告如下错误:
tclsh /coral/rookie/3.20.1-full/tool/mksqlite3h.tcl /coral/rookie/3.20.1-full >sqlite3.h
gcc  -g -o mkkeywordhash   /coral/rookie/3.20.1-full/tool/mkkeywordhash.c
./mkkeywordhash >keywordhash.h
gcc  -g -o lemon /coral/rookie/3.20.1-full/tool/lemon.c
cp /coral/rookie/3.20.1-full/tool/lempar.c .
cp /coral/rookie/3.20.1-full/src/parse.y .
rm -f parse.h
./lemon   parse.y
mv parse.h parse.h.temp
tclsh /coral/rookie/3.20.1-full/tool/addopcodes.tcl parse.h.temp >parse.h
illegal access mode "rb"
    while executing
"open [lindex $argv 0] rb"
    invoked from within
"set in [open [lindex $argv 0] rb]"
    (file "/coral/rookie/3.20.1-full/tool/addopcodes.tcl" line 9)
make: *** [parse.c] 错误 1


2.4 错误分析
 检查ubuntu10.04的环境,确认tcl/tk没有安装




3.安装tcl
3.1 参考博文:ubuntu12.04.4安装tcl/tk和Tkinter( http://blog.csdn.net/cryhelyxx/article/details/22514871 )
 ./configure
 make
报告#pragma GCC错误,按以下方式解决:


3.2 参考博文: http://blog.chinaunix.net/uid-31343710-id-5758107.html ( 貌似是编译器版本太低了,所以我直接将cJSON_AddItemToObjectCS函数中的#pragma GCC注释掉了,没有任何影响 )
 注释掉#pragma GCC,编译通过
 make
 make install


4.再次编译sqlite3.20.1,通过
原创粉丝点击