在linux下安裝sqlite
linux平臺:CentOS
Sqlite版本:sqlite-3.5.6
1.源碼安裝步驟如下:
1)wget http://www.sqlite.org/sqlite-3.5.6.tar.gz
2)tar -xzvf sqlite-3.5.6.tar.gz
3)cd sqlite-3.5.6
4)./configure --disable-tcl ##加上這個選項則不需要TCL,否則在2.4內核上編譯通不過
5)make
6)make install
另外:
如果make的時候提示錯誤
../sqlite-3.5.1/src/tclsqlite.c:2424: error: syntax error before '*' token
../sqlite-3.5.1/src/tclsqlite.c: In function `Tclsqlite_SafeInit':
../sqlite-3.5.1/src/tclsqlite.c:2424: error: `TCL_OK' undeclared (first use in this function)
../sqlite-3.3.5/src/tclsqlite.c: In function `DbUpdateHandler':
../sqlite-3.3.5/src/tclsqlite.c:333: warning: passing arg 3 of `Tcl_ListObjAppendElement' makes pointer from integer without a cast
../sqlite-3.3.5/src/tclsqlite.c: In function `tclSqlFunc':
../sqlite-3.3.5/src/tclsqlite.c:419: warning: passing arg 1 of `Tcl_NewByteArrayObj' discards qualifiers from pointer target type
這個都是tcl相關的錯誤,可以先安裝ActiveTcl以解決.假如你不需要tcl支持,那麼這個錯誤可以這樣避免: .
/configure --help 看一下就知道了。可以 加上 --disable-tcl 選項
2.測試是否安裝成功
# cd /usr/lcoal/sqlite-3.5.6
# ./sqlite3 text.db
如果安裝成功,會出現下面這樣的信息
SQLite version 3.5.6
Enter ".help" for instructions
sqlite>