Sqlite3的应用

Sqlite3的应用

软件环境

PC:Fedora9

开发板:YC2440

交叉编译器:arm-linux-gcc 3.3.2

数据库:sqlite3.2.7

源码:http://download.csdn.net/source/2984671

 

我已经上传了PC下基于sqlite3的“增删改查”的代码。所以对编译和应用不再赘述。

在这里我将花更多的时间描述一下交叉编译过程中出现的问题、原因以及解决办法。

 

问题1:

系统提示:legacy.o(.text+0x340): undefined reference to `__ctype_b_loc'

系统提示:

/usr/local/arm/4.0.0/usr/bin/../lib/gcc/arm-linux/4.0.0/../../../../arm-linux/bin/ld:

crt1.o: No such file: No such file or directory

系统提示:arm_v5t_le-gcc-ld: ERROR: Source object /libsqlite3.a(set.o) has EABI version 0, but target test has EABI version 5

原因/办法:

交叉编译后,系统做上述提示,如果已经排除了常规原因(缺少某些库等),就应该考虑交叉编译器的版本问题了。

 

问题2:

系统提示:

arm-linux-gcc -static  -g -o all.cgi all.c -L ./lib -lsqlite3 -I ./Include 

/usr/local/arm/3.3.2/lib/gcc-lib/arm-linux/3.3.2/../../../../arm-linux/bin/ld: skipping incompatible ./lib/libsqlite3.a when searching for -lsqlite3

/usr/local/arm/3.3.2/lib/gcc-lib/arm-linux/3.3.2/../../../../arm-linux/bin/ld: cannot find -lsqlite3

collect2: ld returned 1 exit status

原因/办法:

交叉编译环境arm-linux-gcc编译链接的libsqlite3.a库不是使用arm-linux-gcc编译获得的,而是使用gcc编译所得。

同样道理,如果使用gcc编译链接的是由arm-linux-gcc编译所得的libsqlite3.a库也会出现类似问题。

 

问题3:

下载到开发板后,执行程序,提示无法打开数据库。

原因/办法:

权限问题,可以将test.db所在目录到根目录权限全部放开。

 

 

Sqlite3 Application

Software Environment
PC: Fedora9
Development Board: YC2440
cross-compiler: arm-linux-gcc 3.3.2
Database: sqlite3.2.7

I have uploaded sqlite3's "add delete update select" code base on PC. So the compiler and applications will not be repeated.
Here I will spend more time describing some problems, causes and solutions what occurred during cross-compilation.

Question 1:
System warning: legacy.o (. Text +0 x340): undefined reference to `__ctype_b_loc '
System warning:
/Usr/local/arm/4.0.0/usr/bin/../lib/gcc/arm-linux/4.0.0/../../../../arm-linux/bin/ld:
crt1.o: No such file: No such file or directory
System warning: arm_v5t_le-gcc-ld: ERROR: Source object / libsqlite3.a (set.o) has EABI version 0, but target test has EABI version 5
Reasons/ways:
After cross compiling, the system shows the above tips, if you have ruled out the conventional reasons (lack of some libraries, etc.), you should consider that the cross-compiler version is inappropriate.

Question 2:

System warning:
arm-linux-gcc-static-g-o all.cgi all.c -L ./lib-lsqlite3 -I ./Include
/Usr/local/arm/3.3.2/lib/gcc-lib/arm-linux/3.3.2/../../../../arm-linux/bin/ld: skipping incompatible ./Lib/libsqlite3.a when searching for-lsqlite3
/Usr/local/arm/3.3.2/lib/gcc-lib/arm-linux/3.3.2/../../../../arm-linux/bin/ld: cannot find-lsqlite3
collect2: ld returned 1 exit status
Reasons/ways:
Cross-compiler arm-linux-gcc linked libsqlite3.a not using arm-linux-gcc compiler to build, but useing gcc compiler.
Similarly, if using gcc to link libsqlite3.a by the arm-linux-gcc compiler, the problems will also appear.

Question 3:
Downloaded to the development board, excuting the programmes, system warning  that not open the database.
Reasons/ways:
Permissions problem, you can assign permission for all directorys from test.db directory to the root directory.

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值