Ubuntu18交叉编译POCO-1.9.0

鲜于温书
2023-12-01

交叉编译链:arm-linux-gnueabihf-gcc

安装环境:ubuntu18.04

一、下载

POCO在github上下载源码

https://github.com/pocoproject/poco/archive/refs/tags/poco-1.9.0-release.tar.gz

二、解压配置

tar -zxvf poco-poco-1.9.0-release.tar.gz
cd poco-poco-1.9.0-release

之后就需要进行configure了

mkdir cmake-build
cd cmake-build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../mytoolchain.cmake -DCMAKE_INSTALL_PREFIX=./install_arm

mytoolchain.cmake文件:

# this one is important
SET(CMAKE_SYSTEM_NAME Linux)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)

# specify the cross compiler
SET(CMAKE_C_COMPILER   /opt/arm/opt/ext-toolchain/bin/arm-linux-gnueabihf-gcc)
SET(CMAKE_CXX_COMPILER /opt/arm/opt/ext-toolchain/bin/arm-linux-gnueabihf-g++)

# where is the target environment
SET(CMAKE_FIND_ROOT_PATH  /opt/arm)

# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

三、编译安装

make -j8
make install

 类似资料: