打印

SQLite 在 arm-linux的移植

[复制链接]
347|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
一,交叉编译器:

arm-linux-gcc-4.5.1

二、移植步骤

下载源码

http://www.sqlite.org/2013/sqlite-autoconf-3080100.tar.gz

1.在home/broadon/sqlite1下解压文件

tar xzf sqlite-autoconf-3080100.tar.gz

2.解压后会有一个新生成的文件夹sqlite-autoconf-3080100,进入文件夹

sd sqlite-autoconf-3080100

3.创建一个目录_install并进入该目录,用于在这个目录中进行交叉编译,如下:

       mkdir _install

       cd _install

4.在_install目录中运行sqlite3.8.1中的configure脚本生成Makefile文件

../configure --host=arm-linux--prefix=home/broadon/sqlite1/_install

注意configure前有两个..

       选项host指定的是用arm交叉编译器(非交叉环境不用指定)进行编译

选项prefix后面的路径是到时候编译安装后目标存放的目录

5.执行make,(时间较长需要等一下)

make

[root@austgl _install]# ml]# make  /bin/sh ./libtool --tag=CC   --mode=compile arm-linux-gcc -DPACKAGE_NAME=\"sqlite\" -DPACKAGE_TARNAME=\"sqlite\" -DPACKAGE_VERSION=\"3.8.1\" -DPACKAGE_STRING=\"sqlite\ 3.8.1\" -DPACKAGE_BUGREPORT=\"http://www.sqlite.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"sqlite\" -DVERSION=\"3.8.1\" -D_FILE_OFFSET_BITS=64 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_FDATASYNC=1 -DHAVE_USLEEP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DHAVE_DECL_STRERROR_R=1 -DHAVE_STRERROR_R=1 -DHAVE_POSIX_FALLOCATE=1 -I. -I..    -D_REENTRANT=1 -DSQLITE_THREADSAFE=1  -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE -g -O2 -MT sqlite3.lo -MD -MP -MF .deps/sqlite3.Tpo -c -o sqlite3.lo ../sqlite3.c  libtool: link: arm-linux-gcc -D_REENTRANT=1 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_RTREE -g -O2 -o .libs/sqlite3 shell.o  ./.libs/libsqlite3.so -ldl -lpthread -Wl,-rpath -Wl,/home/gl/e/sqlite3.8.1/_install/lib  [root@austgl _install]# ls  config.log  config.status  libsqlite3.la  libtool  Makefile  shell.o  sqlite3  sqlite3.lo  sqlite3.o  sqlite3.pc

6.执行make install

make install

root@austgl _install]# make install  make[1]: 进入目录“/home/gl/e/sqlite3.8.1/_install”   /usr/bin/mkdir -p '/home/gl/e/sqlite3.8.1/_install/lib'   /bin/sh ./libtool   --mode=install /usr/bin/install -c   libsqlite3.la '/home/gl/e/sqlite3.8.1/_install/lib'  libtool: install: /usr/bin/install -c .libs/libsqlite3.so.0.8.6 /home/gl/e/sqlite3.8.1/_install/lib/libsqlite3.so.0.8.6  libtool: install: (cd /home/gl/e/sqlite3.8.1/_install/lib && { ln -s -f libsqlite3.so.0.8.6 libsqlite3.so.0 || { rm -f libsqlite3.so.0 && ln -s libsqlite3.so.0.8.6 libsqlite3.so.0; }; })  libtool: install: (cd /home/gl/e/sqlite3.8.1/_install/lib && { ln -s -f libsqlite3.so.0.8.6 libsqlite3.so || { rm -f libsqlite3.so && ln -s libsqlite3.so.0.8.6 libsqlite3.so; }; })  libtool: install: /usr/bin/install -c .libs/libsqlite3.lai /home/gl/e/sqlite3.8.1/_install/lib/libsqlite3.la  libtool: install: /usr/bin/install -c .libs/libsqlite3.a /home/gl/e/sqlite3.8.1/_install/lib/libsqlite3.a  libtool: install: chmod 644 /home/gl/e/sqlite3.8.1/_install/lib/libsqlite3.a  libtool: install: arm-linux-ranlib /home/gl/e/sqlite3.8.1/_install/lib/libsqlite3.a  libtool: finish: PATH="/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/local/sbin:/usr/sbin:/home/gl/.local/bin:/home/gl/bin:/home/gl/e/4.4.3/bin:/home/gl/e/arm-2013.05:/sbin" ldconfig -n /home/gl/e/sqlite3.8.1/_install/lib  ldconfig: /home/gl/e/sqlite3.8.1/_install/lib/libsqlite3.so.0.8.6 is for unknown machine 40.    ldconfig: /home/gl/e/sqlite3.8.1/_install/lib/libsqlite3.so is for unknown machine 40.    ldconfig: /home/gl/e/sqlite3.8.1/_install/lib/libsqlite3.so.0 is for unknown machine 40.    ----------------------------------------------------------------------  Libraries have been installed in:     /home/gl/e/sqlite3.8.1/_install/lib    If you ever happen to want to link against installed libraries  in a given directory, LIBDIR, you must either use libtool, and  specify the full pathname of the library, or use the `-LLIBDIR'  flag during linking and do at least one of the following:     - add LIBDIR to the `LD_LIBRARY_PATH' environment variable       during execution     - add LIBDIR to the `LD_RUN_PATH' environment variable       during linking     - use the `-Wl,-rpath -Wl,LIBDIR' linker flag     - have your system administrator add LIBDIR to `/etc/ld.so.conf'    See any operating system documentation about shared libraries for  more information, such as the ld(1) and ld.so(8) manual pages.  ----------------------------------------------------------------------   /usr/bin/mkdir -p '/home/gl/e/sqlite3.8.1/_install/bin'    /bin/sh ./libtool   --mode=install /usr/bin/install -c sqlite3 '/home/gl/e/sqlite3.8.1/_install/bin'  libtool: install: /usr/bin/install -c .libs/sqlite3 /home/gl/e/sqlite3.8.1/_install/bin/sqlite3   /usr/bin/mkdir -p '/home/gl/e/sqlite3.8.1/_install/include'   /usr/bin/install -c -m 644 ../sqlite3.h ../sqlite3ext.h '/home/gl/e/sqlite3.8.1/_install/include'   /usr/bin/mkdir -p '/home/gl/e/sqlite3.8.1/_install/share/man/man1'   /usr/bin/install -c -m 644 ../sqlite3.1 '/home/gl/e/sqlite3.8.1/_install/share/man/man1'   /usr/bin/mkdir -p '/home/gl/e/sqlite3.8.1/_install/lib/pkgconfig'   /usr/bin/install -c -m 644 sqlite3.pc '/home/gl/e/sqlite3.8.1/_install/lib/pkgconfig'  make[1]: 离开目录“/home/gl/e/sqlite3.8.1/_install”  

7.编译和安装完后,在/home/gl/e/sqlite3.8.1/_install目录中会生成四个文件夹,分别是:bin、include、lib share,

将bin下的文件下载到开发板的/bin目录中,

lib下的所有文件下载到开发板的/lib目录中即可。

include 头文件拷贝到 交叉编译器的 include目录下。

8.在开发板上测试移植的sqlite数据库。

执行: #sqlite3

     显示版本信息



[root@EmbedSky /]# sqlite3  SQLite version 3.8.1 2013-10-17 12:57:35  Enter ".help" for instructions  Enter SQL statements terminated with a ";"  sqlite>   



需要修改开发板sqlite3的权限使其变成可执行文件。chmod 777 sqlite3

使用特权

评论回复

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

384

主题

384

帖子

0

粉丝