Build boost 1.45 with VC++ 2008 on Windows XP and gcc on Ubuntu

本文介绍如何在Windows和Ubuntu环境下配置并编译Boost库。包括设置Qt、Python环境变量,创建批处理文件简化编译流程,以及在Ubuntu中使用特定命令避免错误。提供了从配置到完成编译的详细步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

 

On Windows, add the following to G:/src/boost_1_45_0/tools/build/v2/user-config.jam


 

using qt : C://Qt//4.6.3 ;

##########################################################

using python

    : 3.1                         # Version

    : C://Python31//python.exe    # Python Path

    : C://Python31//Include        # include path(s) -they may be not really needed here

    : C://Python31//libs        # lib path(s) - they may be not really needed here

    : <python-debugging>off <define>BOOST_ALL_NO_LIB=1

    

using python

    : 3.1                         # Version

    : C://Python31//python.exe    # Python Path

    : C://Python31//Include        # include path(s) -they may be not really needed here

    : C://Python31//libs        # lib path(s) - they may be not really needed here

    : <python-debugging>on <define>BOOST_ALL_NO_LIB=1

    

##########################################################

 

 

 

create a batch file with the following content:

 

call "%VS90COMNTOOLS%/../../vc/bin/vcvars32.bat"

cd /d G:/src/boost_1_45_0

call bootstrap.bat

set temp_time=%TIME%

SET ICU_PATH=D:/opensource/icu4c-4_4_1-Win32-msvc9/icu

bjam.exe --toolset=msvc stage --without-mpi --build-type=complete -sBZIP2_INCLUDE=D:/opensource/bzip2-1.0.5 -sBZIP2_SOURCE=D:/opensource/bzip2-1.0.5 -sZLIB_INCLUDE=D:/opensource/zlib-1.2.5 -sZLIB_SOURCE=D:/opensource/zlib-1.2.5

echo "build finished" >> buildtime.txt

@echo start at %temp_time% >> buildtime.txt

@echo stop at %TIME% >> buildtime.txt

 

 

 

 

It took 63 minutes, used 9 GB disk. 

 

 

 

On ubuntu

unzip boost_1_45_0.tar.bz2 to /d4/src/boost_1_45_0

run bootstrap.sh

onega@ub-laptop:/d4/src/boost_1_45_0$ ./bootstrap.sh

onega@ub-laptop:/d4/src/boost_1_45_0$ ./bjam --build-type=complete --layout=tagged stage

start at 11:48

finished at 13:02

libraries are copied to /d4/src/boost_1_45_0/stage/lib.

 

I shared a NTFS drive between Windows and Ubuntu so that I just need to keep one copy of boost (and many other) files. Build boost.log without specifying toolset on ubuntu leads to some msvc related errors. Anyway, the following command worked for me.

onega@ub-laptop:/d4/src/boost_1_45_0$ ./bjam --with-log --toolset=gcc variant=debug,release define=BOOST_LOG_DYN_LINK --layout=tagged stage

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值