[cfe-dev] LLVM 3.8.0 clang binary for Windows targets VC++

Edward Diener via cfe-dev cfe-dev at lists.llvm.org
Wed Mar 30 07:27:21 PDT 2016

On 3/30/2016 12:57 AM, David Majnemer via cfe-dev wrote:
> On Tue, Mar 29, 2016 at 9:01 PM, Edward Diener via cfe-dev
> <cfe-dev at lists.llvm.org
> <mailto:cfe-dev at lists.llvm.org>> wrote:
>     On 3/29/2016 9:31 PM, Reid Kleckner via cfe-dev wrote:
>         On Tue, Mar 29, 2016 at 6:14 PM, Edward Diener via cfe-dev
>         <cfe-dev at lists.llvm.org
>         <mailto:cfe-dev at lists.llvm.org>
>         <mailto:cfe-dev at lists.llvm.org
>         <mailto:cfe-dev at lists.llvm.org>>> wrote:
>              Still isn't distributing a clang Windows release which by
>         default
>              targets VC++ for all clang invocations, and not just
>         clang-cl, a bit
>              of a rude awakening for all those who have used clang on
>         Windows
>              with mingw(-64)/gcc in the past ?
>         Perhaps, but this has always been the default behavior if you
>         build from
>         source with MSVC for over two years now (r199250).
>         Basically, if you build clang with mingw it will target mingw by
>         default. If you build clang with MSVC, it will target MSVC by
>         default.
>         This was deemed to be consistent with how clang works on other
>         platforms, where you get a host compiler by default. Either way,
>         you can
>         override the default with --target.
>     That make sense.
>         It also happens that for a long time after that, Hans configured the
>         builds at llvm.org/builds <http://llvm.org/builds>
>         <http://llvm.org/builds> so that 'clang'
>         targeted mingw by default, and 'clang-cl' targeted MSVC. We
>         removed that
>         flag from the packaging script some time ago, which probably
>         confused
>         some users.
>     What that did was change the default target on Windows for
>     clang/clang++ from mingw/gcc to VC++. That change turned up for the
>     LLVM 3.8 release. The confusion is that the change of the default
>     target was made but the end-user was not told about it. So the
>     end-user of clang for 3.8 on Windows, who never used a -target
>     option, now gets in many ways a different compiler when he invokes
>     clang++ for 3.8 on Windows than he had previously when he invoked
>     clang++ for 3.7.1 on down on Windows.
>     Is the clang -target option officially documented anywhere ?
> Yes: http://clang.llvm.org/docs/CrossCompilation.html#target-triple

Appreciate the link but...

What good does it do to specify 'etc.' in the doc for all the 5 target 
triple fields ? I already see that target triples I was given to use do 
not always correspond to the values given in the doc and specifying 
'etc.' just leaves the possibilities a guess. How can I as a programmer 
ever know what correct values might be ?

I was given 'i686-pc-windows-gnu' for targeting 32-bit mingw on Windows 
but I can see that the target triple doc doesn't specify 'i686' as an 
'arch' or 'windows' as a 'sys' but I know that '-target 
i686-pc-windows-gnu' actually works to target 32-bit mingw on Windows.

While it is good to have an option that defines the target atchitecture, 
if it is not completely documented what the possible options are and 
what they mean I do not see how an end-user can use such an option 

More information about the cfe-dev mailing list