近段时间在学数据库,因为自身需求,所以注重研究了点嵌入式sqlite数据库,
SQLite,是一款轻型的数据库,是遵守ACID的关联式数据库管理系统,它的设计目标是嵌入式的,而且目前已经在很多嵌入式产品中使用了它,
它占用资源非常的低,在嵌入式设备中,可能只需要几百K的内存就够了。它能够支持Windows/Linux/Unix等等主流的操作系统,
同时能够跟很多程序语言相结合,比如 Tcl、C#、PHP、Java等,还有ODBC接口,
同样比起Mysql、PostgreSQL这两款开源世界著名的数据库管理系统来讲,它的处理速度比他们都快。
自我感觉用起来很high的...

就不扯了,下面言归正传:

下面就将sqlite移植到ARM开发板上的具体步骤贴下来,
在移植之前首先需要做的工作一是搭建PC端与ARM端数据共享机制,关于这个的方法很多,我在之前的文章中也就nfs共享的具体步骤做过详细的说明,
这里就不在累赘了。二是搭建交叉编译环境;

检测本机是否已经安装交叉编译环境可在终端中键入#arm-linux-gcc -v进行查看

获取sqlite源码包,源码包可到www.sqlite.org官方网站下载,我在此使用的是sqlite-3.6.18.tar.gz
1.将sqlite-3.6.18.tar.gz解压到/home目录下,并在sqlite-3.6.18目录下建立sqlite-arm-linux目录
#cd /home/sqlite-3.6.18
#mkdir sqlite-arm-linux

2.首先备份configure文件 
#cp configure configure.old
3.修改configure文件,
#./configure --host=arm-linux --disable-tcl --prefix=/home/sqlite-3.6.18/sqlite-arm-linux/
4.修改Makefile文件
BBC = gcc -g -O2 
5.编译并安装
#make && make install
6.为了减小执行文件大小,可用strip处理,去掉其中的调试信息
#cd /home/sqlite-3.6.18/sqlite-arm-linux/bin
#arm-linux-strip sqlite3
7.而后进行移植
对库的拷贝时要加上-arf选项,因为libsqlite3.so, libsqlite3.so.0是链接到libsqlite3.so.0.8.6的
#cd /home/sqlite-3.6.18/sqlite-arm-linux/lib
#cp -arf libsqlite3.so, libsqlite3.so.0, libsqlite3.so.0.8.6 /usr/yang(共享目录)
#cd /home/sqlite-3.6.18/sqlite-arm-linux/bin
#cp sqlite3 /usr/yang(共享目录)
8.在开发板终端中将三个库文件拷贝到其库中,而后即可使用sqlite了。

但要提醒一点的就是,sqlite跟MySQL....有点不一样哟..
我刚开始玩的时候首先就输入了show databases;结果让我很揪心,所以在大家用sqlite之前还是建议先学好用法.

我相信你会在嵌入式数据库中玩的很high的....

-----------------------------------------------------------------------------------------

采用的是sqlite-autoconf-3080002.tar.gz

解压 tar xvf sqlite-autoconf-3080002.tar.gz

进入 cd sqlite-autoconf-3080002/

采用的是 arm-none-linux-gnueabi-gcc(g++)编译。

./configure --host=arm-none-linux-gnueabi --prefix=/home/liukang/sqlite-arm-linux LD=arm-none-linux-gnueabi-ld
 make

make install

生成libsqlite3.a 静态库文件,在/home/liukang/sqlite-arm-linux/lib/ 文件夹下。

./configure --host=arm-none-linux-gnueabi --prefix=/home/liukang/sqlite-arm-linux-so --disable-tcl
 make
 make install

生成四个文件,在/home/liukang/sqlite-arm-linux-so/lib/ 文件夹下:

libsqlite3.la

libsqlite3.so -> libsqlite3.so.0.8.6

libsqlite3.so.0 -> libsqlite3.so.0.8.6

libsqlite3.so.0.8.6

压缩: arm-none-linux-gnueabi-strip libsqlite3.so.0.8.6

cp  libsqlite3.so 到你工程所需的库文件夹下。
cp  libsqlite3.so.0  到ARM板上的/lib/下

cp bin/sqlite3 到ARM板上的/usr/bin/下

编译时 加上  -lsqlite3,用到的是 libsqlite3.so

在ARM板上运行时,将 libsqlite3.so.0 放到 /lib/ 下即可使用动态库。

-------------------------------------------------------------------------------------------

up vote2down votefavorite

Cross compile SQLite for ARM

I am using SQLite 3 for Database management in my ARM9 based microprocessor.

I want to cross compile the latest version of the SQLite 3 for my project in Linux (Ubuntu 10.04). I am using the arm-none-linux-gnueabi-gcc compiler for development.

I tried to cross compile using following commands,

