美文网首页
交叉编译POCO

交叉编译POCO

作者: supremecsp | 来源:发表于2022-03-19 23:45 被阅读0次

C++项目要提供给其他操作系统平台使用,需要我根据arm工具链进行编译后提供相应的头文件和库。项目中用到了POCO第三方库,接下来简单介绍下交叉编译过程
1,Ubuntu上一篇安装了openssl,为了以防环境污染需要先卸载

openssl version
apt-get purge openssl
备份下证书目录,待恢复
zip -r ssl.zip /etc/ssl/* 
rm -rf /etc/ssl

2,修改环境编译,调整gcc,gcc-c++与动态链接库读取路径

vim /etc/profile
export CC=/disk/tools/aarch32-rockchip-linux-toolchain/bin/arm-linux-gcc
export CXX=/disk/tools/aarch32-rockchip-linux-toolchain/bin/arm-linux-g++
export LD_LIBRARY_PATH=/disk/tools/aarch32-rockchip-linux-toolchain/lib
source /etc/profile

3,下载openssl后用工具链重新进行编译
https://www.openssl.org/source/old/1.1.1/

tar -zxvf openssl-1.1.1m.tar.gz
cd openssl-1.1.1m/
./config no-asm --prefix=/usr/local/ssl
sed -i 's/-m64//' Makefile
make
make install
cd /usr/local/ssl/lib
file libcrypto.so.1.1

删去-m64原因可浏览该博客https://blog.csdn.net/wkd_007/article/details/122477229
4,建立头文件软连接与动态库读取路径
ln -s /usr/local/ssl/include/openssl /disk/tools/aarch32-rockchip-linux-toolchain/include/openssl
vim /etc/ld.so.conf
在文末插入一行 
/usr/local/ssl/lib
执行
ldconfig 

5,修改poco文件

vim /disk/tools/poco-poco-1.9.4-release/build/config/ARM-Linux
修改TOOL属性

6,编译POCO

./configure --config=ARM-Linux --no-tests --no-samples --omit=Data/ODBC --prefix=/usr/local/poco --static --shared
make -j4
make install

出现异常:error while loading shared libraries: libmpfr.so.4: cannot open shared object file: No such file or directory
找不到工具类的动态库文件,修改ld.so.conf文件

vim /etc/ld.so.conf
在文末插入一行 
/disk/tools/aarch32-rockchip-linux-toolchain/lib
执行
ldconfig 

7,对象存储COS编译
https://cloud.tencent.com/document/product/436/12301
将POCO动态库拷贝到工具链对应lib目录后进行编译

8,公司项目编译,查看可执行文件格式

相关文章

  • 交叉编译POCO

    C++项目要提供给其他操作系统平台使用,需要我根据arm工具链进行编译后提供相应的头文件和库。项目中用到了POCO...

  • poco 编译 & sample

    先决条件 cmake工具安装 wget https://github.com/Kitware/CMake/rele...

  • 2022-07-12 undefined reference t

    编译代码报错如下: /usr/bin/ld: /home/×××/lib/Poco/libPocoCrypto.a...

  • ITOP 4412 交叉编译环境 的搭建

    1 交叉编译工具### 编译的时候需要用到交叉编译工具,提供的交叉编译工具是用户光盘“02_编译器以及烧写工具”→...

  • poco编译支持mysql

    1、mysql安装 具体安装过程可参考:centos7安装mysql过程.md[https://github.co...

  • golang进行交叉编译

    golang进行交叉编译 交叉编译即编译不同操作系统平台的可执行程序 golang执行交叉编译,只需要使用两个变量...

  • 交叉编译

    配置64位ubuntu交叉编译环境时,设置arm的工具链的路径,需要先安装lib32stdc++6 然后在~/.b...

  • 交叉编译

    在一种计算机环境中运行的编译程序,能编译出在另外一种环境下运行的代码,我们就称这种编译器支持交叉编译。这个编译过程...

  • 交叉编译

    使用go的交叉编译 最后使用go build windows_fping.go 编译出.exe可执行文件 如果编译...

  • 交叉编译

    1.为啥需要交叉编译?因为linux 系统上的gcc 在android 系统上没法正常调用,所有需要使用andro...

网友评论

      本文标题:交叉编译POCO

      本文链接:https://www.haomeiwen.com/subject/tjindrtx.html