Linking in clang on Windows

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

Linking in clang on Windows

Edward Diener
Using clang on Windows what program is supposed to be called to do the
link step after compilation ?

In the Boost toolset for clang, admittedly created for clang on Linux,
it appears that the program "link.exe" is being called. But when I build
clang from the latest source for Windows using the VS2010 solution there
is no program called "link.exe" being put in the bin/release directory.
I do see a program called "llvm-link.exe" in the bin/release directory.
Is that the linker that should be invoked ?

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

Re: Linking in clang on Windows

Hans Wennborg
On Wed, Oct 9, 2013 at 12:41 PM, Edward Diener
<[hidden email]> wrote:
> Using clang on Windows what program is supposed to be called to do the link
> step after compilation ?

One has to use the link.exe that comes with Visual Studio.

There is work in progress to build a Windows-compatible linker based
on LLVM, called lld (http://lld.llvm.org/), but it's not ready yet.

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

Re: Linking in clang on Windows

Edward Diener
On 10/9/2013 4:13 PM, Hans Wennborg wrote:
> On Wed, Oct 9, 2013 at 12:41 PM, Edward Diener
> <[hidden email]> wrote:
>> Using clang on Windows what program is supposed to be called to do the link
>> step after compilation ?
>
> One has to use the link.exe that comes with Visual Studio.

And how does clang find that link.exe on Windows ? Is it expected that
the end-user must put it somewhere on his PATH ? Is the end-user
supposed to be running clang from the command line within a VC++ CoMmand
Prompt ( vcvarsall.bat setup ) ?

BTW is there any documentation anywhere on a web page about running
clang on Windows ?

>
> There is work in progress to build a Windows-compatible linker based
> on LLVM, called lld (http://lld.llvm.org/), but it's not ready yet.

Thanks for the info.


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

Re: Linking in clang on Windows

Hans Wennborg
On Wed, Oct 9, 2013 at 4:19 PM, Edward Diener
<[hidden email]> wrote:

> On 10/9/2013 4:13 PM, Hans Wennborg wrote:
>>
>> On Wed, Oct 9, 2013 at 12:41 PM, Edward Diener
>> <[hidden email]> wrote:
>>>
>>> Using clang on Windows what program is supposed to be called to do the
>>> link
>>> step after compilation ?
>>
>>
>> One has to use the link.exe that comes with Visual Studio.
>
>
> And how does clang find that link.exe on Windows ? Is it expected that the
> end-user must put it somewhere on his PATH ? Is the end-user supposed to be
> running clang from the command line within a VC++ CoMmand Prompt (
> vcvarsall.bat setup ) ?

Yes, that's the best way to run it currently.

> BTW is there any documentation anywhere on a web page about running clang on
> Windows ?

I have a patch that adds documentation about clang-cl. It should land today.

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

Re: Linking in clang on Windows

Hans Wennborg
On Wed, Oct 9, 2013 at 5:26 PM, Hans Wennborg <[hidden email]> wrote:
> On Wed, Oct 9, 2013 at 4:19 PM, Edward Diener
>> BTW is there any documentation anywhere on a web page about running clang on
>> Windows ?
>
> I have a patch that adds documentation about clang-cl. It should land today.

Here are the docs I was referring to:
http://clang.llvm.org/docs/UsersManual.html#clang-cl

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

Re: Linking in clang on Windows

Edward Diener
On 10/9/2013 9:22 PM, Hans Wennborg wrote:
> On Wed, Oct 9, 2013 at 5:26 PM, Hans Wennborg <[hidden email]> wrote:
>> On Wed, Oct 9, 2013 at 4:19 PM, Edward Diener
>>> BTW is there any documentation anywhere on a web page about running clang on
>>> Windows ?
>>
>> I have a patch that adds documentation about clang-cl. It should land today.
>
> Here are the docs I was referring to:
> http://clang.llvm.org/docs/UsersManual.html#clang-cl

Thanks very much. In Boost I am going to try to get one of the Boost
Build experts to create a toolset for clang in Windows which invokes
clang-cl from within a Visual Studio command prompt. Barring that I will
have to figure out how to create the toolset myself, although I am far
from a Boost Build expert.

I am assuming that clang in Windows should work from the VS2012 command
prompt.

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

Re: Linking in clang on Windows

Óscar Fuentes
Edward Diener <[hidden email]>
writes:

[snip]

> I am assuming that clang in Windows should work from the VS2012
> command prompt.

For some definition of "work". For C++ development, Clang+VS has a long
way to go to attain alpha stage, IMO. Clang+MinGW is more mature, but
some common features are still missing.

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

Re: Linking in clang on Windows

Edward Diener
On 10/10/2013 4:00 PM, Óscar Fuentes wrote:
> Edward Diener <[hidden email]>
> writes:
>
> [snip]
>
>> I am assuming that clang in Windows should work from the VS2012
>> command prompt.
>
> For some definition of "work".

By work I merely meant "compile and link so that the proper executables
to do so are found". I realize there is still a way to go which is why I
am trying to contribute some test/fixes from the Boost side, and
report/discuss any problems I find.

> For C++ development, Clang+VS has a long
> way to go to attain alpha stage, IMO. Clang+MinGW is more mature, but
> some common features are still missing.

I am working with Clang+VS. I use MingW with gcc under Windows but I
would really like to see clang work natively from a Windows command
prompt, not a MingW console.



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

Re: Linking in clang on Windows

Óscar Fuentes
Edward Diener <[hidden email]>
writes:

> I am working with Clang+VS. I use MingW with gcc under Windows but I
> would really like to see clang work natively from a Windows command
> prompt, not a MingW console.

FYI: mingw works fine from a Windows command prompt. The executables
that comprise the MinGW toolset are as native as cl.exe. BTW, there is
no such thing as a MinGW console.

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

Re: Linking in clang on Windows

Yonggang Luo
I guess he is talking about Mingw runtime, Indeed, I also looking for
clang + Windows SDK + ms c runtime vs clang + mingw runtime.

2013/10/11 Óscar Fuentes <[hidden email]>:

> Edward Diener <[hidden email]>
> writes:
>
>> I am working with Clang+VS. I use MingW with gcc under Windows but I
>> would really like to see clang work natively from a Windows command
>> prompt, not a MingW console.
>
> FYI: mingw works fine from a Windows command prompt. The executables
> that comprise the MinGW toolset are as native as cl.exe. BTW, there is
> no such thing as a MinGW console.
>
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



--
         此致

罗勇刚
Yours
    sincerely,
Yonggang Luo

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

Re: Linking in clang on Windows

Óscar Fuentes
"罗勇刚(Yonggang Luo)"
<[hidden email]> writes:

> I guess he is talking about Mingw runtime, Indeed, I also looking for
> clang + Windows SDK + ms c runtime vs clang + mingw runtime.

MinGW runtime is the MS runtime plus some additions (some C99 functions
and replacements for old/buggy functions.) The MS C runtime (and the VC
compiler) is seriously lacking on terms of C standards compliance.

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

Re: Linking in clang on Windows

Edward Diener
In reply to this post by Óscar Fuentes
On 10/10/2013 4:43 PM, Óscar Fuentes wrote:

> Edward Diener <[hidden email]>
> writes:
>
>> I am working with Clang+VS. I use MingW with gcc under Windows but I
>> would really like to see clang work natively from a Windows command
>> prompt, not a MingW console.
>
> FYI: mingw works fine from a Windows command prompt. The executables
> that comprise the MinGW toolset are as native as cl.exe. BTW, there is
> no such thing as a MinGW console.

MingW does provide a MingW shell, which is what I meant by the "MingW
console" but as you have pointed out it does not need the shell to
execute its output.


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

Re: Linking in clang on Windows

Óscar Fuentes
Edward Diener <[hidden email]>
writes:

> MingW does provide a MingW shell,

Possibly you are referring to the MSYS shell. MSYS is a Cygwin fork
which is completely unnecesary for using the MinGW toolset as a Windows
compiler.

[snip]

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

Re: Linking in clang on Windows

Yaron Keren
In reply to this post by Óscar Fuentes
Visual Studio 2013 improves C99 support:


do note that the *l math functions are actually double as long double is 64 bit in Visual C++ so alternative functions would still be needed in MingW.

Yaron



2013/10/11 Óscar Fuentes <[hidden email]>
"罗勇刚(Yonggang Luo)"
<[hidden email]> writes:

> I guess he is talking about Mingw runtime, Indeed, I also looking for
> clang + Windows SDK + ms c runtime vs clang + mingw runtime.

MinGW runtime is the MS runtime plus some additions (some C99 functions
and replacements for old/buggy functions.) The MS C runtime (and the VC
compiler) is seriously lacking on terms of C standards compliance.

_______________________________________________
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: Linking in clang on Windows

Edward Diener
In reply to this post by Óscar Fuentes
On 10/11/2013 5:33 AM, Óscar Fuentes wrote:
> Edward Diener <[hidden email]>
> writes:
>
>> MingW does provide a MingW shell,
>
> Possibly you are referring to the MSYS shell. MSYS is a Cygwin fork
> which is completely unnecesary for using the MinGW toolset as a Windows
> compiler.

You are right, but if I want to build clang under Windows using a
Unix-like system do I not have to use this shell ( or cygwin itself ) ?


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

Re: Linking in clang on Windows

Óscar Fuentes
Edward Diener <[hidden email]>
writes:

> You are right, but if I want to build clang under Windows using a
> Unix-like system do I not have to use this shell ( or cygwin itself )
> ?

Why do you want to build Clang under Windows using a Unix-like system?

It is perfectly possible to build Clang with MinGW without MSYS. I'll
say it is easier: just use CMake + Ninja from a Windows prompt. The same
method works for VS and most other (possibly all) OS/toolset
combinations.

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

Re: Linking in clang on Windows

Edward Diener
On 10/11/2013 12:14 PM, Óscar Fuentes wrote:

> Edward Diener <[hidden email]>
> writes:
>
>> You are right, but if I want to build clang under Windows using a
>> Unix-like system do I not have to use this shell ( or cygwin itself )
>> ?
>
> Why do you want to build Clang under Windows using a Unix-like system?
>
> It is perfectly possible to build Clang with MinGW without MSYS. I'll
> say it is easier: just use CMake + Ninja from a Windows prompt. The same
> method works for VS and most other (possibly all) OS/toolset
> combinations.

OK, I will look into this on Windows also.

What I am understanding is that I can build clang either to work with
the MingW RTL or the VC++ RTL on Windows. Up to now I have been
concentrating on using clang with the VC++ RTL.

I am trying to use Boost with clang on Windows. This means using Boost
Build, which also means using a clang toolset which will work in at
least setting up clang to compile and link 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: Linking in clang on Windows

Yaron Keren
 MingW does not have a full runtime of its own. The MingW RTL is MSVC runtime + additions and replacements.



2013/10/11 Edward Diener <[hidden email]>
On 10/11/2013 12:14 PM, Óscar Fuentes wrote:
> Edward Diener <[hidden email]>
> writes:
>
>> You are right, but if I want to build clang under Windows using a
>> Unix-like system do I not have to use this shell ( or cygwin itself )
>> ?
>
> Why do you want to build Clang under Windows using a Unix-like system?
>
> It is perfectly possible to build Clang with MinGW without MSYS. I'll
> say it is easier: just use CMake + Ninja from a Windows prompt. The same
> method works for VS and most other (possibly all) OS/toolset
> combinations.

OK, I will look into this on Windows also.

What I am understanding is that I can build clang either to work with
the MingW RTL or the VC++ RTL on Windows. Up to now I have been
concentrating on using clang with the VC++ RTL.

I am trying to use Boost with clang on Windows. This means using Boost
Build, which also means using a clang toolset which will work in at
least setting up clang to compile and link Boost libraries.


_______________________________________________
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: Linking in clang on Windows

Edward Diener
On 10/11/2013 1:35 PM, Yaron Keren wrote:
>   MingW does not have a full runtime of its own. The MingW RTL is MSVC
> runtime + additions and replacements.

Thanks for the clarification.

>
>
>
> 2013/10/11 Edward Diener <[hidden email]
> <mailto:[hidden email]>>
>
>     On 10/11/2013 12:14 PM, Óscar Fuentes wrote:
>      > Edward Diener
>     <[hidden email]
>     <mailto:[hidden email]>>
>      > writes:
>      >
>      >> You are right, but if I want to build clang under Windows using a
>      >> Unix-like system do I not have to use this shell ( or cygwin
>     itself )
>      >> ?
>      >
>      > Why do you want to build Clang under Windows using a Unix-like
>     system?
>      >
>      > It is perfectly possible to build Clang with MinGW without MSYS. I'll
>      > say it is easier: just use CMake + Ninja from a Windows prompt.
>     The same
>      > method works for VS and most other (possibly all) OS/toolset
>      > combinations.
>
>     OK, I will look into this on Windows also.
>
>     What I am understanding is that I can build clang either to work with
>     the MingW RTL or the VC++ RTL on Windows. Up to now I have been
>     concentrating on using clang with the VC++ RTL.
>
>     I am trying to use Boost with clang on Windows. This means using Boost
>     Build, which also means using a clang toolset which will work in at
>     least setting up clang to compile and link 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: Linking in clang on Windows

Edward Diener
In reply to this post by Hans Wennborg
On 10/9/2013 9:22 PM, Hans Wennborg wrote:
> On Wed, Oct 9, 2013 at 5:26 PM, Hans Wennborg <[hidden email]> wrote:
>> On Wed, Oct 9, 2013 at 4:19 PM, Edward Diener
>>> BTW is there any documentation anywhere on a web page about running clang on
>>> Windows ?
>>
>> I have a patch that adds documentation about clang-cl. It should land today.
>
> Here are the docs I was referring to:
> http://clang.llvm.org/docs/UsersManual.html#clang-cl

With what version of VC++ is clang in Windows trying to be compatible ?
Is it whatever version is used to build clang from the Visual Studio IDE ?

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