Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

passing compiler flags to boost libraries (such as Thread) which require compilation

So I know that the boost libraries are primarily header-only but there are a few which require compilation, for example Boost.Thread. In Darwin, how do I compile these and pass the -m32 flag so they can be compiled into a 32-bit (i386) binary? There's this Jamroot thing which I've never heard of and I am not sure at all where to start.

Clarification: I'm not asking how to compile a program with -m32 flag and use the boost libraries. I'm asking how to compile the Boost libraries themselves with the -m32 flag.

like image 865
eeeeaaii Avatar asked Aug 04 '11 16:08

eeeeaaii


2 Answers

To specify what architecture to compile for, specify the architecture feature when invoking b2.

To specify compiler options that don't already have built-in features, specify the cxxflags feature when invoking b2.

To specify linker options that don't already have built-in features, specify the linkflags feature when invoking b2.

All of these are listed in the Boost.Build docs.

like image 156
ildjarn Avatar answered Nov 15 '22 17:11

ildjarn


From what I understand, and if I read the documentation correctly, the way to build a particular architecture of boost is with the "address-model=xx" option for b2.

EXAMPLES:

b2 install toolSET=msvc-9.0 link=shared variant=release address-model=64

or

b2 install toolSET=msvc-9.0 link=shared variant=release address-model=32

Hope that helps.

Regards,

-RMWChaos

EDIT: Found another SO Thread providing the same answer here.

like image 26
RMWChaos Avatar answered Nov 15 '22 15:11

RMWChaos