Linux手机DIY.库文件专题.交叉编译的浮点问题( 二 )


E600自带的QTE库(FPA soft FP),编译一个简单的QTE程序,出现如下错误:
/home/gcc/toolchain/soft-arm-linux/gcc-3.3.2-glibc-2.3.2/bin/../lib/
gcc-lib/arm-linux/3.3.2/../../../../arm-linux/bin/ld: ERROR: /home/gcc/
toolchain/qt/lib/libqte-mt.so uses FPA instructions, whereas helloqt does not
/home/gcc/toolchain/soft-arm-linux/gcc-3.3.2-glibc-2.3.2/bin/../lib/
gcc-lib/arm-linux/3.3.2/../../../../arm-linux/bin/ld: failed to merge
target specific data of file /home/gcc/toolchain/qt/lib/libqte-mt.so
collect2: ld returned 1 exit status
这个编译环境是用cross-tool-0.28编译而成的,而且打了gcc-3.3.2的soft-
float patch,不过按patch说明,是应该可以生成FPA soft FP格式的编译环境,而
结果却是VFP soft FP,这个适用于E680系列,然不适用夏新E600和飞利浦968 。
后来我在交叉编译环境中把GCC_EXTRA_CONFIG的--with-float=soft选项去除
且把soft-float patch也同时去掉,获得的是FPA hard FP的编译环境 。用这个环境
再编译夏新E600自带的QTE库(FPA soft FP),会出现类似如下提示:
ld uses hardware FP, whereas libqte-mt.so uses software ...

我试图在gcc参数中加上-msoft-float,错误如下:
arm-linux/bin/ld: cannot find -lfloat collect2: ld returned 1 exit status

这个需要编译编译环境时加下nolibfloat的patch 。

如何生成FPA soft FP的格式困扰了好几天,我查看了soft-float patch出搜
索了大量资料,觉得可能还是patch本身的问题 。我重新下载了gcc.3.4.0,使用
3.4.0 soft patch,另外把bigendian,nolibfloat这一些有冲突的patch去掉,
果然生成了FPA soft FP格式的库文件 。
再用E600自带的QTE库,编译只是有一个告警选项:
/home/gcc/toolchain/gcc-3.4.0-glibc-2.2.5/arm-linux/lib/gcc/arm-linux/3.4
.0/../../../../arm-linux/bin/ld: warning: libstdc.so.5, needed by /home/gcc
/toolchain/qt-2.3.8/lib/libqte-mt.so, not found (try using -rpath or -rpath-link)
夏新E600和飞利浦968使用的GCC版本都是3.2.1,3.4.0编译后是libstdc.so.6,
可以查看下面的lib内容,使用的版本是不同的 。
libstdc.so.6

Version definitions:
1 0x01 0x025f4d66 libstdc.so.6
2 0x00 0x08922974 GLIBCXX_3.4
3 0x00 0x056bafd3 CXXABI_1.3

Version References:
required from libgcc_s.so.1:
0x0b792653 0x00 10 GCC_3.3
0x0d696910 0x00 08 GLIBC_2.0
0x0b792650 0x00 07 GCC_3.0
required from libm.so.6:
0x0d696910 0x00 05 GLIBC_2.0
required from libc.so.6:
0x09691f73 0x00 11 GLIBC_2.1.3
0x0d696911 0x00 09 GLIBC_2.1
0x0d696912 0x00 06 GLIBC_2.2
0x0d696910 0x00 04 GLIBC_2.0
libstdc.so.5

Version definitions:
1 0x01 0x025f4d65 libstdc.so.5
2 0x00 0x081a2972 GLIBCPP_3.2
3 0x00 0x0a297d01 GLIBCPP_3.2.1
GLIBCPP_3.2
4 0x00 0x056bafd2 CXXABI_1.2

Version References:
required from libm.so.6:
0x0d696910 0x00 07 GLIBC_2.0
required from libgcc_s.so.1:
0x0b792650 0x00 06 GCC_3.0
required from libc.so.6:
0x0d696912 0x00 10 GLIBC_2.2
0x09691f73 0x00 09 GLIBC_2.1.3
0x0d696911 0x00 08 GLIBC_2.1
0x0d696910 0x00 05 GLIBC_2.0

五、总结
E600和968编译环境问题看似是解决了,其实不然,这仅仅说明了可以生
成兼容E600,968的库文件,能否运行则是另外一回事,下文将着重说明运行时
的兼容性问题 。

推荐阅读