Skip to content

Boost:Mingw-w64

MinGW-w64(x86_64 version MinGW)를 사용하여 Boost를 빌드하는 방법에 대하여 서술한다.

Boost MinGW-w64 compile

Download

우선, 아래의 사이트에서 Boost 최신버전을 다운받는다.
http://www.boost.org/ or http://sourceforge.net/projects/boost/

Dependency

  • Python
  • ml.exe (MASM 컴파일러: Visual Studio 설치시 동봉됨)
  • MinGW-w64 <span style='color:red'>(WARNING: PATH 화경변수에 BIN을 미리 등록하는 것이 좋다.)

Compile bjam

Boost 빌드 프로그램인 bjam을 설치해야 한다.
해당 프로그램을 별도로 다운받을 수 있지만(이곳) Boost 소스코드를 다운로드 받으면 함께 동봉되어 있다. 아래의 경로에서 확인이 가능하다.

%BOOST_ROOT%/tools/build/src/engine

이 위치에서 우선 아래와 같이 bjam을 컴파일 해야 한다.

build.bat gcc

정상적으로 컴파일 하면 bin.ntx86_64라는 디렉터리에 b2.exebjam.exe가 생성된다.

Build boost

  1. 우선 Visual Studio x64 Win64 명령 프롬프트(2010)를 실행한다. 1
  2. Boost가 설치된 루트 디렉터리2로 이동한다.
  3. 아래와 같이 입력하면 된다.
.\tools\build\src\engine\bin.ntx86_64\bjam.exe toolset=gcc address-model=64 variant=debug,release link=static,shared threading=multi install

최종적으로 C:\Boost에 컴파일 완료된 라이브러리가 설치된다. 위의 옵션을 모두 적용하면 꽤 많은 시간(1시간 이상)이 걸리므로 주의하자.

참고로 실제로 사용한 옵션은 아래와 같다.

.\tools\build\src\engine\bin.ntx86_64\bjam.exe --prefix="D:\\libs\\boost-1.56.0-build" --layout=system toolset=gcc address-model=64 variant=debug,release link=static,shared threading=multi install > build.log

Building Boost with MinGW-W64

You will require the following software:

  • MinGW-w64 Toolchain (from here)
    • for 32bit hosts targeting 32bit or 64bit
    • for 64bit hosts targeting 64bit
  • Boost Sources (from here)
    • for example boost_1_46_1.7z

Optionally:

  • Perl (from here)
    • May not be required.
  • Boost Jam Sources (from here)
    • for example boost-jam-3.1.18.zip
    • Or you can simply use the bjam from the Boost Sources

64bit Build

Add the tools to the PATH

set PATH=c:\mingw\mingw64\bin;%PATH%

Compile Boost-Jam (you can use the 32bit version instead if you compiled it already)

c:
cd \mingw\src\boost-jam-3.1.18
build.bat gcc

Compile Boost (If using the 32bit bjam.exe, Make sure you use the correct path)

c:
cd \mingw\src\boost_1_46_1
..\boost-jam-3.1.18\bin.ntx86_64\bjam.exe --prefix=c:\mingw\boost64 toolset=gcc address-model=64 variant=debug,release link=static,shared threading=multi install

(You might have to add define=BOOST_USE_WINDOWS_H to the parameter list.) You will now have a c:\mingw\boost64 directory containing the boost headers and libs :-)

Notes

  • You will see several message regarding python which should be safe to ignore.
  • You will see some message stating that 64bit is not supported for some parts of boost. If these are parts you need you should contact boost for support.
  • If you have instructions for cross compiling boost from linux, Please contact the mingw-w64 mailing list to get this page updated.

Troubleshooting

  • Thread(threading-multi)와 관련된 라이브러리가 정상적으로 설치되지 않을 경우 로그를 확인해 보면 'ml'을 찾을 수 없다고 나올 것이다. ml은 ML언어가 아닌, MASM 컴파일러 실행파일인 ml.exe를 가리키는 것이다. Visual Studio 명령 프롬프트로 bjam.exe를 실행시키면 정상적으로 설치된다.
  • undefined reference to `_Unwind_Resume'메시지가 출력될 경우 컴파일러 버전을 다시 확인해보자(정상적이지 않을 경우 해당 메시지가 출력된다).

Favorite site

Issue ticket

References


  1. 참고로 명령행 정보는: %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" amd64 

  2. bootstrap.bat파일이 존재하는 위치 

  3. (undefined reference to `_Unwind_Resume'관련 메시지)