Building Boost on Windows

前端 未结 3 699
长情又很酷
长情又很酷 2021-02-15 14:22

I am trying to build boost libraries on Windows 7 x64 machine using mingw. When I try to run b2

b2 --build-dir=\"C:\\boost\\build\" --toolset=gcc --with-python
         


        
相关标签:
3条回答
  • 2021-02-15 14:46

    Here is a tutorial I had written to compile Boost 1.45.0 on Windows 7 using MinGW. I copy the tutorial here in case the link breaks:

    1) First we need to compile Boost. We'll use Boost's latest version: 1.45.0 (probably not the latest version at the time you'll read this tutorial.

    1.1) Download Boost sources:

    • http://www.boost.org/users/download/
    • or directly: http://sourceforge.net/projects/boost/files/boost/1.45.0/boost_1_45_0.7z/download)

    1.2) To compile Boost, we need to use BJam. BJam's sources are included in boost's sources. Yet, we can't use BJam's binaries: we must compile it because of the following problem: http://comments.gmane.org/gmane.comp.lib.boost.user/64146.

    To compile BJam, go to Boost's sources, find build.bat (should be located in \boost_1_45_0\tools\build\v2\engine\src), run cmd, cd to build.bat's folder and execute: build.bat gcc (source)

    Compilation lasts less than 30 seconds.

    • Note 1: gcc must be in the $PATH. If you don't have gcc, you can get it at http://www.mingw.org/wiki/InstallationHOWTOforMinGW. Use the automated installer if you don't want to waste time on it. (don't forget to select the C++ compiler during the installation, it will only install the C compiler by default)
    • Note 2: don't call cygwin's gcc otherwise you'll get an "Access denied" error, see http://omgili.com/mailinglist/cygwin/cygwin/com/m2t961f6df41004191807y75bc02cfiabd7f684a8d5f8camailgmailcom.html for more details. Better use gcc included in the MinGW you will later use with your IDE.

    1.3) Once BJam is compiled, we can now compile Boost. Add bjam.exe in $PATH, run cmd, cd \boost_1_45_0 then execute:

    bjam --toolset=gcc "--prefix=C:\DestinationFolder" install
    

    where DestinationFolder is whatever folder path you want (source).

    Compilation lasts around 30 minutes.

    0 讨论(0)
  • 2021-02-15 14:51

    For those that only need 32bit, STL's Mingw Distro has Boost included with all the libs already built for it.

    0 讨论(0)
  • 2021-02-15 14:54

    This thread is a year old, but I had the same problem and got it working, so in case anyone else needs a solution, here's mine.

    bjam was looking for a file called "boostcpp.jam" which didn't exist in the production version of boost. Luckily, you can find it on github.

    https://github.com/iNiKe/boost/blob/master/boostcpp.jam

    Download that file (or copy-paste it from your browser to a new file) and save it as "boostcpp.jam" in your boost directory (or maybe it's the location where you run bjam from...they happened to be the same directory in my situation) and run the command again. Hopefully it'll work for you too.

    0 讨论(0)
提交回复
热议问题