Boost logo

Boost :

Subject: Re: [boost] [clang] How to use CLang for Windows?
From: Edward Diener (eldiener_at_[hidden])
Date: 2013-09-29 10:30:37


On 9/28/2013 10:31 PM, Edward Diener wrote:
> On 9/28/2013 1:26 PM, Beman Dawes wrote:
>> On Tue, Sep 24, 2013 at 10:36 AM, Sergey Cheban <s.cheban_at_[hidden]>
>> wrote:
>>
>>> On 24.09.2013 16:41, Jonathan Wakely wrote:
>>>
>>> Beman said they want bug reports, so http://llvm.org/bugs/ seem the
>>>> obvious choice.
>>>>
>>> I think that it is too early to fill any external bug reports for the
>>> compiler that is unable to compile the first "hello world" example
>>> from the
>>> Stroustrup's book.
>>>
>>
>> I've confirmed in face-to-face discussion with several key Clang folks
>> that
>> they do indeed to want bug reports against the Windows port. In other
>> words, just what Jonathan said.
>
> Unfortunately there is still no workable Boost Build implementation of
> clang for Windows, so it is impossible to test clang with Boost Build. I
> built the latest clang from llvm/clang and then ran the tests of the
> central Boost library for all template metaprogramming, Boost.MPL, with
> clang on Windows. The results were many errors almost certainly because
> of some setup problem with clang and Boost Build:
>
> ------------------------------------------------------------
>
> clang-linux.compile.c++.without-pth
> ..\..\..\bin.v2\libs\mpl\test\largest_int.test\clang-linux-3.4\debug\largest_int.obj
>
>
> "C:/Programming/VersionControl/bclang/bin/Release/clang.exe" -c -x
> c++ -O0 -g -fno-inline -Wall -g -DBOOST_ALL_NO_LIB=1 -I"..\..\.." -o
> "..\..\..\bin.v2\libs\mpl\test\largest_int.test\clang-linux-3.4\debug\largest_int.obj"
> "aux_\largest_int.cpp"
>
> In file included from aux_\largest_int.cpp:14:
> In file included from ..\..\..\boost/mpl/aux_/largest_int.hpp:17:
> ..\..\..\boost/mpl/if.hpp:131:1: error: pasting formed
> 'BOOST_PP_TUPLE_ELEM_E_2(', an invalid preprocessing token
> [-Winvalid-token-paste]
> BOOST_MPL_AUX_NA_SPEC(3, if_)
> ^
> ..\..\..\boost/mpl/aux_/na_spec.hpp:149:40: note: expanded from macro
> 'BOOST_MPL_AUX_NA_SPEC'
> #define BOOST_MPL_AUX_NA_SPEC(i, name) \
> ^
> ..\..\..\boost/mpl/aux_/na_spec.hpp:142:47: note: expanded from macro '\
> BOOST_MPL_AUX_NA_SPEC_NO_ETI'
> #define BOOST_MPL_AUX_NA_SPEC_NO_ETI(i, name) \
> ^
> ..\..\..\boost/mpl/aux_/na_spec.hpp:63:9: note: expanded from macro '\
> BOOST_MPL_AUX_NA_SPEC_MAIN'
> BOOST_MPL_PP_NESTED_DEF_PARAMS_TAIL(i, typename T, na) \
> ^
> note: (skipping 5 expansions in backtrace; use -fmacro-backtrace-limit=0
> to see all)
> ..\..\..\boost/preprocessor/tuple/elem.hpp:36:114: note: expanded from
> macro 'BOOST_PP_TUPLE_ELEM'
> # define BOOST_PP_TUPLE_ELEM(size, n, tuple)
> BOOST_PP_TUPLE_ELEM_I(BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM_, n),
> BOOST_PP_CAT(BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM_E_, size), tuple))
>
> ^
> ..\..\..\boost/preprocessor/cat.hpp:22:32: note: expanded from macro
> 'BOOST_PP_CAT'
> # define BOOST_PP_CAT(a, b) BOOST_PP_CAT_I(a, b)
> ^
> ..\..\..\boost/preprocessor/cat.hpp:31:55: note: expanded from macro
> 'BOOST_PP_CAT_I'
> # define BOOST_PP_CAT_I(a, b) BOOST_PP_CAT_II(~, a ## b)

I believe part of the error is in the preprocessor config.hpp file where
clang is treated as VC++ because _MSC_VER is defined for the Windows
version of clang. I am looking to correct this now as soon as I can find
what macro define clang uses to identify itself.

It does also look as if clang complaining that '##' is an invalid
preprocessing token is an error in the Windows implementation of clang
and I will report this to clang as a bug as soon as I can create a
simple test case for it.

>
> ------------------------------------------------------------
>
> I doubt this is a clang problem per se since clang on Linux handles
> Boost.MPL quite easily. No doubt the default setup for clang in Windows
> under Boost Build does not work and I don't really know how to make it
> work.
>
> If we ever have a build of clang for Windows that works with Boost Build
> in Windows it will be a boon for testing Boost under Windows. But it is
> not yet a reality.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk