Building Boost for static linking (MinGW)

Adam picture Adam · Jan 30, 2009 · Viewed 29.5k times · Source

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.

Answer

Laserallan picture Laserallan · Jan 30, 2009

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.