Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
diana:windows:building:boost [2009-11-12 14:04:20]
dages created
diana:windows:building:boost [2022-05-31 09:29:31] (current)
Line 1: Line 1:
 ====== Building the Boost libraries on Windows ====== ====== Building the Boost libraries on Windows ======
  
-(using [[.:environment|MinGW / MSYS]])+===== Boost jam =====
  
-===== Build tools =====+This utility is used to [[boost|compile the Boost libraries]].
  
-See [[.:environment#boost_jam]].+Get the source tarball from http://downloads.sourceforge.net/project/boost/boost-jam/3.1.17/boost-jam-3.1.17.tgz; once you have it, it's a simple matter of running the build script (which will automatically detect MinGW) and installing the resulting executable:
  
-===== Main libraries =====+  $ sh ./build.sh 
 +  $ cp bin.ntx86/bjam.exe /mingw/bin 
 +  $ which bjam 
 +  /mingw/bjam.exe 
 +  $ bjam -v        
 +  Boost.Jam  Version 3.1.17. OS=NT. 
 +     Copyright 1993-2002 Christopher Seiwald and Perforce Software, Inc.   
 +     Copyright 2001 David Turner. 
 +     Copyright 2001-2004 David Abrahams. 
 +     Copyright 2002-2008 Rene Rivera. 
 +     Copyright 2003-2008 Vladimir Prus.
  
-Download the main Boost libraries from http://downloads.sourceforge.net/project/boost/boost/1.40.0/boost_1_40_0.tar.gz and extract them somewhere convenient:+===== Main libraries =====
  
-  $ tar zxvf boost/boost_1_40_0.tar.gz+Download the main Boost libraries from http://downloads.sourceforge.net/project/boost/boost and extract them somewhere convenient.
  
 Let's see what we've got: Let's see what we've got:
Line 36: Line 46:
 Jam will detect that you're running Windows and (rather then check what's available) assume that you want to use the MSVC toolchain; you have to force it to use gcc instead.  You should also use a separate build directory; it will make it easier to clean up if you make a mistake and need to start over. Jam will detect that you're running Windows and (rather then check what's available) assume that you want to use the MSVC toolchain; you have to force it to use gcc instead.  You should also use a separate build directory; it will make it easier to clean up if you make a mistake and need to start over.
  
-  mkdir obj +In principle, you could use the following command to build Boost: 
-  $ bjam toolset=gcc --prefix=/usr/local --build-dir=obj+ 
 +  bjam toolset=gcc --prefix=/opt/boost --build-dir=obj --layout=system stage 
 + 
 +If you do, though, you will get warnings about several components due to missing compiler features (e.g. ''wchar'' for [[http://www.boost.org/doc/libs/1_40_0/libs/serialization/doc/index.html|Boost.Serialization]]) and / or third-party components (e.g. Python for [[http://www.boost.org/doc/libs/1_40_0/libs/python/doc/index.html|Boost.Python]]). 
 + 
 +  $ bjam toolset=gcc variant=release link=shared threading=multi \ 
 +       --prefix=/c/met.no --build-dir=obj --layout=tagged \ 
 +       --without-graph --without-graph_parallel --without-mpi \ 
 +       --without-python --without-serialization \ 
 +       stage
  
-You will get a number of warnings about [[http://www.boost.org/doc/libs/1_40_0/libs/python/doc/index.html|Boost.Python]][[http://www.boost.org/doc/libs/1_40_0/libs/regex/doc/html/index.html|Boost.Regex]][[http://www.boost.org/doc/libs/1_40_0/libs/graph/doc/index.html|Boost.Graph]] and [[http://www.boost.org/doc/libs/1_40_0/doc/html/mpi.html|Boost.MPI]]; you can safely ignore them, as metlibs doesn't use any of them.  If it bothers you, you can disable the offending components:+To install the resultrun the exact same commandbut with ''install'' instead of ''stage'':
  
-  $ bjam toolset=gcc --prefix=/usr/local --build-dir=obj --without-python +  $ bjam toolset=gcc variant=release link=shared threading=multi \ 
-      --without-regex --without-graph --without-graph_parallel --without-mpi+       --prefix=/c/met.no --build-dir=obj --layout=tagged 
 +       --without-graph --without-graph_parallel --without-mpi \ 
 +       --without-python --without-serialization \ 
 +       install 
 +  $ cp LICENSE_1_0.txt /c/met.no/copyright/boost.txt
  
-If all goes well, you will find the libraries in the ''stage/lib'' subdirectory (under the source tree, not under ''obj''; this is IMHO a mistake on bjam's part).  You can copy them to wherever you need them to be, most likely ''/mingw/lib''.+**XXX** can't get static linking to work
  • diana/windows/building/boost.1258034660.txt.gz
  • Last modified: 2022-05-31 09:23:14
  • (external edit)