天天看点

poco for ARM的安装及使用

这两天要把poco移植到ARM环境中,费了不少劲,现在我把整个过程及安装过程遇到的问题说下:

我把我的提问内容先复制过来:

一、根据网上的教程,首先要生成STLport库的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下就大功告成。

二、 

1. 确保ARM编译成功安装,并配置好环境变量。 

2. 解压Poco压缩包 

3. 进入Poco目录,执行./configure --no-tests --omit=NetSSL_OpenSSL,Crypto,Data --config=ARM-Linux 

4. 编辑build/config/ARM-Linux,修改一下配置(STLport编译后执行make install) 

    STLPORT_INCLUDE    = /usr/local/include/stlport 

    STLPORT_LIB        = /usr/local/lib                ===============>我的在/usr/local/arm-linux-lib

    OPENSSL_INCLUDE    = /usr/local/arm/4.3.2/include    ==========》由于不需要openssl,所以没安装

    OPENSSL_LIB        = /usr/local/arm/4.3.2/lib 

5. 由于Poco for ARM需要libstlport_arm-linux-gcc.so这个库,实际就是libstlport.so,故需要做个软连接 

6. 由于stlport的ostream不支持long double类型,故需要修改Foundation/src/Format.cpp,修改处是216和217(行数有改动),将long double改为double. 

7. 以上都是根据网上配置成功的案例设置的。

但是我在make过程中出现错误:

In file included from src/FPEnvironment_DUMMY.cpp:37,

                 from src/FPEnvironment.cpp:42:

include/Poco/FPEnvironment_DUMMY.h: In static member function 'static bool Poco::FPEnvironmentImpl::isInfiniteImpl(float)':

include/Poco/FPEnvironment_DUMMY.h:98: error: 'isinf' is not a member of 'stlp_std'

include/Poco/FPEnvironment_DUMMY.h: In static member function 'static bool Poco::FPEnvironmentImpl::isInfiniteImpl(double)':

include/Poco/FPEnvironment_DUMMY.h:104: error: 'isinf' is not a member of 'stlp_std'

include/Poco/FPEnvironment_DUMMY.h: In static member function 'static bool Poco::FPEnvironmentImpl::isInfiniteImpl(long double)':

include/Poco/FPEnvironment_DUMMY.h:110: error: 'isinf' is not a member of 'stlp_std'

include/Poco/FPEnvironment_DUMMY.h: In static member function 'static bool Poco::FPEnvironmentImpl::isNaNImpl(float)':

include/Poco/FPEnvironment_DUMMY.h:116: error: 'isnan' is not a member of 'stlp_std'

include/Poco/FPEnvironment_DUMMY.h: In static member function 'static bool Poco::FPEnvironmentImpl::isNaNImpl(double)':

include/Poco/FPEnvironment_DUMMY.h:122: error: 'isnan' is not a member of 'stlp_std'

include/Poco/FPEnvironment_DUMMY.h: In static member function 'static bool Poco::FPEnvironmentImpl::isNaNImpl(long double)':

include/Poco/FPEnvironment_DUMMY.h:128: error: 'isnan' is not a member of 'stlp_std'

make[1]: *** [/home/clarion/zhaoyong/poco-1.4.7p1/Foundation/obj/Linux/ARM/debug_shared/FPEnvironment.o] エラー 1

make: *** [Foundation-libexec] エラー 2

这个问题,我是把isinf和isnan前面的std:: 删掉了 ,能编译通过。但不知道以后用的时候会出什么问题。

====================================================================

①在安装STLport,make install 遇到没权限问题,所以我就加了个sudo make install,也出现了问题。那我既要取得root权限,又要具有当前用户的工作环境,怎么办呢?

用sudo -i命令,然后找到文件即可执行make install。

②在编译的时候遇到很多未定义的函数,里面参数都是带std::的参数,这是因为ARM格式的poco库,这些函数的参数是stl_std::。

所以,在Makefile中,头文件路径要加上stlport的头文件路径,库的路径也要加上stlport的库路径,在-lPocoFoundationd -lPocoXMLd前面加-lstlport。

我也是新手,就这些问题让我搞了两天,写个日志,希望以后遇到问题的同学能够很快的解决问题,节省时间,时间就是效率,就是生命。