Subject: Re: [Boost-build] Building with clang for Windows/MingW
From: Edward Diener (eldiener_at_[hidden])
Date: 2014-02-04 01:25:29
On 2/3/2014 11:07 PM, Joshua Boyce wrote:
> On 2 February 2014 08:10, Edward Diener <eldiener_at_[hidden]
> <mailto:eldiener_at_[hidden]>> wrote:
> On 2/1/2014 12:30 PM, Vladimir Prus wrote:
> On 31.01.2014 03:18, Edward Diener wrote:
> When trying to test clang under Windows which is built with
> which essentially becomes clang-linux as a toolset, Boost
> Build runs with
> the options:
> -c -x c++ -O0 -g -fno-inline -Wall -g -mthreads
> However clang does not recognize -mthreads and flags it as
> an error.
> Is there anything I can do to remove this option from the
> command line when invoking Boost Build ?
> I though there's another clang-win somewhere in the works?
> According to clang web site there are two possible versions of clang
> on Windows. One uses the VC++ RTL while the other uses the MingW/gcc
> I am able to create either version on Windows7. However the VC++ RTL
> version ( clang-cl ) has numerous problems with Boost because it
> does not support VC++-style exception handling nor RTTI, issues
> already reported to clang. Also I pointed out to you a minor issue
> with the Boost build setup of that version which was created by
> another person and tweaked only very slightly by me. You did not
> seem very interested in helping to correct that issue and I am not
> knowledgable enough with Boost build to do so. Nonetheless that is
> currently a moot issue since the issue produced a warning only (
> although annoyingly repeatedly with each compile ), and clang-cl
> does not work with most of Boost because of the shortcomings of the
> clang-cl compiler itself mentioned above.
> So now I am interested to see if I can run Boost tests in Windows
> with the version of clang that can be built using MingW/gcc RTL.
> clang-linux seems suspicious to me, on Windows.
> MingW is supposed to emulate a *Nix environment. To what extent in
> relation to using Boost build as clang-linux I do not know.
> If you want to make
> clang-linux work, you probably can declare a function
> setup-threading in
> clang-linux.jam which basically forwards to gcc.setup-threading,
> except for the case of target-os=windows, where it should do
> Does this help?
> I get the idea. Thanks !
> Unsubscribe & other changes:
> Hi Edward,
> Would you mind posting (or even better - committing) a patch if you get
> this working? I hit the same roadblock (and I expect others may have
> also) and didn't have the time or Boost.Build knowledge to overcome it.
I just added to 'clang-linux.jam' these lines taken from 'gcc.jam' and
rule setup-threading ( targets * : sources * : properties * )
local threading = [ feature.get-values threading : $(properties) ] ;
if $(threading) = multi
local target = [ feature.get-values target-os : $(properties) ] ;
local option ;
local libs ;
case windows : # No threading options.
# case windows : option = -mthreads ;
case cygwin : option = -mthreads ;
case solaris : option = -pthreads ; libs = rt ;
case beos : # No threading options.
case *bsd : option = -pthread ; # There is no -lrt on BSD.
case sgi : # gcc on IRIX does not support multi-threading.
case darwin : # No threading options.
case * : option = -pthread ; libs = rt ;
OPTIONS on $(targets) += $(option) ;
FINDLIBS-SA on $(targets) += $(libs) ;
However I also found out that clang on Windows using MingW/gcc RTL does
NOT support multi-threading at all. So IMO it is particularly useless
when used with Boost libraries. Basically I decided, at least for
myself, that I will forgo trying to test with clang under Windows,
whether with clang with MingW/gcc RTL or clang-cl with VC++ RTL, until
clang under Windows gets those features which make it usable with
current Boost libraries. Your own choice may be different.
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