在linux下编译boost库

发布时间:2011-2-28 19:38    发布者:hikesoso2010
关键词: boost , linux , 编译
编译环境  操作系统:SUSE linux Enterprise Server 10 64-bit  编译工具:gcc 4.1.2  1.下载boost1.36  2.解压boost到/usr/share  3.在命令行运行/usr/share/boost_1_36_0/tools/jam/src/build.sh生成bjam  4.复制/usr/share/boost_1_36_0/tools/jam/src/bin.linuxx86_64/bjam到/usr/bin目录下  5.配置/usr/share/boost_1_36_0/tools/build/v2/user-config.jam中使用的编译工具  using gcc ;  6.使用bjam --build-type=complete --with-XXXX stage 编译指定库或者使用  bjam --build-type=complete stage 完全编译boost库,库文件编译完成后存放在  /usr/share/boost_1_36_0/stage/lib目录下.由于大部分boost库并不需要编译可直接使用,  通常我们可选择性的编译需要的库.  7.如需要使用bjam编译应用程序,编辑/etc/profile,在文件最后增加  export BOOST_ROOT     = /usr/share/boost_1_36_0  export BOOST_INCLUDE = /usr/share/boost_1_36_0  export BOOST_LIB      = /usr/share/boost_1_36_0/stage/lib  8.为了让编译工具能搜索到boost库的头文件和库文件,我们使用ln命令建立连接  8.1创建头文件连接  ln -s /usr/share/boost_1_36_0/boost /usr/include/boost  8.2创建库文件连接,为了方便我们可使用jam帮助我们完整这项工作,在  /usr/share/boost_1_36_0/stage/lib下创建Jamroot  #Jamroot脚本  local files = [ glob *.* ] ;  local curpath ;  local install_lib_files = [ glob /usr/lib/*.* ] ;  local cmd ;  local source_path ;  local desc_path ;  path-constant curpath : ./ ;  for local file in $(files)  {  source_path = $(curpath)/$(file) ;  desc_path = "/usr/lib/"$(file) ;  cmd = "ln -s "$(source_path)" "$(desc_path) ;  if $(desc_path) in $(install_lib_files)  {  ECHO $(desc_path)" is exists" ;  }  else  {  ECHO $(cmd) ;  SHELL $(cmd) ;  }  }  以上脚本将/usr/share/boost_1_36_0/stage/lib目录下的所有库文件创建连接符号到  /usr/lib目录下.  9.编译完成
本文地址:https://www.eechina.com/thread-56208-1-1.html     【打印本页】

本站部分文章为转载或网友发布,目的在于传递和分享信息,并不代表本网赞同其观点和对其真实性负责;文章版权归原作者及原出处所有,如涉及作品内容、版权和其它问题,我们将根据著作权人的要求,第一时间更正或删除。
yyfsyyyy56 发表于 2011-3-10 23:30:37
多谢分享
您需要登录后才可以发表评论 登录 | 立即注册

厂商推荐

相关视频

关于我们  -  服务条款  -  使用指南  -  站点地图  -  友情链接  -  联系我们
电子工程网 © 版权所有   京ICP备16069177号 | 京公网安备11010502021702
快速回复 返回顶部 返回列表