|
Boost : |
Subject: Re: [boost] Clang on Windows
From: Edward Diener (eldiener_at_[hidden])
Date: 2018-03-10 12:51:19
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...
clang targeting msvc is the same thing as clang-cl AFAIK. I have never
used 'cxxstd' with clang, although when targeting gcc using, for
example, '<cxxflags>-std=c++11', works fine for me. For what libraries
are you failing to build DLLs ? For what libraries are tou getting
linker errors involving kernel32 and user32 ?
>
> Best, John.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk