为 OpenWRT 交叉编译 boost
本文展示如何为 OpenWRT 交叉编译 boost。我们将使用 Teltonika RUTX10 SDK,它已经预先配置了该路由器的相关 OpenWRT 设置。
此前提是你已经:
我们假设 SDK 位于 ~/rutos-ipq40xx-rutx-gpl。
编译 boost
首先,你需要考虑许多 boost 库是仅头文件库。对于这些库,你不需要编译 boost,但准备一个完整的 boost 文件夹用于安装可能仍然更容易。
首先,下载 boost 并解压。现在运行
bootstrap_bjam.sh
./bootstrap.sh来编译 bjam。
现在,打开 boost 文件夹内的 project-config.jam 并在文件顶部添加以下行:
project-config_jam_line.txt
using gcc : openwrt : arm-openwrt-linux-muslgnueabi-g++ ;现在,在 boost 文件夹内运行以下 bash 脚本:
build_boost_openwrt.sh
export STAGING_DIR=~/rutos-ipq40xx-rutx-gpl/staging_dir
export TOOLCHAIN=${STAGING_DIR}/toolchain-arm_cortex-a7+neon-vfpv4_gcc-8.4.0_musl_eabi
export CC=${TOOLCHAIN}/bin/arm-openwrt-linux-muslgnueabi-gcc
export CPP=${TOOLCHAIN}/bin/arm-openwrt-linux-muslgnueabi-g++
export PATH=$PATH:${TOOLCHAIN}/bin/
# Insert at the top of project-config.jam
# using gcc : openwrt : arm-openwrt-linux-muslgnueabi-g++ ;
rm -rf ~/boost_rutx10
mkdir -p ~/boost_rutx10/
./b2 --prefix=$HOME/boost_rutx10 install toolset=gcc-openwrt -sNO_COMPRESSION=1现在,boost 安装在 ~/boost_rutx10,其中包含 include 和 lib 子目录。
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow