Skip to content

Instantly share code, notes, and snippets.

@pierceh89
Forked from UnaNancyOwen/Boost1.55.0.md
Last active March 14, 2016 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pierceh89/20c96a6a6125b5eb519b to your computer and use it in GitHub Desktop.
Save pierceh89/20c96a6a6125b5eb519b to your computer and use it in GitHub Desktop.
Building Boost with Visual Studio

Building Boost 1.55.0 with Visual Studio

Download

  1. Boost 1.55.0(boost_1_55_0.zip)をダウンロードしてファイルを解凍する。(C:\boost_1_55_0)
    http://www.boost.org/users/history/version_1_55_0.html
    https://github.com/boostorg/boost/tree/boost-1.55.0

  2. HPC Pack 2012 R2 MS-MPI Redistributable Package - 日本語(MSMPISetup.exe)をダウンロードしてインストールする。
    (C:\Program Files\Microsoft MPIにインストールされる。)
    http://www.microsoft.com/ja-jp/download/details.aspx?id=41634

Build

  1. Boost.Build engineの設定を修正する。

    • tools\build\v2\user-config.jam
      58 line (add)

      using mpi ;
      
    • tools\build\v2\tools\mpi.jam
      249 line

      local cluster_pack_path_native = "C:\\Program Files\\Microsoft MPI" ;
      

      251 line

      if [ GLOB $(cluster_pack_path_native)\\Inc : mpi.h ]
      

      260 line

      options = <include>$(cluster_pack_path)/Inc
      
  2. ソースコードを修正する。
    (Boost 1.55.0 Releasenote "Known Bugs with Visual Studio 2013/Visual C++ 12" http://www.boost.org/users/history/version_1_55_0.html)

    • boost\archive\iterators\transform_width.hpp
      33 line
      #include <algorithm>
      
  3. Visual Studioの開発者コマンドプロンプト(Tools\開発者コマンドプロンプト for VS2013)を管理者権限で起動して以下のコマンドを実行する。
    (開発者コマンドプロンプトを管理者権限で起動しないとinstallが失敗する。)

    • Win32

      cd C:\boost_1_55_0
      bootstrap.bat
      b2.exe toolset=msvc-12.0 address-model=32 --build-dir=build\x86 install --prefix="C:\Program Files (x86)\Boost" -j8
      
    • x64

      cd C:\boost_1_55_0
      bootstrap.bat
      b2.exe toolset=msvc-12.0 address-model=64 --build-dir=build\x64 install --prefix="C:\Program Files\Boost" -j8
      

    ※ -jオプションはコンパイルの並列数を指定する。通常はCPUの論理プロセッサ数を指定する。

Environment Variable

  1. 環境変数BOOST_ROOTを作成してBoostのパス(C:\Program Files\Boost)を設定する。

Building Boost 1.56.0 with Visual Studio (비주얼 스투디오로 Boost 빌드하는 법)

Download

  1. Boost 1.56.0(boost_1_56_0.zip)를 다운로드하여 원하는 위치에 압축을 푼다. (예: C:\boost_1_56_0)
    http://www.boost.org/users/history/version_1_56_0.html
    https://github.com/boostorg/boost/tree/boost-1.56.0

  2. HPC Pack 2012 R2 MS-MPI Redistributable Package - MSMPISetup.exe를 다운받고 설치한다. (기본 설치 경로는 C:\Program Files\Microsoft MPI 인데, Boost 설정파일을 수정할 때 필요하다.)
    http://www.microsoft.com/en-US/download/details.aspx?id=41634

Build

  1. Boost.Build engine의 설정을 조금 변경해야 한다. 텍스트 편집기로 아래 파일을 열어서 지정된 라인들을 수정해준다..

    • tools\build\example\user-config.jam
      user-config.jam를 tools\build\ 로 카피한다. 58 line (add)

      using mpi ;
      
    • tools\build\src\tools\mpi.jam
      249 line

      local cluster_pack_path_native = "C:\\Program Files\\Microsoft MPI" ;
      

      251 line

      if [ GLOB $(cluster_pack_path_native)\\Inc : mpi.h ]
      

      260 line

      options = <include>$(cluster_pack_path)/Inc 
      
  2. VS2013용 개발자 명령 프롬프트를 관리자 권한으로 실행한다.(Visual Studio Tools for VS2013, 시작->모든 프로그램->Visual Studio 2013->Tools 에서 찾을수도 있다) - 라이브러리가 64비트로 컴파일 되었는지 확인하기 위해 다음 명령어를 쓸 수 있다. dumpbin /headers LIBRARY_NAME.lib | findstr machine

(관리자 권한으로 실행하지 않으면 INSTALL이 실패하게 된다)

  • Win32 *

    cd C:\boost_1_56_0
    bootstrap.bat
    project-config.jam을 텍스트 편집기로 연다. 
    * project-config.jam  
       4 line (add)
       
       using mpi ;
       
    b2.exe toolset=msvc-12.0 address-model=32 --build-dir=build\x86 install --prefix="C:\Program Files (x86)\Boost" -j8
    
  • x64 *

    cd C:\boost_1_56_0
    bootstrap.bat
    project-config.jam을 텍스트 편집기로 연다. 
     * project-config.jam  
       4 line (add)  
       
       using mpi ;
    
    b2.exe toolset=msvc-12.0 address-model=64 --build-dir=build\x64 install --prefix="C:\Program Files\Boost" -j8
    

※ -j 옵션은 병렬 컴파일 코어 수를 지정한다. 여기서는 논리 CPU프로세서의 수를 넣어주면 된다.

Environment Variable (환경 변수)

  1. BOOST_ROOT라는 이름으로 환경변수를 저장해준다. 경로는 (C:\Program Files\Boost)

Building Boost 1.59.0 with Visual Studio

Download

  1. Boost 1.59.0(boost_1_59_0.zip)をダウンロードしてファイルを解凍する。(C:\boost_1_59_0)
    http://www.boost.org/users/history/version_1_59_0.html
    https://github.com/boostorg/boost/tree/boost-1.59.0

    • Git Command
    git clone --recursive git@github.com:boostorg/boost.git
    git tag -l
    git checkout -b boost-1.59.0 refs/tags/boost-1.59.0
    
  2. HPC Pack 2012 R2 MS-MPI Redistributable Package - 日本語(MSMPISetup.exe)をダウンロードしてインストールする。
    (C:\Program Files\Microsoft MPIにインストールされる。)
    http://www.microsoft.com/ja-jp/download/details.aspx?id=41634

Build

  1. Boost.Build Engineの設定を修正する。

    • boost_1_59_0\tools\build\src\tools\mpi.jam
      249 line
      local cluster_pack_path_native = "C:\\Program Files\\Microsoft MPI" ;
      
      251 line
      if [ GLOB $(cluster_pack_path_native)\\Inc : mpi.h ]
      
      260 line
      options = <include>$(cluster_pack_path)/Inc 
      
  2. Visual Studioの開発者コマンドプロンプト(開発者コマンドプロンプト for VS20XX)を管理者権限で起動して以下のコマンドを実行する。
    ※ 開発者コマンドプロンプトを管理者権限で起動しないとinstallが失敗する。

    • Win32

      cd C:\boost_1_59_0
      bootstrap.bat
      
    • x64

      cd C:\boost_1_59_0
      bootstrap.bat
      
  3. 生成されたproject-config.jamの設定を修正する。

    • boost_1_59_0\project-config.jam
      4 line (add)
      using mpi ;
      
  4. Visual Studioの開発者コマンドプロンプト(開発者コマンドプロンプト for VS20XX)に続けて以下のコマンドを実行する。
    ※ -jオプションはコンパイルの並列数を指定する。通常はCPUの論理プロセッサ数を指定する。
    ※ toolsetはVisual Studioのバージョンを指定する。2012は「11.0」、2013は「12.0」、2015は「14.0」を指定する。

    • Win32

      b2.exe toolset=msvc-14.0 address-model=32 --build-dir=build\x86 install --prefix="C:\Program Files (x86)\Boost" -j8
      
    • x64

      b2.exe toolset=msvc-14.0 address-model=64 --build-dir=build\x64 install --prefix="C:\Program Files\Boost" -j8
      

Environment Variable

  1. 環境変数BOOST_ROOTを作成してBoostのパス(C:\Program Files\Boost)を設定する。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment