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

被折叠的 条评论
为什么被折叠?



