移植 SQLite version 3.21.0 到 ARM, LINUX环境中

前端之家收集整理的这篇文章主要介绍了移植 SQLite version 3.21.0 到 ARM, LINUX环境中前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1. 去sqlite官网下载最新的版本 http://www.sqlite.org/download.html,


2.进入到我的 root@x-desktop:/work/Work_Sorce_Code# 目录下用 mkdir sqlite 命令新建一个文件夹。

3. 复制下载的源码文件sqlite目录下,然后解压:

root@x-desktop:/work/Work_Sorce_Code/sqlite# ls
sqlite-autoconf-3210000.tar.gz
root@x-desktop:/work/Work_Sorce_Code/sqlite# tar xvf sqlite-autoconf-3210000.tar.gz 
sqlite-autoconf-3210000/
sqlite-autoconf-3210000/compile
sqlite-autoconf-3210000/config.guess
sqlite-autoconf-3210000/configure
sqlite-autoconf-3210000/sqlite3ext.h
sqlite-autoconf-3210000/aclocal.m4
sqlite-autoconf-3210000/install-sh
sqlite-autoconf-3210000/depcomp
sqlite-autoconf-3210000/sqlite3.c
sqlite-autoconf-3210000/INSTALL
sqlite-autoconf-3210000/sqlite3.pc.in
sqlite-autoconf-3210000/missing
sqlite-autoconf-3210000/Makefile.am
sqlite-autoconf-3210000/config
4.解压完成后在 sqlite目录下用命令mkdir install新建一个install目录,用来存放编译之后可执行文件与库,
当前的sqlite目录下有如下文件
root@x-desktop:/work/Work_Sorce_Code/sqlite# ls
install  sqlite-autoconf-3210000  sqlite-autoconf-3210000.tar.gz
5.进入到sqlite-autoconf-3210000 目录下进行配置编译:


root@x-desktop:/work/Work_Sorce_Code/sqlite# cd sqlite-autoconf-3210000
root@x-desktop:/work/Work_Sorce_Code/sqlite/sqlite-autoconf-3210000# ls
aclocal.m4  config.guess  configure     depcomp  install-sh  Makefile.am  Makefile.msc  README.txt  shell.c    sqlite3.c     sqlite3.h      sqlite3.rccompile     config.sub    configure.ac  INSTALL  ltmain.sh   Makefile.in  missing       Replace.cs  sqlite3.1  sqlite3ext.h  sqlite3.pc.in  tea
root@x-desktop:/work/Work_Sorce_Code/sqlite/sqlite-autoconf-3210000# ./configure --host=arm-linux CC=/home/pub/arm-linux-gcc-3.4.1/bin/arm-linux-gcc --prefix=/work/Work_Sorce_Code/sqlite/install
root@x-desktop:/work/Work_Sorce_Code/sqlite/sqlite-autoconf-3210000# make
root@x-desktop:/work/Work_Sorce_Code/sqlite/sqlite-autoconf-3210000# make install
root@x-desktop:/work/Work_Sorce_Code/sqlite/sqlite-autoconf-3210000# cd ../install/
root@x-desktop:/work/Work_Sorce_Code/sqlite/install# ls
bin include lib share
root@x-desktop:/work/Work_Sorce_Code/sqlite/install# cd bin
root@x-desktop:/work/Work_Sorce_Code/sqlite/install/bin# ls
sqlite3
root@x-desktop:/work/Work_Sorce_Code/sqlite/install/bin# /home/pub/arm-linux-gcc-3.4.1/bin/arm-linux-strip sqlite3 sqlite3
root@x-desktop:/work/Work_Sorce_Code/sqlite/install/bin# cd ../lib/
root@x-desktop:/work/Work_Sorce_Code/sqlite/install/lib# ls
libsqlite3.a  libsqlite3.la  libsqlite3.so  libsqlite3.so.0  libsqlite3.so.0.8.6  pkgconfig
root@x-desktop:/work/Work_Sorce_Code/sqlite/install/lib# /home/pub/arm-linux-gcc-3.4.1/bin/arm-linux-strip libsqlite3.so.0.8.6 libsqlite3.so.0.8.6

6.最后把bin目录下的sqlite可执行文件复制到Linux的 /bin 目录下,把libsqlite3.so.0.8.6 复制到 Linux的 /lib目录下,

然后进入arm中的Linux的/lib目录下执行以下命令:

# ln -s libsqlite3.so.0.8.6 libsqlite3.so.0
#
# ln -s libsqlite3.so.0.8.6 libsqlite3.so 
#
# ls -l
-rwxr-xr-x  1 root   root    503337 Jan 29 18:03 gdbserver
lrwxrwxrwx  1 root   root      19 Jan 30 16:09 libsqlite3.so -> libsqlite3.so.0.8.6
lrwxrwxrwx  1 root   root      19 Jan 30 16:09 libsqlite3.so.0 -> libsqlite3.so.0.8.6
-rwxr-xr-x  1 root   root    675460 Jan 30 01:31 libsqlite3.so.0.8.6
然后在arm Linux 终端中执行sqlite可执行文件,得到如下结果就证明移植成功了:
# ./sqlite3
sqlite version 3.21.0 2017-10-24 18:55:49
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite>

猜你在找的Sqlite相关文章