Linux下boost庫的編譯、安裝詳解


下載boost源碼

boost下載地址

解壓到一個目錄

tar -zxvf boost_1_66_0.tar.gz

1、正常編譯:

進入boost_1_66_0目錄中

cd boost_1_66_0
./bootstrap.sh --with-libraries=all --with-toolset=gcc

--with-liraries:需要編譯的庫
--with-toolset:編譯時使用的編譯器

安裝boost庫

./b2 install --prefix=/usr

--prefix:boost庫的安裝目錄,不加此參數,默認安裝在/usr/local目錄下

2、交叉編譯:

創建腳本xcompile_boost.sh,內容如下:

#xcompile_boost.sh

mfile=project-config.jam

if [ -e ${mfile} ];then
    rm ${mfile}
    echo "rm ${mfile}"
fi

./bootstrap.sh \
--with-libraries=system,filesystem,regex \
--prefix=/home/moxo/msoft/boost_1_65_1/prefix

if [ -e ${mfile} ];then
    mhost="/home/moxo/msoft/openwrt-guoxin/bin/arm-openwrt-linux-gnueabi-gcc -fPIC"
    sed -i "/using gcc/c using gcc : arm : ${mhost} ; " ${mfile}
fi

echo "After 5s start compile"
sleep 5s
./b2

echo "Afer 5s start install"
sleep 5s
./b2 install


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM