STLport 5.2.1 for ARM 交叉编译

OS : Suse 10
Ver : STLport-5.2.1
Compiler : GNU gcc 4.3.2 for ARM

1. 确保ARM编译成功安装,并配置好环境变量。
2. 解压STLport-5.2.1.tar.gz压缩包
3. 进入STLport-5.2.1目录,执行./configure --target=arm-linux
4. 修改stlport/stl/_cstdlib.h
搜索宏定义 _STLP_NO_VENDOR_STDLIB_L 共2处,将这2处下的if !defined(__sun)分别修改为
1处 #if !defined(__sun) && !defined(__arm__) && !defined(__sh__)
2处 #if !defined (__sun) && !defined(__arm__) && !defined(__mips__) && !defined(__mipsel__) && !defined(__sh__)

5. 回到STLport-5.2.1目录, make下就大功告成。

注释:如不修改_cstdlib.h文件,会出现以下情况
make -C build/lib all;
make[1]: Entering directory `/home/STLport-5.2.1/build/lib'
arm-linux-c++ -pthread -fexceptions -fPIC -O2 -fvisibility=hidden -D_GNU_SOURCE -I../../stlport -c -o obj/arm-linux-gcc/so/dll_main.o ../../src/dll_main.cpp
In file included from ../../stlport/stl/_alloc.h:35,
from ../../stlport/memory:29,
from ../../src/dll_main.cpp:41:
../../stlport/stl/_cstdlib.h:95: error: 'std::llabs' has not been declared
../../stlport/stl/_cstdlib.h:96: error: 'std::lldiv_t' has not been declared
../../stlport/stl/_cstdlib.h:97: error: 'std::lldiv' has not been declared
../../stlport/stl/_cstdlib.h: In function 'long long int abs(long long int)':
../../stlport/stl/_cstdlib.h:151: error: 'llabs' is not a member of 'std'
../../stlport/stl/_cstdlib.h: In function 'lldiv_t div(long long int, long long int)':
../../stlport/stl/_cstdlib.h:152: error: 'lldiv' is not a member of 'std'


该情况属于STLport在ARM平台自身存在的问题。请查询sourceforge。

你可能感兴趣的:(嵌入式)