Boost logo

Boost-Build :

Subject: Re: [Boost-build] Clang windows toolset
From: Edward Diener (eldiener_at_[hidden])
Date: 2013-11-01 22:43:40

On 10/24/2013 4:29 PM, tr1gun wrote:
> On 24.10.2013 19:23, Edward Diener wrote:
>> On 10/23/2013 4:54 PM, tr1gun wrote:
>>> Hello,
>>> attached you find a patch to add the clang toolset for windows.
>>> clang_win.patch : adds the clang win toolset and passes the Z7 flag to
>>> the compiler. I think this version should be applied as clang developers
>>> strive to be compatible with msvc. To workaround the Z7 bug someone can
>>> pass at the command line: debug-store=database
>>> clang_win_ignore_z7.patch : Only filters the debug-store<object> / Z7
>>> command line. Probably not needed.
>>> common_clang_win.patch : add the clang-win name for mangling. I also
>>> included the visual studio version. I think it should not be left out
>>> like with the intel compiler. In the end it generates the toolset name
>>> with e.g. clang 3.4 and visual stuadio 2010: clang-win3_4_vc10
>>> There are two options to setup the toolset in user-confing.jam:
>>> 1. if clang-cl is found in path:
>>> using clang : 3.4 : : <compatibility>vc10
>>> 2. Full command line for clang-cl:
>>> using clang : 3.4 : C:\MyInstallationPath\clang-cl.exe :
>>> <compatibility>vc10 ;
>>> Hope this helps to test boost with the clang toolset.
>>> At the moment it relies on the VS*COMNTOOLS variable to look up the
>>> vcvarsall.bat file. I haven't figured out how to extract the path from
>>> the msvc.jam file. Perhaps someone else can help with it.
>>> Also the auto-link header need to be changed. I can provide a patch for
>>> it when it is clear how the boost libs will be named. This depends if
>>> the visual studio version is included or not in the library name.
>> My test with your clang_win.patch and common_clang_win.patch shows a
>> repeated:
>> "clang-cl.exe: error: no such file or directory: '/Z7'"
>> Am I supposed to use the clang_win_ignore_z7.patch instead of the
>> clang_win.patch ?
> You can use clang_win_ignore_z7.patch. Clang should probably fix the
> parsing code to ignore or handle the Z7 flag.
> About the defines/options i can add them to toolset initialization.
> At the moment it is probably easier to add them to user-config to get
> started. About the compatibility flag you can pass vc10, vc11, vc12. It
> adds the -fmsc-version command line parameter, as command line help
> suggested it would not set _MSC_VER otherwise.

I was able to test with your patches and the resulting clang-win.jam is
working pretty well. The only thing I noticed in my testing is that
clang for Windows does not accept any /EHx type parameter for setting
the exception handling mode. This is being set to /EHs as a compiler
parameter, but I have no idea how to remove this option entirely via the
clang-win.jam code. Other than that one glitch it appears that clang is
successfully compiling with the options being passed.

There are still problems with clang for Windows and Boost code but that
has nothing to do with the work you have done by providing the correct
jam files to make this work. Congratulations !

Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at