Boost logo

Boost-Build :

Subject: [Boost-build] clang and 'address-model'
From: Rich E (reakinator_at_[hidden])
Date: 2012-07-15 22:40:30


Hi all,

I ran into a problem today building i386 binaries with clang (wanting to
take advantage of libc++ / C++11 for an OS X app). I'm building 32 bit
because there are some other dependencies built this way and don't have the
time to rebuild those for 64bit.

So the problem is the 'address-model=32' bit in the following command:

./b2 -d+2 -a toolset=clang cxxflags="-std=c++11 -stdlib=libc++"
linkflags="-stdlib=libc++" architecture=x86 *address-model=32
*macosx-version=10.7
stage

When doing this, I get "error: unknown target CPU 'i386'" after every
compile command. The compile commands look like:

"clang++" -x c++ -O3 -std=c++11 -stdlib=libc++ -O3 -finline-functions
-Wno-inline -Wall -pedantic -march=i386 -DBOOST_ALL_NO_LIB=1 -DNDEBUG -I"."
-c -o
"bin.v2/libs/regex/build/clang-darwin-4.2.1/release/address-model-32/architecture-x86/link-static/macosx-version-10.7/threading-multi/cpp_regex_traits.o"
"libs/regex/build/../src/cpp_regex_traits.cpp"

Now, I'm not sure why it is '-march=i386' here instead of '-arch i386' -
I'm not really sure what -march is for but it doesn't appear to be the
right one. This can be verified by building something in Xcode / clang
that has 'Architectures' set to '32-bit Intel', and noticing the compile
command contains the -arch flag.

For good measure, the following command does produce i386 static binaries
with clang on OS X:

./b2 -d+2 -a toolset=clang cxxflags="-std=c++11 -stdlib=libc++ -arch i386"
linkflags="-stdlib=libc++ -arch i386" architecture=x86 macosx-version=10.7
stage

Cheers,
Rich

p.s. I briefly logged into the bug tracker, but didn't see an option to
file a bug, so I posted this here.



Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk