views:

3810

answers:

3

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.

A: 

I have not built this myself in MinGW but I believe your first build will output both dynamic and static libraries and the second only static ones, so if you did not clean the build directories in between builds it will probably look the same.

When you write "I have to have a single file..." do you mean you need a single library containing all boost libraries? If so, I suspect you may have to 'ar' them together yourself.

Fredrik Jansson
thanks for the reply, what I meant by "I have to have a single file..." is that I must have my executable, and no DLLs shipped with it.
Adam
A: 

I use the following command line to build both the statically linked as well as the dynamically linked versions of boost:

bjam  "-sBUILD=debug release <runtime-link>static/dynamic <threading>multi" stage

This is done with visual c++ on windows YMMV.

Jon Trauntvein
+13  A: 

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.

Laserallan