Downloaded the sqlite-amalgamation-3.7.0.tar I extract it and then write the following command on Terminal,

sudo ./configure --exec-prefix=/media/8CCC8E9BCC8E7F68/SQLIte3/sqliteinstall/  --host=arm --target=arm CC=/opt/arm-2011.03/bin/arm-none-linux-gnueabi-gcc AR=/opt/arm-2011.03/bin/arm-none-linux-gnueabi-ar STRIP=/opt/arm-2011.03/bin/arm-none-linux-gnueabi-strip RANLIB=/opt/arm-2011.03/bin/arm-none-linux-gnueabi-ranlib CFLAGS="-Os"

还是老外牛叉 国产大多啰嗦一通 不能用

--target=arm 3.7.12版本已经没有这个选项  按照上面方式不能生成动态库

所以--host=arm --target=arm 改为--host=arm-linux 这样就ok了

--exec-prefix 改为--prefix 不然不生成 include man 文件夹

./configure --prefix=/media/8CCC8E9BCC8E7F68/SQLIte3/sqliteinstall/  --host=arm-linux CC=/opt/arm-2011.03/bin/arm-none-linux-gnueabi-gcc  CFLAGS="-Os" 生成静态的一样大小 动态库 可执行文件比较大 还是上面学全的方式好

(1)--prefix=<目录>:指定Apache的安装目录。

(2)--exec-prefix=<目录>:指定Apache的顶级安装目录,使用该参数时可以配合以下参数将Apache的文件安装到不同的目录,可以方便地在不同主机之间共享Apache相关的文件。该参数的默认值为--prefix参数指定的目录。

It successfully cross compiled the SQLite.

Then,

sudo make

command.

It successfully run. Now make install command.

It did not give me an error but when I went to the config.log file i found there is some sentences as following,

 1.conftest.c:17:7: error: size of array 'off_t_is_large' is negative2.conftest.c:12:28: fatal error: ac_nonexistent.h: No such file or directory
compilation terminated.3.conftest.cpp:23:28: error: ac_nonexistent.h: No such file or directory4.conftest.c:67:13: error: invalid type argument of unary '*' (have 'int')

I doubt that weather it has been cross compiled properly or not. I can not understand.

I inserted the library on my board it works fine but the problem is that the speed got very slow. I think there is some problem that i have not set any flags for the GCC compiler.

I could not find any options.How I can set the particular flags for the GCC compiler so that unnecessary features can be omitted.

cross-compilation

shareimprove this question

edited Jan 5 at 0:39

Braiam
16.7k93167

asked Mar 15 '13 at 4:55

Parthiv Shah
266

I think there is some issue that it can not find the compiler path ,So i find where my GCC compiler is installed and then reconfigured it with the following command. ./configure --host=arm CC=/opt/arm-2011.03/bin/arm-none-linux-gnueabi-gcc AR=/opt/arm-2011.03/bin/arm-none-linux-gnueabi-ar STRIP=/opt/arm-2011.03/bin/arm-none-linux-gnueabi-strip RANLIB=/opt/arm-2011.03/bin/arm-none-linux-gnueabi-ranlib CFLAGS="Os" –  Parthiv Shah Mar 15 '13 at 7:13

But it gave me an error : C Compiler cannot create executables. –  Parthiv Shah Mar 15 '13 at 7:16

Right now I am getting an error in the cross compilation. It gave me an error that "C COMPILER CANNOT CREATE EXECUTABLES" –  Parthiv Shah Mar 15 '13 at 8:12

2

Yes, but what I mean is: don't add this to the comments. Edit the question itself such that it reflects exactly where you are stuck. –  zwets Mar 15 '13 at 8:20

Hey I got some useful information about the Cflags and Finally Configueed my SQLIte 3.7.15.2 with the Most appropriate parameters and features. Please go through the Below link for CFALGS.gcc.gnu.org/onlinedocs/gcc/ARM-Options.html –  Parthiv Shah Mar 18 '13 at 9:19

show 1 more comment

1 Answer

ACTIVEOLDESTVOTES

up vote0down vote

This worked for me (and it works to cross compile most other third-party software):

$ export PATH=$PATH:<path to directory containing your cross-compiler binaries>
$ cd <path to the directory containing the thirdparty code>
$ ./configure --prefix="<installation path>" --host=arm-unknown-linux-gnueabi

Add your CFLAGS and other configuration parameters to the configuration parameters. E.g.,

$ ./configure --prefix="<installation path>" --host=arm-unknown-linux-gnueabi -CFLAGS="-Os" --enable-threadsafe

If in your case the target system is specified by arm-none-linux-gnueabi, replace the host in the above example:

$ ./configure --prefix="<installation path>" --host=arm-none-linux-gnueabi -CFLAGS="-Os" --enable-threadsafe

