Boost logo

Boost Users :

Subject: Re: [Boost-users] Compiling Boost with 4 byte packing...
From: Brian Nantz (brian_at_[hidden])
Date: 2011-04-11 13:03:36


I finally got boost to build with visual studio 2008 and 4-byte packing.
 Here is what I had to do:

1. Edit the tools\build\v2\user-config.jam and add:
using msvc : vc9 :
"D:/Program Files/Microsoft Visual Studio 9.0/VC/bin/cl.exe" :
<compileflags>-DBOOST_HAS_ABI_HEADERS
<compileflags>-DBOOST_PROTO_MAX_ARITY=10
<compileflags>-DBOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
<compileflags>-DBOOST_MPL_LIMIT_METAFUNCTION_ARITY=10
<compileflags>-DWIN32
<compileflags>-D_DEBUG
<compileflags>-D_LIB
<compileflags>-D_WIN32_WINNT=0x0501
<compileflags>-D_UNICODE
<compileflags>-DUNICODE
<compileflags>-DBOOST_ASIO_ENABLE_BUFFER_DEBUGGING
<compileflags>-Gm
<compileflags>-EHsc
<compileflags>-RTC1
<compileflags>-MTd
<compileflags>-Zp4
<compileflags>-W4
<compileflags>-c
<compileflags>-ZI
<compileflags>-TP
<linkflags>/MACHINE:X86
;

2. On the bjam command line use the options: --toolset=msvc-9.0
cxxflags=-Zp4

3. Edit boost/config/user.hpp:
// BOOST_ABI_PREFIX: A prefix header to include in place of whatever
// boost.config would normally select, any replacement should set up
// struct packing and alignment options as required.
#define BOOST_ABI_PREFIX <boost/config/abi/saplib_prefix.hpp>

// BOOST_ABI_SUFFIX: A suffix header to include in place of whatever
// boost.config would normally select, any replacement should undo
// the effects of the prefix header.
#define BOOST_ABI_SUFFIX <boost/config/abi/saplib_suffix.hpp>

The prefix header just contains #pragma pack(push,4) and the suffix just
has #pragma pack(pop)

4. For some reason ASIO does not use the boost ABI header prefix and
suffix. It has its own. Edit boost/asio/detail/push_options.hpp to
use #pragma pack(push,4).

The boost build now completes cleanly (with no errors or warnings) on boost
1.43.

There seems to be some room for simplification or improvement here?



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net