|
Boost : |
Subject: Re: [boost] Clang on Windows
From: John Maddock (jz.maddock_at_[hidden])
Date: 2018-03-10 08:38:54
> 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...
Best, John.
--- This email has been checked for viruses by AVG. http://www.avg.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk