Toolset for clang in Windows under Boost

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Toolset for clang in Windows under Boost

Edward Diener
I was able to build clang successfully under Windows. It is in the PATH.
What is the bjam command for running a jamfile and using clang as my
compiler ? I tried 'bjam toolset=clang' but that returned many errors,
so it must be something different.

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Toolset for clang in Windows under Boost

Douglas Gregor
I don't believe that anyone has written a Clang toolset for bjam that works on Windows. Linux and Mac OS do work.

Sent from my iPhone

On Sep 21, 2010, at 9:29 PM, Edward Diener <[hidden email]> wrote:

> I was able to build clang successfully under Windows. It is in the PATH.
> What is the bjam command for running a jamfile and using clang as my
> compiler ? I tried 'bjam toolset=clang' but that returned many errors,
> so it must be something different.
>
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Toolset for clang in Windows under Boost

Edward Diener
On 9/22/2010 1:05 AM, Douglas Gregor wrote:
> I don't believe that anyone has written a Clang toolset for bjam that works on Windows. Linux and Mac OS do work.

You do provide a means of building clang on Windows through the VS
Studio solution. There is also a clang.hpp in boost.config which
suggests that it should support any OS.

Is there any functional difference between clang on Windows and clang on
Linux/MacOS ? What would it take to provide a toolset for clang on
Windows that can compile Boost libraries ?

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Toolset for clang in Windows under Boost

Francois Pichet
On Wed, Sep 22, 2010 at 9:57 AM, Edward Diener
<[hidden email]> wrote:
> You do provide a means of building clang on Windows through the VS
> Studio solution.

yes see: http://clang.llvm.org/get_started.html

> Is there any functional difference between clang on Windows and clang on
> Linux/MacOS ? What would it take to provide a toolset for clang on
> Windows that can compile Boost libraries ?

clang can compile boost.  On windows, it should theoretically work but
you may need to tweak the compiler command line options to make it
work. For example, if you compile clang with VS, clang will search the
msvc include directories to find #include path. But clang cannot
currently parse the msvc header files.

If you want to build boost on Windows using clang, I suggest you build
clang using MinGW.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Toolset for clang in Windows under Boost

Edward Diener
On 9/22/2010 5:16 PM, Francois Pichet wrote:

> On Wed, Sep 22, 2010 at 9:57 AM, Edward Diener
> <[hidden email]>  wrote:
>> You do provide a means of building clang on Windows through the VS
>> Studio solution.
>
> yes see: http://clang.llvm.org/get_started.html
>
>> Is there any functional difference between clang on Windows and clang on
>> Linux/MacOS ? What would it take to provide a toolset for clang on
>> Windows that can compile Boost libraries ?
>
> clang can compile boost.  On windows, it should theoretically work but
> you may need to tweak the compiler command line options to make it
> work. For example, if you compile clang with VS, clang will search the
> msvc include directories to find #include path.

I do not understand this. I am not talking about building clang, but
using clang to compile Boost. What does VS have to do with that ?

> But clang cannot
> currently parse the msvc header files.

Are you saying that clang needs the msvc header files under Windows ?

>
> If you want to build boost on Windows using clang, I suggest you build
> clang using MinGW.

It sounds like you are saying that when clang is built with VS it
automatically uses the msvc header files awhen it is used to compile
source files but if it is built with MingW it automatically uses the
MingW header files when it is used to compile source files. Can that
really be so ? I would have assumed that however it is built it would
use its own header files and standard library.

As far as the Windows SDK header files I would guess that some Boost
libraries do use them, but I do not know why they would not be able to
be used by clang.


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Toolset for clang in Windows under Boost

Francois Pichet
>> clang can compile boost.  On windows, it should theoretically work but
>> you may need to tweak the compiler command line options to make it
>> work. For example, if you compile clang with VS, clang will search the
>> msvc include directories to find #include path.
>
> I do not understand this. I am not talking about building clang, but
> using clang to compile Boost. What does VS have to do with that ?

Because you asked about building clang using Visual Studio in your
first question. So I thought you wanted to build clang using visual
studio and then using the resulting clang to build boost. It is not
going to work because when you build clang using visual studio the
default configuration is to search in the msvc include directories for
standard headers. clang cannot parse these headers.

>
>> But clang cannot
>> currently parse the msvc header files.
>
> Are you saying that clang needs the msvc header files under Windows ?

Not, if you build using MinGW.
If you build with MSVC clang will try to include from msvc by default.
To get around that use option  -nostdinc++ and -nostdinc.


> It sounds like you are saying that when clang is built with VS it
> automatically uses the msvc header files awhen it is used to compile
> source files but if it is built with MingW it automatically uses the
> MingW header files when it is used to compile source files. Can that
> really be so ? I would have assumed that however it is built it would
> use its own header files and standard library.

That's the way clang works as I understand. clang doesn't currently
ship with its own complete standard library. One is currently in
development ( libc++) but doesn't work on windows.

> As far as the Windows SDK header files I would guess that some Boost
> libraries do use them, but I do not know why they would not be able to
> be used by clang.

clang cannot currently compile the Windows SDK as provided by Microsoft.
clang can compile the Windows headers shipped with MinGW.

Anyway that's the way I understand it... I am not a clang expert yet.
I am still learning about it.

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Toolset for clang in Windows under Boost

Sebastian Redl
In reply to this post by Edward Diener

On Sep 22, 2010, at 3:46 PM, Edward Diener wrote:

>
> It sounds like you are saying that when clang is built with VS it
> automatically uses the msvc header files awhen it is used to compile
> source files but if it is built with MingW it automatically uses the
> MingW header files when it is used to compile source files. Can that
> really be so ? I would have assumed that however it is built it would
> use its own header files and standard library.
>

Clang does not have its own headers or standard library. It's only a compiler. The only headers it has are some very compiler-specific things like stdint.h and *mmintrin.h.


> As far as the Windows SDK header files I would guess that some Boost
> libraries do use them, but I do not know why they would not be able to
> be used by clang.

Because the Windows SDK contains a lot of code that depends on Microsoft's language extensions.

Sebastian
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Toolset for clang in Windows under Boost

Edward Diener
In reply to this post by Francois Pichet
On 9/22/2010 7:46 PM, Francois Pichet wrote:

>>> clang can compile boost.  On windows, it should theoretically work but
>>> you may need to tweak the compiler command line options to make it
>>> work. For example, if you compile clang with VS, clang will search the
>>> msvc include directories to find #include path.
>>
>> I do not understand this. I am not talking about building clang, but
>> using clang to compile Boost. What does VS have to do with that ?
>
> Because you asked about building clang using Visual Studio in your
> first question.

I have already successfully built clang using VS 2008 and VC9.

> So I thought you wanted to build clang using visual
> studio and then using the resulting clang to build boost. It is not
> going to work because when you build clang using visual studio the
> default configuration is to search in the msvc include directories for
> standard headers. clang cannot parse these headers.
>
>>
>>> But clang cannot
>>> currently parse the msvc header files.
>>
>> Are you saying that clang needs the msvc header files under Windows ?
>
> Not, if you build using MinGW.
> If you build with MSVC clang will try to include from msvc by default.
> To get around that use option  -nostdinc++ and -nostdinc.
>
>
>> It sounds like you are saying that when clang is built with VS it
>> automatically uses the msvc header files awhen it is used to compile
>> source files but if it is built with MingW it automatically uses the
>> MingW header files when it is used to compile source files. Can that
>> really be so ? I would have assumed that however it is built it would
>> use its own header files and standard library.
>
> That's the way clang works as I understand.

That does not make sense to me. However clang is built should be
irrelevant when one uses it. If clang really operates the way you
describe in Windows I would consider that a major flaw of the
implementation.

> clang doesn't currently
> ship with its own complete standard library. One is currently in
> development ( libc++) but doesn't work on windows.

OK, that I can believe.

>
>> As far as the Windows SDK header files I would guess that some Boost
>> libraries do use them, but I do not know why they would not be able to
>> be used by clang.
>
> clang cannot currently compile the Windows SDK as provided by Microsoft.
> clang can compile the Windows headers shipped with MinGW.

Then I will use the MingW headers when compiling clang. But I can not
believe that I would have had to build clang with MingW to do that.

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Toolset for clang in Windows under Boost

Sebastian Redl

On Sep 22, 2010, at 6:45 PM, Edward Diener wrote:

Then I will use the MingW headers when compiling clang. But I can not
believe that I would have had to build clang with MingW to do that.

You don't have to. But it sets its default header search paths depending on the compiler you use to compile it, so if you want to use the MinGW headers with a VS-built Clang, you always have to specify the search path yourself. Or you can probably change a configuration option somewhere when building it.

