Boost logo

Boost :

Subject: Re: [boost] clang-win, again
From: degski (degski_at_[hidden])
Date: 2018-10-25 07:56:18

On Thu, 25 Oct 2018 at 00:53, Edward Diener via Boost <boost_at_[hidden]>

> On 10/24/2018 6:33 PM, Egor Pugin via Boost wrote:
> >> Do you mean clang on Windows targeting vc++ or clang on Windows
> > targeting mingw-64/gcc ?
> >
> > clang-vc++ aka clang-cl
> > In other words clang in VC++ compat mode.
> >
> >
> I have this in user-config.jam for clang 7.0 on Windows targeting vc++ (
> VC++ compat mode ) :
> using msvc ;
> using clang : 7.0 : C:/Utilities/LLVM/700/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
> ;

 You are calling clang++.exe, I doubt this invokes a vc-compatible
compiler. From what I have seen is that this approach creates some weird
linux/vc chimaera (all the build paths have some linux reference in it).
I'm not saying [Peter also seems to have this approach] that this [having
compatibility mode on] is required, you're indicated progress in the
PP-realm seem to confirm that.

When Boost-1.69-rc comes out I'll waste a few more hours of my life trying
to compile Boost with Clang, I'll keep you updated. If and when you give it
another try, I would pass on the advice (and more or less request) from
STL, that is to actually use VC-15.9 (yes, that's preview) cleanly
installed, as mixing the old (14.0) and the new, we won't be able to get to
the bottom of it.

I also add C:\Utilities\LLVM\700\x64\bin first in my PATH and I manually
> invoke:
> "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
> amd64
> before the b2 invocation using toolset=clang-7.0.
> It is possible that neither of these extra actions are needed.

Your setup is migrated from VS2015. In a clean install of VS2017,
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" does
not exist.The correct path (for x64 host targeting x64) is "C:\Program
Files (x86)\Microsoft Visual
Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat". If you use the
shortcuts in the menu [Windows Key], this problem is solved for you.

You'll need to open a developer command prompt, as, if not, clang (any
clang) will have a hard time locating the VC-STL and other required
libraries in the "windows kits" [8.1 or 10.0]. You could/can also add the
[clang] path afterwards [after opening the build prompt] with 'set
PATH="C:\Utilities\LLVM\700\x64\bin";%PATH%'. Both these actions are

Also possible might be to use the -fmsc-version=1915 for vc++14.1 and
> invoke the vcvarsall,bat for Microsoft Visual Studio 14.1.

The version you put is only relevant if Boost actually does something with
the supplied information. In the meanwhile _MSC_VER should give the correct

Last but not least I would like to point out the VS2017 LLVM Compiler
Toolchain Plugin (by Zach Turner). It has (for a while now) been updated
and allows to switch cleanly between VC and Clang, within 1 project,
without having to touch either of the project settings. This plugin now
also allows to use lld as the linker, which opens up the possibility to use
thin-lto from within the IDE (this was formerly not possible). For this to
be useful in respect of Boost, it is necessary to be able to build Boost
with thin-lto enabled as otherwise this cannot work (stuff is vastly
different). Using thin-lto can give massive [yes massive] performance
boosts to your/any code.

To use the LLVM toolchain from Visual Studio after running the installer
above, install the LLVM Compiler Toolchain Visual Studio extension
(supports Visual Studio 2017 and later), select a project in Solution
Explorer, open its Property Page (Alt+F7 by default), and in the "General"
section of "Configuration Properties" change "Platform Toolset" to "llvm".
Alternatively, invoke MSBuild with /p:PlatformToolset=llvm to try out the
toolchain without modifying the project files.


*“If something cannot go on forever, it will stop" - Herbert Stein*

Boost list run by bdawes at, gregod at, cpdaniel at, john at