开发者

SQlite3 problem with floating point for arm-linux

开发者 https://www.devze.com 2023-02-26 14:07 出处:网络
I am trying to use sqlite-3.7.2 cross compiling it in two machines, an arm-linux and a xscale system, I have cross compile it using ./configure for both systems in a very normal way, indic开发者_如何学

I am trying to use sqlite-3.7.2 cross compiling it in two machines, an arm-linux and a xscale system, I have cross compile it using ./configure for both systems in a very normal way, indic开发者_如何学Cating of course the host to compile.

The thing is that I have some REAL values on the database. I get the correct values for xscale system, but on the arm7 I get an incorrect value for those that have decimal part, I mean;

If I have in my database table:

REAL 2.00

REAL 2.02

When I SELECT these values I get:

2.00

-4310086189061.12

For xscale is working fine, so I suppose that is a sqlite compilation issue for arm.

I have done a research and I didn't find so much, just this: http://www.mail-archive.com/sqlite-users@sqlite.org/msg40528.html Where is suggested to use the -DSQLITE_MIXED_ENDIAN_64BIT_FLOAT=1 flag on compile time, but I can't find it on the code and doesn't work just adding it to the configure or Makefie.am files.

I will really appreciate if someone has any solution or information about this issue, because I am completely stuck

Thank you so much

JC

EDIT: Solution that is working for me, before to cross compile sqlite3, define the variable CFLAGS on the environment:

$ CFLAGS="-DSQLITE_MIXED_ENDIAN_64BIT_FLOAT=1 -DSQLITE_DEBUG=1"

$ export CFLAGS


From the comment by the OP:

For those that could have my same problem, I've finally solved it. On the code is explained for the flag SQLITE_MIXED_ENDIAN_64BIT_FLOAT what is the issue.

To solve it, is necessary to define on CFLAGS environment this flag (-DSQLITE_MIXED_ENDIAN_64BIT_FLOAT=1) and the flag -DSQLITE_DEBUG=1, this last flag assure to get the correct value. So,

$ CFLAGS="-DSQLITE_MIXED_ENDIAN_64BIT_FLOAT=1 -DSQLITE_DEBUG=1"

and

$ export CFLAGS

0

精彩评论

暂无评论...
验证码 换一张
取 消