posts - 28, comments - 179, trackbacks - 0, articles - 1
  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

boost1.35.0编译日志

Posted on 2008-03-31 16:56 chemz 阅读(8405) 评论(13)  编辑 收藏 引用 所属分类: boost
                               boost1.35.0编译日志
    经历了将近半年多的时间boost终于发布了1.35.0版本(前版本1.34.1发布于2007/7),
其编译方法和原来的编译方法基本上是一致的,主要改变包括1.34.0以来bjam的toolset所
提供的参数名称的改变(具体参见《boost1.34.0编译日志》)外,还包括bjam的编译默认
选项的变化,在1.35.0之前的版本默认编译时会自动编译各种版本的库,包括静态库、
动态库、debug库和release库等全部的版本,但是到了1.35.0时默认的选择仅仅编译release
版本的库,这样一来在开发的时候就不能进行必要的调试了,为了能够使其编译全部的版本
需要在bjam的命令行参数中添加一个--build-type=complete类型的参数来指明需要编译全
部的版本,所需要编译同时为了使得regex库能够通过ICU库支持Unicode,在编译上需要有
一些特殊的选择。我在Visual Studio 2005 Pro + SP1环境下编译了该库,为了避免走弯路
所以将其编译的方法进行说明,以方便大家编译。
    由于boost是采用其自己的bjam工具通过命令行进行编译的,所以必须在Windows下开启
console窗口,同时必须将Visual Studio中C++目录下的环境vcvarsall.bat配置脚本运行一
遍,以设置好VC的编译器环境变量。
    1. 编译不带ICU支持的boost库
       此种情况下的boost库编译起来比较的简单,在准备好的console窗口中输入:
           bjam --without-python --toolset=msvc-8.0 --build-type=complete stage
       就可以了,如果要安装的话则输入:
           bjam --without-python --toolset=msvc-8.0 --build-type=complete install
          
    2. 编译具有ICU支持的boost库
       首先我们必须编译ICU库才能够编译boost库,在准备好的console窗口中输入:
           bjam -sICU_PATH=d:\ICU --without-python --toolset=msvc-8.0 --build-type=complete stage
       就可以了,如果要安装的话则输入:
           bjam -sICU_PATH=d:\ICU --without-python --toolset=msvc-8.0 --build-type=complete install
    通过上面的方法可以很正常完成boost各种需要版本的关系。


Feedback

# re: boost1.35.0编译日志[未登录]  回复  更多评论   

2008-03-31 17:27 by colin
动作好快啊。呵呵。

# re: boost1.35.0编译日志  回复  更多评论   

2008-03-31 19:13 by erlang
帮帮忙,那个MPI库怎么编译,好想用

# re: boost1.35.0编译日志[未登录]  回复  更多评论   

2008-03-31 19:26 by alpha
用vc2008编译出错:

M:\CODE\VNN4\OUTER\boost_1_35_0>bjam -a -sICU_PATH=m:\icu4c-3_8-src\icu_x86_9 --
without-python --without-mpi --toolset=msvc-9.0 --build-type=complete --prefix=m
:\boost86 install
warning: Graph library does not contain optional GraphML reader.
note: to enable GraphML support, set EXPAT_INCLUDE and EXPAT_LIBPATH to the
note: directories containing the Expat headers and libraries, respectively.
Building Boost.Regex with Unicode/ICU support enabled
Using ICU in m:\icu4c-3_8-src\icu_x86_9/include
Skipping build of: ./install <build>no in common properties
Skipping build of: ./install <build>no in common properties
Skipping build of: ./install <build>no in common properties
Skipping build of: ./install <build>no in common properties
Skipping build of: libs/regex/build/icucore <build>no in common properties
Skipping build of: libs/regex/build/icuin <build>no in common properties
Skipping build of: libs/regex/build/icudata <build>no in common properties
M:/CODE/VNN4/OUTER/boost_1_35_0/tools/build/v2/kernel\class.jam:93: in new
*** argument error
* rule object(searched-lib-target)@54887.__init__ ( name : project : shared ? :
search * : action )
* called with: ( icudt icuin icuuc : object(project-target)@158 : true : /m:/icu
4c-3_8-src/icu_x86_9/lib : object(null-action)@54886 : : : : )
* extra argument icuin
M:/CODE/VNN4/OUTER/boost_1_35_0/tools/build/v2/tools\builtin.jam:349:see definit
ion of rule '__init__' being called
M:/CODE/VNN4/OUTER/boost_1_35_0/tools/build/v2/tools\builtin.jam:592: in object(
searched-lib-generator)@6.run
M:/CODE/VNN4/OUTER/boost_1_35_0/tools/build/v2/build\generators.jam:859: in try-
one-generator-really
M:/CODE/VNN4/OUTER/boost_1_35_0/tools/build/v2/build\generators.jam:920: in try-
one-generator
M:/CODE/VNN4/OUTER/boost_1_35_0/tools/build/v2/build\generators.jam:1131: in con
struct-really
M:/CODE/VNN4/OUTER/boost_1_35_0/tools/build/v2/build\generators.jam:1204: in gen
erators.construct
M:/CODE/VNN4/OUTER/boost_1_35_0/tools/build/v2/tools\builtin.jam:496: in object(
lib-generator)@5.run
M:/CODE/VNN4/OUTER/boost_1_35_0/tools/build/v2/build\generators.jam:859: in try-
one-generator-really
M:/CODE/VNN4/OUTER/boost_1_35_0/tools/build/v2/build\generators.jam:920: in try-
one-generator
M:/CODE/VNN4/OUTER/boost_1_35_0/tools/build/v2/build\generators.jam:1131: in con
struct-really
M:/CODE/VNN4/OUTER/boost_1_35_0/tools/build/v2/build\generators.jam:1204: in gen
erators.construct
M:/CODE/VNN4/OUTER/boost_1_35_0/tools/build/v2/build\targets.jam:1368: in constr
uct
M:/CODE/VNN4/OUTER/boost_1_35_0/tools/build/v2/build\targets.
M:\CODE\VNN4\OUTER\boost_1_35_0>

