boost交叉编译arm

正常编译

  1. 解压
tar -zxvf boost_1_73_0.tar.gz
  1. 查看可选库
cd boost_1_73_0
./bootstrap.sh --show-libraries
  1. 编译
./bootstrap.sh --with-libraries=filesystem,thread --with-toolset=gcc

使用–with-libraries=list或–without-libraries=list来添加或排除相应的库
这里可以按步骤2筛选库,完成后会生成“b2”

  1. 安装
./b2 install --prefix=/leo-gateway/lib/boost

交叉编译

  1. 编译
./bootstrap.sh --with-libraries=filesystem,thread --with-toolset=gcc
  1. 修改配置文件project-config.jam
if ! gcc in [ feature.values <toolset> ]
{
    using gcc : arm : /usr/local/arm/4.8.0/bin/arm-linux-gnueabihf-gcc ;
}
  1. 编译
./b2
  1. 安装
./b2 install --prefix=/root/arm/c4

CmakeLists.txt配置

cmake_minimum_required(VERSION 2.8.4)
project(leo_gateway)

set(CMAKE_CXX_STANDARD 14)

set(BOOST_ROOT ${ROOT_DIR}/lib/boost)
find_package(Boost REQUIRED COMPONENTS thread filesystem)

include_directories(${ROOT_DIR}/lib/boost/include)


add_executable(test main.cpp)
#add_executable(leo_gateway main.cpp)

target_link_libraries(test ${Boost_LIBRARIES})
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