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.