`
anders0913
  • 浏览: 89596 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

boost库的编译命令

阅读更多
boost库编译方法,留个记号,免得忘了。

Windows下:
bjam.exe --build-type=minimal --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread toolset=msvc-9.0 variant=release link=static threading=multi stage


Linux下:
    ./bjam --build-type=minimal --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread variant=release link=static threading=multi stage


:-)


////////////////////////////////////////////////
许多新人对于编译BOOST感到无从下手,甚至因此而放弃使用BOOST,那真的太可惜了,下面我把一些常用的BOOST编译方法贴于此,同时也作为自己的笔记。

首先下载bjam.exe,复制到 $BOOST$ 目录下。或者自己生成bjam,打开Visual Studio 2008 命令提示窗口$BOOST$\tools\jam\src,执行 build.bat 会在$BOOST$\tools\jam\src\bin.ntx86 生成 bjam.exe 文件。复制文件 bjam.exe  文件到 $BOOST$\下。

1.完全编译安装:
bjam --toolset=msvc install
完成后会生成一个bin.v2编译时的临时目录,手动删除。生成另一个目录C:\boost,里面为所有的头文件和库文件。头文件目录为boost_1_34_1\boost目录复制过去的。

2.只编译相应的库文件
bjam --toolset=msvc stage
完成后同样会生成bin.v2临时目录。另一个目录为stage文件,里面有对应的库文件。

3.查看需要编译才能使用的库列表
bjam --show-libraries

4.编译特定的库,如只编译regex
bjam --toolset=msvc --with-regex stage
生成的库文件在stage目录中。

5.不编译某个库,如不编译regex
bjam --toolset=msvc --without-regex stage
生成的库文件在stage目录中。

6.编译特定的库,如只编译regex,生成debug,多线程,共享连接版本,并保存在stage。
bjam --toolset=msvc --with-regex stage debug threading=multi link=shared

7.生成 mt-sgd 的静态库(runtime-link-static)
bjam "-sTOOLS=vc-8_0" --with-thread install debug release runtime-link=static

8.编译regex库。
bjam --toolset=msvc --with-regex stage debug release threading=multi threading=single link=shared link=static runtime-link=shared runtime-link=static

boost的安装方法:

对于DLL版本
bjam --toolset=msvc link=shared runtime-link=shared threading=multi stage debug release install

对于lib版本
bjam --toolset=msvc link=static runtime-link=shared threading=multi stage debug release install


另外,在$BOOST$\tools\build\v2\user-config.jam找到下面的地文

# -------------------
# MSVC configuration.
# -------------------

# Configure msvc (default version, searched for in standard locations and PATH).
# using msvc ;

# Configure specific msvc version (searched for in standard locations and PATH).
# using msvc : 8.0 ;

#在这里添加 vs2008 的配置

using msvc : 9.0 : : /wd4819 /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE  /D_SECURE_SCL=0 ;

#在这里添加 vs2005 的配置

using msvc : 8.0 : : <compileflags>/wd4819 <compileflags>/D_CRT_SECURE_NO_DEPRECATE <compileflags>/D_SCL_SECURE_NO_DEPRECATE <compileflags>/D_SECURE_SCL=0 ;   

然后进入 $BOOST$ 目录,执行bjam.exe 编译命令

//下面的命令的各选项的说明:
//prefix    将boost安装到的路径(生成的头文件和库文件都会放到该路径中)。
//重定义以下变量(利用-s设置):
//VC80_ROOT   vc2005的安装路径,如果未将vc2005安装到默认位置,你必须指定该项。
//TOOLS         使用的编译工具,vc2005对应的是vc-8_0
//PYTHON_ROOT   ython的安装目录,如果未将BOOST安装到默认位置,你必须指定该项。
//BUILD         编译结果选项,默认会生成尽可能多的版本,如调试版/发行版,静态库/动态库,单线程/多线程。

bjam 命令说明



Boost.Build V2 (Milestone 12)
Boost.Jam 03.1.16

Project-specific help:

  Project has jamfile at Jamroot

Usage:

  bjam [options] [properties] [install|stage]

  Builds and installs Boost.

Targets and Related Options:

  install                 Install headers and compiled library files to the
  =======                 configured locations (below).

  --prefix=<PREFIX>       Install architecture independent files here.
                          Default; C:\Boost on Win32
                          Default; /usr/local on Unix. Linux, etc.

  --exec-prefix=<EPREFIX> Install architecture dependent files here.
                          Default; <PREFIX>

  --libdir=<DIR>          Install library files here.
                          Default; <EPREFIX>/lib

  --includedir=<HDRDIR>   Install header files here.
                          Default; <PREFIX>/include

  stage                   Build and install only compiled library files
  =====                   to the stage directory.

  --stagedir=<STAGEDIR>   Install library files here
                          Default; ./stage

Other Options:

  --build-type=<type>     Build the specified pre-defined set of variations
                          of the libraries. Note, that which variants get
                          built depends on what each library supports.

                              minimal (default) - Builds the single
                              "release" version of the libraries. This
                              release corresponds to specifying:
                              "release <threading>multi <link>shared
                              <link>static <runtime-link>shared" as the
                              Boost.Build variant to build.

                              complete - Attempts to build all possible
                              variations.

  --build-dir=DIR         Build in this location instead of building
                          within the distribution tree. Recommended!

  --show-libraries        Displays the list of Boost libraries that require
                          build and installation steps, then exit.

  --layout=<layout>       Determines whether to choose library names
                          and header locations such that multiple
                          versions of Boost or multiple compilers can
                          be used on the same system.

                              versioned (default) - Names of boost
                              binaries include the Boost version
                              number and the name and version of the
                              compiler.  Boost headers are installed
                              in a subdirectory of <HDRDIR> whose
                              name contains the Boost version
                              number.

                              system - Binaries names do not include
                              the Boost version number or the name
                              and version number of the compiler.
                              Boost headers are installed directly
                              into <HDRDIR>.  This option is
                              intended for system integrators who
                              are building distribution packages.

  --buildid=ID            Adds the specified ID to the name of built
                          libraries.  The default is to not add anything.

  --help                  This message.

  --with-<library>        Build and install the specified <library>
                          If this option is used, only libraries
                          specified using this option will be built.

  --without-<library>     Do not build, stage, or install the specified
                          <library>. By default, all libraries are built.

Properties:

  toolset=toolset         Indicates the toolset to build with.

  variant=debug|release   Select the build variant

  link=static|shared      Whether to build static or shared libraries

  threading=single|multi  Whether to build single or multithreaded binaries

  runtime-link=static|shared    
                          Whether to link to static or shared C and C++ runtime.


Configuration help:

  Configuration file at $boost$\tools\build\v2
  user-config.jam

  This file is used to configure your Boost.Build installation. You can modify
this file in place, or you can place it in a permanent location so that it
does not get overwritten should you get a new version of Boost.Build. See:

  http://boost.org/boost-build2/doc/html/bbv2/reference.html#bbv2.reference.init

for documentation about possible permanent locations.

General command line usage:

    bjam [options] [properties] [targets]

  Options, properties and targets can be specified in any order.
    
Important Options:

  * --clean Remove targets instead of building
  * -a Rebuild everything
  * -n Don't execute the commands, only print them
  * -d+2 Show commands as they are executed
  * -d0 Supress all informational messages
  * -q Stop at first error
  * --debug-configuration Diagnose configuration
  * --debug-building Report which targets are built with what properties
  * --debug-generator Diagnose generator search/execution

Further Help:

  The following options can be used to obtain additional documentation.

  * --help-options Print more obscure command line options.
  * --help-internal Boost.Build implementation details.
  * --help-doc-options Implementation details doc formatting.

编译所有版本:

bjam --toolset=msvc-8.0 --prefix=$lib-and-dll-out-dir$ --build-type=complete install
等待编译完成.

设置开发环境:

打开VS2005 选择 工具->选项->vc++目录
设置包含文件目录$lib-and-dll-out-dir$\include\boost-1_37\boost
设置引用文件目录:$lib-and-dll-out-dir$\lib
完成.可以使用了.

;-)




分享到:
评论

相关推荐

    boost编译资料命令

    boost编译

    C++ boost库的安装过程详解

    Windows安装boost库 下载链接:https://www.boost.org/ 学习链接:https://theboostcpplibraries.com/ 1,下载解压,我的目录“C:\Program Files (x86)\Microsoft Visual Studio\2017” 2,以管理员身份运行“适用...

    visual studio 2015下boost库配置教程

    首先,我们需要下载一个Boost库。 这个直接去他的官网下就可以了:boost下载地址 下载好后解压到一个目录里。比如我解压到D盘根目录   然后我们打开【开始菜单】-&gt;【找到你对应版本的vs命令窗口,比如我是vs...

    能使用boost.python的MinGw(GCC)动态链接库

    使用g++编译常见的问题就是找不到文件&lt;boost/python.hpp&gt;和pyconfig.h等文件. 这些文件其实在boost的目录下面和C:\Python27\include目录中. 为了使用方便,将整个\boost_1_49_0\boost\目录复制到MinGw的include目录...

    linux下编译boost.python简单方法

    最近项目使用c++操作Python...换到另外一台机器,重新下载boost,使用以下命令,顺利编译成功 ./bootstrap.sh --with-python=/usr/bin/python ./bjam --build-type=minimal --with-python variant=release link=static

    dlib19.17.0 编译好的python-dlib库 不需要安装vs和boost cmake,直接pip安装 windows X64

    dlib18.17 编译好的python-dlib库 不需要安装vs和boost cmake,直接pip安装,亲测有效,非常简单 命令: pip install dlib-19.17.0-cp36-cp36m-win_amd64

    vendor-boost:用于使用XVC SDK与MSVC编译器工具集编译Boost C ++库的构建脚本

    用于使用与MSVC编译器工具集编译构建脚本 执照 版权所有(c)Grigore Stefan 根据许可获得许可。 这是不同作品的汇编。 某些文件受其他许可的约束,并带有其他要求和版权信息。 这可以在源文件或/和二进制文件帮助...

    sersync:sersync原始代码分析,学习,编译

    然后按照中的指示安装boost库,作为共享库so使用,命令如下 $ cd path/to/boost_1_64_0 $ ./bootstrap.sh --help ## 配置选项, 相当于configure $ ./bootstrap.sh --prefix=/usr/local ## 相当于make $ ./b2 ## 相当...

    caffe依赖库

    参照21天实战caffe进行编译,书中第五章的库分析,提到了10个库,其中boost和opencv太大,需要的朋友可自行下载,这里提供剩下的八个依赖库,按照书中的命令符进行编译安装。如果是opencv3的话,需要将配置文件中...

    MPI-SCVT:平行球形质心 Voronoi 镶嵌生成器。 用 C++ 编写,使用 MPI 和 Boost

    编译:要编译,您需要将 boost mpi 和序列化库放在 LD_LIBRARY_PATH 中,并将头文件放在 PATH 变量中。 之后,编译就像输入“make”一样简单,也可以使用“make debug”来编译调试版本。 这些命令创建可以从命令行...

    Lyapunov:用于数字积分非线性动力学系统的库

    利亚普诺夫 一个用于数值积分非线性动力学系统的库。... 这可能会使将编译的求解器链接到Boost库的正确版本变得很棘手。 如果您在使用该工具时遇到任何问题,请给我发送电子邮件或创建github问题,我们将为您提供帮

    travis-container-packets:用于编译和存储基于 Travis 容器架构的数据包的存储库

    Travis-Container 数据包用于编译和存储基于 Travis 容器架构的数据包的存储库可用数据包名称最新版本地位促进1.57.0 升压分钟1.57.0 铛3.5.1 铛3.4.2 Clang+libc++ 3.5.1 Clang+libc++ 3.4.2 制作3.1.2 制作2.8.12 ...

    java8rt.jar源码-wind_jvm:我的简单java虚拟机~

    ,并将链接器命令修改为您自己的 boost 库路径。 然后,您应该修改config.xml ,并在config.xml您的 jdk 源代码rt.jar路径。 然后,运行make test来编译测试 java 代码。 此外,Test7 必须从调试版本 jvm 编译。 ...

    ubuntu18 安装 Facebook 开源库 folly

    folly 要求 gcc 5.1+ 版本,以及c++14 编译支持的boost版本 . folly 的测试代码需要 googletest 库,可以用以下命令下载安装: wget https://github.com/google/googletest/archive/release-1.8.0.tar.gz && \ ...

    dals:DALS

    DALS:延迟驱动的近似逻辑综合先决条件苹果系统... brew pin boostUbuntu 18.04 安装最新版本的boost库。 sudo apt install libboost-all-dev项目结构包括:头文件src:源代码abc:伯克利ABC abc-plus:伯克利ABC的C

    scarab:近距离主动清除阿丽亚娜小体的研究

    Boost库无法自动下载和安装,下面列出的库可能会这样。 做出这个选择是因为编译时间可能很长。 建议使用例如 Mac OS X 上的Homebrew或 Ubuntu 上的apt-get安装预构建二进制文件。 此外, Scarab依赖于以下库: ...

    xilinx_FQ_test:测试Repo以测试Xilinx的面部质量模型

    Xilinx面部质量测试测试回购测试Xilinx的面部质量模型依存关系Xilinx AI SDK v2.0 + Boost库v1.68 OpenCV 3.3以上怎么编译? 请通过运行在您的SDK环境中交叉编译该程序make -j怎么跑? 在上一步中,您将创建可执行...

    libjungle:C++ 决策丛林库

    在 shell 中执行以下命令以下载和编译代码: $ hg clone https://bitbucket.org/geekStack/libjungle # Change to the code directory $ cd libjungle # We don't want to have objects files mixed with source ...

    CDT:用于约束Delaunay三角剖分(CDT)的C ++库

    CDT:受约束的Delaunay三角剖分 约束Delaunay三角剖分(CDT)的数值健壮的C ++实现使用鲁棒的几何谓词来实现数值鲁棒性可以作为仅标头使用(默认)或编译(如果定义了CDT_USE_AS_COMPILED_LIBRARY ) 许可的(MPL-...

    PennCNV2:用于检测肿瘤样本拷贝数变化的软件包

    这些通常预先安装在现代 linux 发行版上,如果没有,一个简单的命令,如“yum install gsl-devel”和“yum install boost-devel”(如果 YUM 是包管理器)就足够了。 建造 然后,您需要在locations.mk 中分配安装...

Global site tag (gtag.js) - Google Analytics