Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building Boost for static linking (MinGW)

I'm building Boost (I'm using System and FileSystem) for MinGW using bjam:

bjam --toolset=gcc stage

And it builds fine, but I want to be able to statically link to it (I have to have a single file for the final product) so I tried:

bjam --link=static --toolset=gcc stage

But I get the same output. Any ideas?

edit second question in a row I've answered moments after posting :p guess I'll leave this up here for others though.

bjam --build-type=complete --toolset=gcc stage

Will build both dynamic and static for sure.

like image 775
Adam Avatar asked Jan 30 '09 06:01

Adam


2 Answers

I think link is a property as opposed to an option for bjam. That means that there should be no -- before it.

This is my command line for building only static libraries (visual c++ though):

bjam install --toolset=msvc variant=release link=static threading=multi runtime-link=static

Mapping that to your original build command I would say it should look something like this:

bjam --toolset=gcc link=static stage

or perhaps:

bjam stage --toolset=gcc link=static

Try running

bjam --help

for more info on properties and options for bjam.

like image 55
Laserallan Avatar answered Nov 14 '22 16:11

Laserallan


Just want note that with the newer boost (Feb 2011) you need to build bjam as well now.. for some reason the current downloadable bjam doesn't work cleanly.

So first:

cd ...\boost_1_45_0\tools\build\v2\engine\src

build.bat mingw

Youll need to add bjam to the PATH (from control panel, not just on the cmd prompt). Then

cd ...\boost_1_45_0\

bjam --build-type=complete --toolset=gcc stage

My setup is Vista, Boost 1.45, MinGW 4.5, and building from cmd.exe not msys.

http://code-slim-jim.blogspot.com/2011/02/boost-in-vista-using-mingw-and-cmdexe.html

like image 8
Ashley Smart Avatar answered Nov 14 '22 16:11

Ashley Smart