The paths to GCC, CC, AR, ... will be found from the host you've set.

shareimprove this answer

sqlite 交叉编译-转相关推荐

  1. sqlite的交叉编译及移植 -转

    平台: PC机:redhat9.0 arm板:at91sam9260/linux-2.6.22 交叉编译器:armv51-linux-gcc 1..从sqlite的官方网站下载sqlite的最新版本源 ...

  2. sqlite编辑器 linux,SQLite3 ARM平台交叉编译

    编译前准备工作 平台及资源 主机环境:ubuntu 14.04 开发板 :米尔科技 ARM 335X 系列 SQLite:SQLite3.26 下载网址:https://www.sqlite.org/ ...

  3. 交叉编译 SQLite

    交叉编译 SQLite 概述 SQLite 是一个 C 语言库,它实现了一个小型.快速.自包含.高可靠性.功能齐全的 SQL 数据库引擎.SQLite 是世界上使用最多的数据库引擎.SQLite 内置 ...

  4. Linux应用开发: SQLite数据库交叉编译部署与运用

    一.数据库介绍 1.1 数据库简介 数据库是以一定方式储存在一起.能与多个用户共享.具有尽可能小的冗余度.与应用程序彼此独立的数据集合,可视为电子化的文件柜--存储电子文件的处所,用户可以对文件中的数 ...

  5. linux中sqlite3编译时出错,Sqlite3 交叉编译 undefined reference to `fdatasync' 错误解决

    交叉编译sqlite到Android平台, Android.mk 文件内容如下: LOCAL_PATH:= $(call my-dir) INCDIR:=/home/android-ndk-r6b/s ...

  6. cgo linux arm,Golang交叉编译各个平台的二进制文件

    熟悉golang的人都知道,golang交叉编译很简单的,只要设置几个环境变量就可以了 # mac上编译linux和windows二进制 CGO_ENABLED=0 GOOS=linux GOARCH ...

  7. Ubuntu实现树莓派交叉编译

    一.交叉编译 在一个平台上生成另一个平台上的可执行代码.为什么要大费周折的进行交叉编译呢?一句话:不得已而为之.有时是因为目的平台上不允许或不能够安装所需要的编译器,而又需要这个编译器的某些特征:有时 ...

  8. 嵌入式数据库Sqlite移植教程-转

    嵌入式数据库Sqlite移植教程 sqlite-3.3.6编译安装与交叉编译全过程详细记录 本文介绍的内容都是基于 Linux RedHat 9.0 平台的. 一.PC机编译安装 请阅读在安装包里的 ...

  9. 嵌入式linux下sqlite应用

    <一.嵌入式sqlite库的移植>  FM001 Sqlite3动态库移植模块设计 功能描述 SQLite是一个进程内的库,实现了自给自足的.无服务器的.零配置的.事务性的 SQL 数据库 ...

最新文章

  1. RHEL7: unbound(DNS server)的简单配置
  2. TreeView控件中实现拖拽的功能
  3. 哪位有方法把 dd/mm/yyyy的字符串 格式化成yyyy-mm-dd
  4. dbnull和null_NULL和DBNull的区别分析
  5. element-ui表单_每日UI挑战强加-登录表单(分步教程)
  6. 《Imperfect C++中文版》——1.3 运行期契约:前置条件、后置条件和不变式
  7. suse linux 10 ftp服务配置
  8. 四川大学计算机组成原理实验报告_20092014年计算机组成原理考研真题与解析
  9. Android逆向基础笔记—初识逆向
  10. 使用Axure创建iPhone应用程序原型(二)
  11. 手机端和wap端页面的自适应技术方案
  12. 【操作系统内存管理(基本概念)】
  13. DIY智能车赛优胜奖开源作品——手机遥控麦克纳姆轮小车(1)
  14. ADB介绍—— 配置ADB环境变量
  15. 如何判断一件事重要还是紧急?
  16. C语言理论小学案例试讲,【精选】C语言试讲 演示文稿C语言试讲 演示文稿.ppt
  17. win32如何处理组合键盘消息
  18. Google基本查询语法
  19. python整数逆位运算_[python/工具] python z3库学习 减乘除位与运算 ctf一把梭
  20. layui表格table固定表头第一行固定显示

热门文章

  1. Android的activity的title设定内容
  2. java(21) - 注解详解
  3. Java学习系列(十三)Java面向对象之界面编程
  4. Flash(as3.0) CScreen
  5. Vue.js 运行机制全局概览浅读
  6. PHP全栈开发(八):CSS Ⅴ 超链接 style
  7. 解决Oracle错误ORA-15061一例
  8. mysql乱码问题的解决方案
  9. assertion: 18 { code: 18, ok: 0.0, errmsg: auth fails }
  10. php中输入这个网站的网址跳转到你定义的页面代码