# re: boost1.35.0编译日志  回复  更多评论   

2008-03-31 22:29 by 杜中伟
校园网很慢,请问可以将Loki库和Boost库源码发到我邮箱么?
mailto:duzhongwei@qq.com

# re: boost1.35.0编译日志  回复  更多评论   

2008-04-01 10:28 by sjt
You need to pass --build-type=complete like:
bjam --build-dir=builddir --build-type-complete --toolset=msvc-8.0 stage

# re: boost1.35.0编译日志[未登录]  回复  更多评论   

2008-04-01 10:50 by alpha
我用vc9编译,如果ICU和build-type=complete不一起用是可以的。
一起用就会出上面所说的问题。

非常奇怪

# re: boost1.35.0编译日志[未登录]  回复  更多评论   

2008-04-01 11:21 by alpha
用--with regex编译,出现同样错误,看来就是regex的问题

# re: boost1.35.0编译日志  回复  更多评论   

2008-04-01 12:08 by erlang
编译还是麻烦啊,我都是直接把源文件copy到工程目录下编译运行

# re: boost1.35.0编译日志[未登录]  回复  更多评论   

2008-04-02 10:08 by alpha
最后搞定了这个问题:
bjam -a -sICU_PATH=m:\icu4c-3_8-src\icu_x64_9 –with-regex –toolset-msvc address-model=64 release

bjam -a -sICU_PATH=m:\icu4c-3_8-src\icu_x64_9 –with-regex –toolset-msvc address-model=64 debug

bjam -a -sICU_PATH=m:\icu4c-3_8-src\icu_x64_9 –with-regex –toolset=msvc msvc/link=static address-model=64 debug

bjam -a -sICU_PATH=m:\icu4c-3_8-src\icu_x64_9 –with-regex –toolset=msvc msvc/link=static address-model=64 release

如果是x86

bjam -a -sICU_PATH=m:\icu4c-3_8-src\icu_x86_9 –with-regex –toolset-msvc release

bjam -a -sICU_PATH=m:\icu4c-3_8-src\icu_x86_9 –with-regex –toolset-msvc debug

bjam -a -sICU_PATH=m:\icu4c-3_8-src\icu_x86_9 –with-regex –toolset=msvc msvc/link=static debug

bjam -a -sICU_PATH=m:\icu4c-3_8-src\icu_x86_9 –with-regex –toolset=msvc msvc/link=static release

没有编译static link c++ runtime lib的static lib,只编译了动态link c++ runtime lib的dll以及static lib

注意编译完之后的dll,lib以及libxxx.lib拷贝到目录下时,要同时去掉1_35拷贝一份,因为boost头文件中通过prgram(link)进行的auto link指向的lib不包含1_35后缀

http://alpha.oopslab.net

# re: boost1.35.0编译日志  回复  更多评论   

2008-04-13 17:14 by michealniu
看了你的这个日志,收获很大,但是就是不知道怎么在linux下直接编译boost,我按照安装说明里面来的,编译的很不全,报了下面一些错误,能不能给点指导性意见,感激不尽阿!
warning: Graph library does not contain optional GraphML reader.
note: to enable GraphML support, set EXPAT_INCLUDE and EXPAT_LIBPATH to the
note: directories containing the Expat headers and libraries, respectively.
warning: skipping optional Message Passing Interface (MPI) library.
note: to enable MPI support, add "using mpi ;" to user-config.jam.
note: to suppress this message, pass "--without-mpi" to bjam.
note: otherwise, you can safely ignore this message.
Building Boost.Regex with the optional Unicode/ICU support disabled.
Please refer to the Boost.Regex documentation for more information
(don't panic: this is a strictly optional feature).
warning: No toolsets are configured.
warning: Configuring default toolset "gcc".
warning: If the default is wrong, your build may not work correctly.
warning: Use the "--toolset=xxxxx" option to override our guess.
warning: For more configuration options, please consult
warning: http://boost.org/boost-build2/doc/html/bbv2/advanced/configuration.html

# re: boost1.35.0编译日志  回复  更多评论   

2008-04-13 17:21 by stO
configure your user-config.jam

# re: boost1.35.0编译日志  回复  更多评论   

2008-05-16 14:25 by dadatech
原来是ICU预先编译好的库只有动态link的,因此bjam 想用complete的时候就出错了

# re: boost1.35.0编译日志  回复  更多评论   

2009-08-05 13:14 by fatpig
我是在linux下安装的, 不支持ICU, 增加了版主所说的参数
BJAM_CONFIG= -sPYTHON_ROOT=/usr -sPYTHON_VERSION=2.4 --build-type=complete
光make就用了10分钟

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理