Boost logo

Boost :

Subject: Re: [boost] Clang on Windows
From: Edward Diener (eldiener_at_[hidden])
Date: 2018-03-10 13:39:26


On 3/10/2018 3:38 AM, John Maddock via Boost wrote:
>
>> My use of clang-cl with clang-5.0 for x32 compilation looks like:
>>
>> using clang : 5.0cl : C:/Utilities/LLVM/500/x32/bin/clang++
>>  :
>>  <cxxflags>-fmacro-backtrace-limit=0
>>  <cxxflags>-Wno-invalid-token-paste
>>  <compileflags>-fmsc-version=1900
>>  <compileflags>--target=i686-pc-windows-msvc
>>  <linkflags>--target=i686-pc-windows-msvc
>>  <linkflags>-fuse-ld=lld
>>  ;
>>
>> It works for me pretty well when invoked as toolset=clang-5.0cl on the
>> b2 command line. Before invoking b2 I am also doing:
>>
>> call "C:\Program Files (x86)\Microsoft Visual Studio
>> 14.0\VC\vcvarsall.bat" x86
>>
>> in order to setup vc++.
>>
>> For x64 compilation it looks like:
>>
>> using clang : 5.0x64cl : C:/Utilities/LLVM/500/x64/bin/clang++
>>  :
>>  <cxxflags>-fmacro-backtrace-limit=0
>>  <cxxflags>-Wno-invalid-token-paste
>>  <compileflags>-fmsc-version=1900
>>  <compileflags>--target=x86_64-pc-windows-msvc
>>  <linkflags>--target=x86_64-pc-windows-msvc
>>  <linkflags>-fuse-ld=lld
>>  ;
>>
>
> Thanks for that, I have things semi-working with:
>
> using clang : 6.0 : "C:/Program Files/LLVM/bin/clang.exe" :
>  <cxxflags>-fmacro-backtrace-limit=0
>  <cxxstd>17
>  <cxxflags>-Wno-invalid-token-paste
>  <compileflags>-fmsc-version=1900
>  <compileflags>--target=x86_64-pc-windows-msvc
>  <linkflags>--target=x86_64-pc-windows-msvc
>  <linkflags>-lmsvcrt
>  <linkflags>-lkernel32
>  <linkflags>-luser32
>    ;
>
> But:
>
> * I can't build dll's, so I need link=static on the command line.
> * The cxxstd invocation in user-config.jam doesn't work - and clang.jam
> appends -std=c++11 to the clang command line which breaks several MS
> headers.  Adding cxxstd=17 to the b2 command line fixes that, but it's a
> pain.
> * I'm still getting linker errors I haven't been able to resolve for
> system calls even with the references to Kernal32 and User32 as above.
>
> I really think we should be using clang-cl, as I suspect it would solve
> most of this stuff...

I agree with you. My clang setup targeting msvc can not build dlls either.

>
> Best, John.


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