Boost logo

Boost :

Subject: Re: [boost] [clang] Using clang in Windows
From: Edward Diener (eldiener_at_[hidden])
Date: 2014-07-14 19:20:58


On 7/14/2014 6:29 PM, Christopher Kormanyos wrote:
>
>>> PS How close are we to being able to use clang with the VS IDE?
>
>> There are two problems with using clang with the VS IDE and VC++:
>
>> 1) The lesser of the two problems is that we still have not worked out
>
>> way for using Boost Build with clang targeting either gcc or VC++,
>> although we can do one or the other separately.
>
> <snip> detailed problem description...
>
>
>> 2) The greater of the two problems is that in order to compile with the
>> VC++ header files clang in Windows, targeting VC++, has had to emulate a
>> certain amount of VC++ "bugs" just to digest the header files without
>> compile errors.
>
> <snip> detailed problem description...
>
>
> May I suggest something?
>
> Sometimes an idea from an idiot such as me can provide an
> alternate way of thinking --- or not, or whatever.
> To me it seems very difficult to force clang to comprehend
> specialized VS headers and effectively deal with the VS
> preprocessor? VS is hand-crafted for the VC++ compiler
> and not designed to interact natively with a foreign compiler.
>
> Have you considered simply side-stepping the VS compiler
> for the clang compilation stage and finding the appropriate
> juncture point to re-connect object files with VS?

I am not someone who works with clang as a clang developer, changing the
clang implementation. I have just taken unto myself the task of
interfacing with clang developers as a Boost library developer. The
decisions about how clang itself targeting VC++ in Windows should work
has been made by actual clang developers. My only interface with them,
via the clang mailing list, is what can be done so that clang in Windows
is able to compile/link Boost library code. They are the ones whose goal
is to have clang targeting VC++ be able to use the VC++ header files and
VC++ lib files to create code, whether libraries or applications.

If you want to contribute suggestions about clang you can inteface with
them via the clang developers mailing list. They are not averse to
hearing what an experienced Boost library developer has to say, but
remember, as I have, that it is they who must do the work to make clang
operational in Windows.

>
> This is the object file level.
>
> If the object file format can be brought into a compatible form for VS,
> then you do not even need to force the clang compilation stage
> to interoperate with the VC++ preprocessor or the VC++ headers.

As I understand it clang does not ship with its own header/lib files
whether on Windows, Linux, or the Mac. Instead it normally uses gcc's
header/lib files. But in the case of Windows, aside from targeting gcc's
own header/lib files it is also offering an alternative of trying to
target VC++'s headers/lib files so as to be able to function as a
drop-in replacement of the VC++ compiler. Also for VC++ it must be able
to work with Windows SDK header/lib files.

>
> A big problem might be the language of the binary object files:
> VS = COFF / clang = ELF. If you can work around this, perhaps
> you can compile with clang as an external compiler and hook
> up to the linker and debugger after compilation at the object
>
> file level--- assuming of course that the object file binary format
> can somehow be made compatible with Visual Studio's COFF format.
>
> What I am saying is perhaps to simply side-step the VC++ compiler,
> do not use its preprocessor, and do not use its headers. Simply use
> clang in its entirety for compiling. You then only need to find a way
> to hook up to the object file binary format on the object file level.
> I hope I did not get something drastically wrong here, but it
> sounds like a problem that I dealt with previously.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk