Boost logo

Boost-Build :

Subject: Re: [Boost-build] clang and 'address-model'
From: Jurko Gospodnetić (jurko.gospodnetic_at_[hidden])
Date: 2012-07-16 00:37:21


   Hi.

> 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

   I just checked the Boost Build sources and the -march option is
defined in tools/gcc.jam and is a gcc option documented at:
> http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html#index-march-1400

   Never used clang myself, but I understand its idea is to be gcc
compatible. Unfortunately, after 15 minutes of googling I failed to find
any documentation explaining its command-line options. :-(

   I guess someone familiar with Clang should update its toolset
definition to use different options.

   Hope this helps.

   Best regards,
     Jurko Gospodnetić


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