Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I force a 32-bit build of Boost with GCC?

Tags:

How do I force a 32-bit build of Boost with GCC? Currently attempting by putting this line in my user-config.jam, but it does not work:

using gcc : 4.1.2 : g++ : compileflags="-m32" ;
like image 336
Crazy Chenz Avatar asked Aug 31 '09 14:08

Crazy Chenz


People also ask

Is GCC 32 bit compiler?

The -m32 flag tells GCC to compile in 32-bit mode.

How do you compile a boost?

To compile anything in Boost, you need a directory containing the boost/ subdirectory in your #include path. depending on your preference regarding the use of angle bracket includes. Don't be distracted by the doc/ subdirectory; it only contains a subset of the Boost documentation. Start with libs/index.


2 Answers

This answer helped me toward a solution that worked for me. I was trying to compile a 32-bits version of boost_1_43_0 on 64-bits debian and eventually came up with this:

./bjam                 \
  cflags=-m32          \
  cxxflags=-m32        \
  address-model=32     \
  threading=multi      \
  architecture=x86     \
  instruction-set=i686 \ 
  stage
like image 42
Andrew Meadows Avatar answered Sep 28 '22 14:09

Andrew Meadows


If you are using C++ Boost 1.40, use:

bjam address-model=32

If you are using eariler version, consider upgrading. If you cannot, use

bjam address-model=32 architecture=x86

I also recommend that you take a look at the fine manual

like image 195
Vladimir Prus Avatar answered Sep 28 '22 13:09

Vladimir Prus