Sebastian

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Toolset for clang in Windows under Boost

C Bergström
In reply to this post by Edward Diener
Edward Diener wrote:
> Then I will use the MingW headers when compiling clang. But I can not
> believe that I would have had to build clang with MingW to do that.
>  
This is a build time configuration issue which most likely is just
defaulting to whatever the compiler was built with.  In another project
we had a similar problem and the way it around it is to make a
configuration option that will change the driver defaults.  If you're
familiar with c++ code and makefile/cmake it shouldn't be too difficult
to do..
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Toolset for clang in Windows under Boost

Edward Diener
In reply to this post by Sebastian Redl
On 9/22/2010 9:55 PM, Sebastian Redl wrote:
>
> On Sep 22, 2010, at 6:45 PM, Edward Diener wrote:
>>
>> Then I will use the MingW headers when compiling clang. But I can not
>> believe that I would have had to build clang with MingW to do that.
>
> You don't have to. But it sets its default header search paths depending
> on the compiler you use to compile it,

That is a real surprise. I guess it was done to make things easier for
the end-user. I found nothing about this in the documentation.

> so if you want to use the MinGW
> headers with a VS-built Clang, you always have to specify the search
> path yourself. Or you can probably change a configuration option
> somewhere when building it.

If I can figure out where I can find documentation on the command line
options of clang, I will. I am guessing the command-line options are the
same as gcc 4.5 along with whatever is in the clang User's Manual under
Command Line Options.

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Toolset for clang in Windows under Boost

Francois Pichet
> If I can figure out where I can find documentation on the command line
> options of clang, I will. I am guessing the command-line options are the
> same as gcc 4.5 along with whatever is in the clang User's Manual under
> Command Line Options.

Another gotcha is that clang cannot parse some header files bundled
with gcc 4.5 because of C++0X features not implemented by clang.

You need gcc 4.2.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Toolset for clang in Windows under Boost

Douglas Gregor
In reply to this post by Edward Diener

On Sep 22, 2010, at 8:27 PM, Edward Diener wrote:

> On 9/22/2010 9:55 PM, Sebastian Redl wrote:
>>
>> On Sep 22, 2010, at 6:45 PM, Edward Diener wrote:
>>>
>>> Then I will use the MingW headers when compiling clang. But I can not
>>> believe that I would have had to build clang with MingW to do that.
>>
>> You don't have to. But it sets its default header search paths depending
>> on the compiler you use to compile it,
>
> That is a real surprise. I guess it was done to make things easier for
> the end-user. I found nothing about this in the documentation.


It wouldn't be a surprise if Clang "just worked" on Visual Studio's headers. Clang would emulate the compiler you use, as a drop-in replacement.

However,  Windows support in general is a work-in-progress, requiring a number of Microsoft-specific extensions and emulating a number of Microsoft bugs and quirks. People are working on it, but it's not going to work seamlessly on Windows for quite a while.

        - Doug
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Toolset for clang in Windows under Boost

Edward Diener
On 9/23/2010 10:16 AM, Douglas Gregor wrote:

>
> On Sep 22, 2010, at 8:27 PM, Edward Diener wrote:
>
>> On 9/22/2010 9:55 PM, Sebastian Redl wrote:
>>>
>>> On Sep 22, 2010, at 6:45 PM, Edward Diener wrote:
>>>>
>>>> Then I will use the MingW headers when compiling clang. But I can not
>>>> believe that I would have had to build clang with MingW to do that.
>>>
>>> You don't have to. But it sets its default header search paths depending
>>> on the compiler you use to compile it,
>>
>> That is a real surprise. I guess it was done to make things easier for
>> the end-user. I found nothing about this in the documentation.
>
>
> It wouldn't be a surprise if Clang "just worked" on Visual Studio's headers. Clang would emulate the compiler you use, as a drop-in replacement.
>
> However,  Windows support in general is a work-in-progress, requiring a number of Microsoft-specific extensions and emulating a number of Microsoft bugs and quirks. People are working on it, but it's not going to work seamlessly on Windows for quite a while.

OK, I will wait to try out clang on Windows but will use it on Linux
instead. I do understand that VC++'s header files have lots of Microsoft
extensions and it is unreasonable to assume that clang should easily
support those extensions since its primary focus is in supporting the C
and C++ standards. Thanks !

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev