<div dir="ltr">I think this change might be causing the problem you are seeing: <a href="https://reviews.llvm.org/D30758">https://reviews.llvm.org/D30758</a><div><br></div><div><div><br></div><div><br><div><span style="background-color:rgb(255,255,255)"><span style="font-family:Menlo,Consolas,Monaco,monospace;font-size:11px;white-space:pre-wrap"><font color="#000000"><br></font></span></span></div><div><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 14, 2017 at 6:17 PM, Reid Kleckner via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class=""><div class="gmail_extra">> 2. Is there a simple way for me to get Clang 4.0's behavior back, where having cl.exe and link.exe on my PATH makes Clang automatically detect the correct -fms-compatibility-version and link.exe to be used?<br></div><div class="gmail_extra"><br></div></span><div class="gmail_extra">I haven't figured out what changed, but that definitely seems like a regression.</div><div><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 14, 2017 at 6:04 PM, Stephan T. Lavavej via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Clang devs,<br>
<br>
I'm trying to use Clang/LLVM with MSVC's STL in order to keep our code conformant and Clang-compatible, and I've encountered a problematic behavior change between Clang 4.0 and 5.0.<br>
<br>
The only Visual Studio installation on my machine is VS 2013. (I work on msvcp140.dll, so my life is easier if I avoid anything that installs it system-wide like VS 2015/2017.)<br>
<br>
I am NOT using a VS 2013 Developer Command Prompt.<br>
<br>
I'm starting with a plain command prompt, using a development build of VS 2017 (somewhat beyond 15.3) by adding it to PATH, INCLUDE, and LIB. (I'm NOT running an installer for this development build, nor am I modifying the registry in any way.) The directory structure of our development build is simple, although it does not correspond to the publicly distributed installer. On my machine, I have S:\binaries\x86ret, with S:\binaries\x86ret\bin\i386\cl<wbr>.exe containing the x86-native compiler, S:\binaries\x86ret\inc\vector containing my favorite header, and S:\binaries\x86ret\lib\i386\li<wbr>bcpmt.lib containing the STL's static lib. (The CRT's headers and libs are in different directories, but Clang isn't having trouble with INCLUDE and LIB.)<br>
<br>
I've also used 7-Zip to extract Clang/LLVM 4.0.1 x64-hosted to a directory, WITHOUT running an installer.<br>
<br>
In this scenario, everything works fine, and we've been testing our STL with Clang/LLVM since June (originally 4.0.0, now 4.0.1):<br>
<br>
C:\Temp>echo %PATH%<br>
S:\WCFB01\vctools\nonship\bin\<wbr>x86;S:\binaries\x86ret\bin\i38<wbr>6;S:\WCFB01\vctools\Compiler\<wbr>Regress\bin\AMD64\xperf;S:\<wbr>WCFB01\vctools\NonShip\<wbr>ClangLLVM\bin;C:\Temp\Exec;C:\<wbr>Temp\git\cmd;C:\windows\<wbr>system32;C:\windows;C:\<wbr>windows\System32\Wbem;C:\windo<wbr>ws\System32\WindowsPowerShell\<wbr>v1.0\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Prog<wbr>ram Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Users\<wbr>stl\AppData\Local\Microsoft\Wi<wbr>ndowsApps;;S:\WCFB01\vctools\<wbr>Compiler\Regress\bin;S:\<wbr>WCFB01\vctools\Compiler\Regres<wbr>s\bin\AMD64;;S:\WCFB01\tools\<wbr>perl\bin<br>
<br>
C:\Temp>echo %INCLUDE%<br>
S:\binaries\x86ret\atlmfc\incl<wbr>ude;S:\binaries\x86ret\inc;S:\<wbr>WCFB01\ExternalApis\Windows\<wbr>10\sdk\inc;S:\WCFB01\ExternalA<wbr>pis\UnifiedCRT\inc;S:\WCFB01\<wbr>ExternalAPIs\DirectX\Jun2010\<wbr>Include;<br>
<br>
C:\Temp>echo %LIB%<br>
S:\binaries\x86ret\atlmfc\lib\<wbr>i386;S:\binaries\x86ret\lib\i3<wbr>86;S:\WCFB01\ExternalApis\Wind<wbr>ows\10\sdk\lib\x86;S:\WCFB01\<wbr>ExternalApis\UnifiedCRT\lib\<wbr>i386;S:\WCFB01\ExternalApis\<wbr>NetFX\v4.5\lib\x86;S:\WCFB01\<wbr>ExternalAPIs\DirectX\Jun2010\<wbr>Lib\x86;<br>
<br>
C:\Temp>type meow.cpp<br>
#include <iostream><br>
int main() {<br>
#ifdef __clang__<br>
std::cout << "I am Clang: " << __clang_version__ << "\n";<br>
#elif defined(_MSC_VER)<br>
std::cout << "I am C1XX: " << _MSC_FULL_VER << "\n";<br>
#else<br>
std::cout << "I am something else.\n";<br>
#endif<br>
}<br>
<br>
C:\Temp>where cl<br>
S:\binaries\x86ret\bin\i386\cl<wbr>.exe<br>
<br>
C:\Temp>where link<br>
S:\binaries\x86ret\bin\i386\li<wbr>nk.exe<br>
<br>
C:\Temp>cl /EHsc /nologo /W4 /MT meow.cpp && meow<br>
meow.cpp<br>
I am C1XX: 191125614<br>
<br>
C:\Temp>where clang-cl<br>
S:\WCFB01\vctools\NonShip\Clan<wbr>gLLVM\bin\clang-cl.exe<br>
<br>
C:\Temp>clang-cl -v -m32 /EHsc /nologo /W4 /MT meow.cpp && meow<br>
clang version 4.0.1 (tags/RELEASE_401/final)<br>
Target: i386-pc-windows-msvc<br>
Thread model: posix<br>
InstalledDir: S:\WCFB01\vctools\NonShip\Clan<wbr>gLLVM\bin<br>
"S:\\WCFB01\\vctools\\<wbr>NonShip\\ClangLLVM\\bin\\<wbr>clang-cl.exe" -cc1 -triple i386-pc-windows-msvc19.11.2561<wbr>4 -emit-obj -mrelax-all -mincremental-linker-compatibl<wbr>e -disable-free -main-file-name meow.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim -relaxed-aliasing -fmath-errno -masm-verbose -mconstructor-aliases -target-cpu pentium4 -D_MT -flto-visibility-public-std --dependent-lib=libcmt --dependent-lib=oldnames -stack-protector 2 -fcxx-exceptions -fexceptions -fexternc-nounwind -fms-volatile -fdiagnostics-format msvc -v -dwarf-column-info -debugger-tuning=gdb -resource-dir "S:\\WCFB01\\vctools\\NonShip\<wbr>\ClangLLVM\\bin\\..\\lib\\clan<wbr>g\\4.0.1" -internal-isystem "S:\\WCFB01\\vctools\\NonShip\<wbr>\ClangLLVM\\bin\\..\\lib\\clan<wbr>g\\4.0.1\\include" -internal-isystem "S:\\binaries\\x86ret\\atlmfc\<wbr>\include" -internal-isystem "S:\\binaries\\x86ret\\inc" -internal-isystem "S:\\WCFB01\\ExternalApis\\Win<wbr>dows\\10\\sdk\\inc" -internal-isystem "S:\\WCFB01\\ExternalApis\\Uni<wbr>fiedCRT\\inc" -internal-isystem "S:\\WCFB01\\ExternalAPIs\\Dir<wbr>ectX\\Jun2010\\Include" -WCL4 -fdeprecated-macro -fdebug-compilation-dir "C:\\Temp" -ferror-limit 19 -fmessage-length 120 -fms-extensions -fms-compatibility -fms-compatibility-version=19.<wbr>11.25614 -std=c++14 -fdelayed-template-parsing -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o "C:\\Users\\stl\\AppData\\Loca<wbr>l\\Temp\\1\\meow-291efe.obj" -x c++ meow.cpp<br>
clang -cc1 version 4.0.1 based upon LLVM 4.0.1 default target x86_64-pc-windows-msvc<br>
#include "..." search starts here:<br>
#include <...> search starts here:<br>
S:\WCFB01\vctools\NonShip\Cla<wbr>ngLLVM\bin\..\lib\clang\4.0.1\<wbr>include<br>
S:\binaries\x86ret\atlmfc\inc<wbr>lude<br>
S:\binaries\x86ret\inc<br>
S:\WCFB01\ExternalApis\Window<wbr>s\10\sdk\inc<br>
S:\WCFB01\ExternalApis\Unifie<wbr>dCRT\inc<br>
S:\WCFB01\ExternalAPIs\Direct<wbr>X\Jun2010\Include<br>
End of search list.<br>
"S:\\binaries\\x86ret\\bin\\i<wbr>386\\link.exe" -out:meow.exe -nologo "C:\\Users\\stl\\AppData\\Loca<wbr>l\\Temp\\1\\meow-291efe.obj"<br>
I am Clang: 4.0.1 (tags/RELEASE_401/final)<br>
<br>
Observe that my C1XX version, 19.11.25614, is detected by Clang which passes -fms-compatibility-version=19.<wbr>11.25614 and defaults to -std=c++14. The linker from my development build is also used, S:\binaries\x86ret\bin\i386\li<wbr>nk.exe.<br>
<br>
Next, I deleted everything in S:\WCFB01\vctools\NonShip\Clan<wbr>gLLVM\, downloaded <a href="http://prereleases.llvm.org/5.0.0/rc2/LLVM-5.0.0-rc2-win64.exe" rel="noreferrer" target="_blank">http://prereleases.llvm.org/5.<wbr>0.0/rc2/LLVM-5.0.0-rc2-win64.e<wbr>xe</a> (grinding my teeth at non-secure HTTP), and extracted 5.0.0-rc2 there:<br>
<br>
S:\WCFB01\vctools\NonShip\Clan<wbr>gLLVM>dir /b<br>
<br>
S:\WCFB01\vctools\NonShip\Clan<wbr>gLLVM>7z x C:\Temp\LLVM-5.0.0-rc2-win64.e<wbr>xe -x!Uninstall.exe -x!$PLUGINSDIR\*<br>
<br>
7-Zip [64] 16.04 : Copyright (c) 1999-2016 Igor Pavlov : 2016-10-04<br>
<br>
Scanning the drive for archives:<br>
1 file, 131097761 bytes (126 MiB)<br>
<br>
Extracting archive: C:\Temp\LLVM-5.0.0-rc2-win64.e<wbr>xe<br>
--<br>
Path = C:\Temp\LLVM-5.0.0-rc2-win64.e<wbr>xe<br>
Type = Nsis<br>
Physical Size = 131097761<br>
Method = LZMA:25<br>
Solid = +<br>
Headers Size = 205263<br>
Embedded Stub Size = 114176<br>
SubType = NSIS-3<br>
<br>
Everything is Ok<br>
<br>
Files: 291<br>
Size: 1096683135<br>
Compressed: 131097761<br>
<br>
S:\WCFB01\vctools\NonShip\Clan<wbr>gLLVM>dir /b<br>
bin<br>
include<br>
lib<br>
libexec<br>
msbuild-bin<br>
share<br>
tools<br>
<br>
Now in my usual command prompt (where PATH, INCLUDE, and LIB are unchanged):<br>
<br>
C:\Temp>where clang-cl<br>
S:\WCFB01\vctools\NonShip\Clan<wbr>gLLVM\bin\clang-cl.exe<br>
<br>
C:\Temp>clang-cl -v -m32 /EHsc /nologo /W4 /MT meow.cpp && meow<br>
clang version 5.0.0 (tags/RELEASE_500/rc2)<br>
Target: i386-pc-windows-msvc<br>
Thread model: posix<br>
InstalledDir: S:\WCFB01\vctools\NonShip\Clan<wbr>gLLVM\bin<br>
"S:\\WCFB01\\vctools\\<wbr>NonShip\\ClangLLVM\\bin\\<wbr>clang-cl.exe" -cc1 -triple i386-pc-windows-msvc18.0.40629 -emit-obj -mrelax-all -mincremental-linker-compatibl<wbr>e -disable-free -main-file-name meow.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim -relaxed-aliasing -fmath-errno -masm-verbose -mconstructor-aliases -target-cpu pentium4 -D_MT -flto-visibility-public-std --dependent-lib=libcmt --dependent-lib=oldnames -stack-protector 2 -fcxx-exceptions -fexceptions -fexternc-nounwind -fms-volatile -fdiagnostics-format msvc -v -dwarf-column-info -debugger-tuning=gdb -resource-dir "S:\\WCFB01\\vctools\\NonShip\<wbr>\ClangLLVM\\lib\\clang\\5.0.0" -internal-isystem "S:\\WCFB01\\vctools\\NonShip\<wbr>\ClangLLVM\\lib\\clang\\5.0.0\<wbr>\include" -internal-isystem "S:\\binaries\\x86ret\\atlmfc\<wbr>\include" -internal-isystem "S:\\binaries\\x86ret\\inc" -internal-isystem "S:\\WCFB01\\ExternalApis\\Win<wbr>dows\\10\\sdk\\inc" -internal-isystem "S:\\WCFB01\\ExternalApis\\Uni<wbr>fiedCRT\\inc" -internal-isystem "S:\\WCFB01\\ExternalAPIs\\Dir<wbr>ectX\\Jun2010\\Include" -WCL4 -fdeprecated-macro -fdebug-compilation-dir "C:\\Temp" -ferror-limit 19 -fmessage-length 120 -fms-extensions -fms-compatibility -fms-compatibility-version=18.<wbr>0.40629 -std=c++11 -fno-threadsafe-statics -fdelayed-template-parsing -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o "C:\\Users\\stl\\AppData\\Loca<wbr>l\\Temp\\1\\meow-e93677.obj" -x c++ meow.cpp<br>
clang -cc1 version 5.0.0 based upon LLVM 5.0.0-rc2 default target x86_64-pc-windows-msvc<br>
#include "..." search starts here:<br>
#include <...> search starts here:<br>
S:\WCFB01\vctools\NonShip\Cla<wbr>ngLLVM\lib\clang\5.0.0\include<br>
S:\binaries\x86ret\atlmfc\inc<wbr>lude<br>
S:\binaries\x86ret\inc<br>
S:\WCFB01\ExternalApis\Window<wbr>s\10\sdk\inc<br>
S:\WCFB01\ExternalApis\Unifie<wbr>dCRT\inc<br>
S:\WCFB01\ExternalAPIs\Direct<wbr>X\Jun2010\Include<br>
End of search list.<br>
In file included from meow.cpp:1:<br>
In file included from S:\binaries\x86ret\inc\iostrea<wbr>m:6:<br>
In file included from S:\binaries\x86ret\inc\istream<wbr>:6:<br>
In file included from S:\binaries\x86ret\inc\ostream<wbr>:6:<br>
In file included from S:\binaries\x86ret\inc\ios:6:<br>
In file included from S:\binaries\x86ret\inc\xlocnum<wbr>:7:<br>
In file included from S:\binaries\x86ret\inc\cmath:6<wbr>17:<br>
In file included from S:\binaries\x86ret\inc\xtgmath<wbr>.h:9:<br>
S:\binaries\x86ret\inc\xtr1com<wbr>mon(199,22) : error: use of undeclared identifier 'char16_t'<br>
struct _Is_integral<char16_t><br>
^<br>
S:\binaries\x86ret\inc\xtr1com<wbr>mon(205,22) : error: use of undeclared identifier 'char32_t'<br>
struct _Is_integral<char32_t><br>
^<br>
In file included from meow.cpp:1:<br>
In file included from S:\binaries\x86ret\inc\iostrea<wbr>m:6:<br>
In file included from S:\binaries\x86ret\inc\istream<wbr>:6:<br>
In file included from S:\binaries\x86ret\inc\ostream<wbr>:6:<br>
In file included from S:\binaries\x86ret\inc\ios:6:<br>
In file included from S:\binaries\x86ret\inc\xlocnum<wbr>:10:<br>
In file included from S:\binaries\x86ret\inc\streamb<wbr>uf:6:<br>
In file included from S:\binaries\x86ret\inc\xiosbas<wbr>e:6:<br>
In file included from S:\binaries\x86ret\inc\xlocale<wbr>:8:<br>
In file included from S:\binaries\x86ret\inc\stdexce<wbr>pt:6:<br>
In file included from S:\binaries\x86ret\inc\excepti<wbr>on:7:<br>
In file included from S:\binaries\x86ret\inc\type_tr<wbr>aits:6:<br>
S:\binaries\x86ret\inc\xstddef<wbr>(257,2) : error: 'auto' return without trailing return type; deduced return types are a<br>
C++14 extension<br>
auto _Unfancy(_Ptrty _Ptr)<br>
^<br>
[...more errors...]<br>
<br>
Now I'm getting -fms-compatibility-version=18.<wbr>0.40629 -std=c++11 which is thoroughly incompatible with my development build's headers (in S:\binaries\x86ret\inc).<br>
<br>
Let's add -fms-compatibility-version=19.<wbr>11.25614 and see what happens:<br>
<br>
C:\Temp>clang-cl -v -m32 /EHsc /nologo /W4 /MT -fms-compatibility-version=19.<wbr>11.25614 meow.cpp && meow<br>
clang version 5.0.0 (tags/RELEASE_500/rc2)<br>
Target: i386-pc-windows-msvc<br>
Thread model: posix<br>
InstalledDir: S:\WCFB01\vctools\NonShip\Clan<wbr>gLLVM\bin<br>
"S:\\WCFB01\\vctools\\<wbr>NonShip\\ClangLLVM\\bin\\<wbr>clang-cl.exe" -cc1 -triple i386-pc-windows-msvc19.11.2561<wbr>4 -emit-obj -mrelax-all -mincremental-linker-compatibl<wbr>e -disable-free -main-file-name meow.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim -relaxed-aliasing -fmath-errno -masm-verbose -mconstructor-aliases -target-cpu pentium4 -D_MT -flto-visibility-public-std --dependent-lib=libcmt --dependent-lib=oldnames -stack-protector 2 -fcxx-exceptions -fexceptions -fexternc-nounwind -fms-volatile -fdiagnostics-format msvc -v -dwarf-column-info -debugger-tuning=gdb -resource-dir "S:\\WCFB01\\vctools\\NonShip\<wbr>\ClangLLVM\\lib\\clang\\5.0.0" -internal-isystem "S:\\WCFB01\\vctools\\NonShip\<wbr>\ClangLLVM\\lib\\clang\\5.0.0\<wbr>\include" -internal-isystem "S:\\binaries\\x86ret\\atlmfc\<wbr>\include" -internal-isystem "S:\\binaries\\x86ret\\inc" -internal-isystem "S:\\WCFB01\\ExternalApis\\Win<wbr>dows\\10\\sdk\\inc" -internal-isystem "S:\\WCFB01\\ExternalApis\\Uni<wbr>fiedCRT\\inc" -internal-isystem "S:\\WCFB01\\ExternalAPIs\\Dir<wbr>ectX\\Jun2010\\Include" -WCL4 -fdeprecated-macro -fdebug-compilation-dir "C:\\Temp" -ferror-limit 19 -fmessage-length 120 -fms-extensions -fms-compatibility -fms-compatibility-version=19.<wbr>11.25614 -std=c++14 -fdelayed-template-parsing -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o "C:\\Users\\stl\\AppData\\Loca<wbr>l\\Temp\\1\\meow-06d238.obj" -x c++ meow.cpp<br>
clang -cc1 version 5.0.0 based upon LLVM 5.0.0-rc2 default target x86_64-pc-windows-msvc<br>
#include "..." search starts here:<br>
#include <...> search starts here:<br>
S:\WCFB01\vctools\NonShip\Cla<wbr>ngLLVM\lib\clang\5.0.0\include<br>
S:\binaries\x86ret\atlmfc\inc<wbr>lude<br>
S:\binaries\x86ret\inc<br>
S:\WCFB01\ExternalApis\Window<wbr>s\10\sdk\inc<br>
S:\WCFB01\ExternalApis\Unifie<wbr>dCRT\inc<br>
S:\WCFB01\ExternalAPIs\Direct<wbr>X\Jun2010\Include<br>
End of search list.<br>
"C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\bin\\link.exe" -out:meow.exe -nologo "C:\\Users\\stl\\AppData\\Loca<wbr>l\\Temp\\1\\meow-06d238.obj"<br>
libcmt.lib(new_scalar.obj) : warning LNK4229: invalid directive '/ThrowingNew' encountered; ignored<br>
libvcruntime.lib(trnsctrl.obj) : warning LNK4229: invalid directive '/GUARDSYM:___CxxFrameHandler,<wbr>S' encountered; ignored<br>
libvcruntime.lib(trnsctrl.obj) : warning LNK4229: invalid directive '/GUARDSYM:___CxxFrameHandler3<wbr>,S' encountered; ignored<br>
libvcruntime.lib(trnsctrl.obj) : warning LNK4229: invalid directive '/GUARDSYM:___CxxFrameHandler2<wbr>,S' encountered; ignored<br>
libvcruntime.lib(trnsctrl.obj) : warning LNK4229: invalid directive '/GUARDSYM:___CxxLongjmpUnwind<wbr>@4,S' encountered; ignored<br>
libvcruntime.lib(chandler4.obj<wbr>) : warning LNK4229: invalid directive '/GUARDSYM:__except_handler4,S<wbr>' encountered; ignored<br>
libcmt.lib(loadcfg.obj) : error LNK2001: unresolved external symbol ___guard_iat_table<br>
libcmt.lib(loadcfg.obj) : error LNK2001: unresolved external symbol ___guard_iat_count<br>
libcmt.lib(loadcfg.obj) : error LNK2001: unresolved external symbol ___guard_longjmp_table<br>
libcmt.lib(loadcfg.obj) : error LNK2001: unresolved external symbol ___guard_longjmp_count<br>
meow.exe : fatal error LNK1120: 4 unresolved externals<br>
clang-cl.exe: error: linker command failed with exit code 1120 (use -v to see invocation)<br>
<br>
That additionally activates -std=c++14, and compilation succeeds. However, VS 2013's linker is used - that's the "C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\bin\\link.exe" - and it's unable to understand various parts of VS 2017-era libraries.<br>
<br>
Trying to add -fuse-ld=S:\binaries\x86ret\bi<wbr>n\i386\link.exe doesn't work:<br>
<br>
C:\Temp>clang-cl -v -m32 /EHsc /nologo /W4 /MT -fms-compatibility-version=19.<wbr>11.25614 -fuse-ld=S:\binaries\x86ret\bi<wbr>n\i386\link.exe meow.cpp && meow<br>
clang version 5.0.0 (tags/RELEASE_500/rc2)<br>
Target: i386-pc-windows-msvc<br>
Thread model: posix<br>
InstalledDir: S:\WCFB01\vctools\NonShip\Clan<wbr>gLLVM\bin<br>
"S:\\WCFB01\\vctools\\<wbr>NonShip\\ClangLLVM\\bin\\<wbr>clang-cl.exe" -cc1 -triple i386-pc-windows-msvc19.11.2561<wbr>4 -emit-obj -mrelax-all -mincremental-linker-compatibl<wbr>e -disable-free -main-file-name meow.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim -relaxed-aliasing -fmath-errno -masm-verbose -mconstructor-aliases -target-cpu pentium4 -D_MT -flto-visibility-public-std --dependent-lib=libcmt --dependent-lib=oldnames -stack-protector 2 -fcxx-exceptions -fexceptions -fexternc-nounwind -fms-volatile -fdiagnostics-format msvc -v -dwarf-column-info -debugger-tuning=gdb -resource-dir "S:\\WCFB01\\vctools\\NonShip\<wbr>\ClangLLVM\\lib\\clang\\5.0.0" -internal-isystem "S:\\WCFB01\\vctools\\NonShip\<wbr>\ClangLLVM\\lib\\clang\\5.0.0\<wbr>\include" -internal-isystem "S:\\binaries\\x86ret\\atlmfc\<wbr>\include" -internal-isystem "S:\\binaries\\x86ret\\inc" -internal-isystem "S:\\WCFB01\\ExternalApis\\Win<wbr>dows\\10\\sdk\\inc" -internal-isystem "S:\\WCFB01\\ExternalApis\\Uni<wbr>fiedCRT\\inc" -internal-isystem "S:\\WCFB01\\ExternalAPIs\\Dir<wbr>ectX\\Jun2010\\Include" -WCL4 -fdeprecated-macro -fdebug-compilation-dir "C:\\Temp" -ferror-limit 19 -fmessage-length 120 -fms-extensions -fms-compatibility -fms-compatibility-version=19.<wbr>11.25614 -std=c++14 -fdelayed-template-parsing -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o "C:\\Users\\stl\\AppData\\Loca<wbr>l\\Temp\\1\\meow-74e9f6.obj" -x c++ meow.cpp<br>
clang -cc1 version 5.0.0 based upon LLVM 5.0.0-rc2 default target x86_64-pc-windows-msvc<br>
#include "..." search starts here:<br>
#include <...> search starts here:<br>
S:\WCFB01\vctools\NonShip\Cla<wbr>ngLLVM\lib\clang\5.0.0\include<br>
S:\binaries\x86ret\atlmfc\inc<wbr>lude<br>
S:\binaries\x86ret\inc<br>
S:\WCFB01\ExternalApis\Window<wbr>s\10\sdk\inc<br>
S:\WCFB01\ExternalApis\Unifie<wbr>dCRT\inc<br>
S:\WCFB01\ExternalAPIs\Direct<wbr>X\Jun2010\Include<br>
End of search list.<br>
"x86_64-pc-windows-msvc-S:\\b<wbr>inaries\\x86ret\\bin\\i386\\li<wbr>nk.exe" -out:meow.exe -nologo "C:\\Users\\stl\\AppData\\Loca<wbr>l\\Temp\\1\\meow-74e9f6.obj"<br>
clang-cl.exe: error: unable to execute command: program not executable<br>
clang-cl.exe: error: linker command failed with exit code 1 (use -v to see invocation)<br>
<br>
Some searching led me to <a href="https://github.com/llvm-mirror/clang/commit/635bc7fefc12cc1333ba6ec77e563b7c8af01265" rel="noreferrer" target="_blank">https://github.com/llvm-mirror<wbr>/clang/commit/635bc7fefc12cc13<wbr>33ba6ec77e563b7c8af01265</a> "Accept absolute paths in the -fuse-ld option." so I'm not sure why this doesn't work.<br>
<br>
I'm not picky about the linker (and I don't need debug info), so let's try -fuse-ld=lld-link and see what happens:<br>
<br>
C:\Temp>clang-cl -v -m32 /EHsc /nologo /W4 /MT -fms-compatibility-version=19.<wbr>11.25614 -fuse-ld=lld-link meow.cpp && meow<br>
clang version 5.0.0 (tags/RELEASE_500/rc2)<br>
Target: i386-pc-windows-msvc<br>
Thread model: posix<br>
InstalledDir: S:\WCFB01\vctools\NonShip\Clan<wbr>gLLVM\bin<br>
"S:\\WCFB01\\vctools\\<wbr>NonShip\\ClangLLVM\\bin\\<wbr>clang-cl.exe" -cc1 -triple i386-pc-windows-msvc19.11.2561<wbr>4 -emit-obj -mrelax-all -mincremental-linker-compatibl<wbr>e -disable-free -main-file-name meow.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim -relaxed-aliasing -fmath-errno -masm-verbose -mconstructor-aliases -target-cpu pentium4 -D_MT -flto-visibility-public-std --dependent-lib=libcmt --dependent-lib=oldnames -stack-protector 2 -fcxx-exceptions -fexceptions -fexternc-nounwind -fms-volatile -fdiagnostics-format msvc -v -dwarf-column-info -debugger-tuning=gdb -resource-dir "S:\\WCFB01\\vctools\\NonShip\<wbr>\ClangLLVM\\lib\\clang\\5.0.0" -internal-isystem "S:\\WCFB01\\vctools\\NonShip\<wbr>\ClangLLVM\\lib\\clang\\5.0.0\<wbr>\include" -internal-isystem "S:\\binaries\\x86ret\\atlmfc\<wbr>\include" -internal-isystem "S:\\binaries\\x86ret\\inc" -internal-isystem "S:\\WCFB01\\ExternalApis\\Win<wbr>dows\\10\\sdk\\inc" -internal-isystem "S:\\WCFB01\\ExternalApis\\Uni<wbr>fiedCRT\\inc" -internal-isystem "S:\\WCFB01\\ExternalAPIs\\Dir<wbr>ectX\\Jun2010\\Include" -WCL4 -fdeprecated-macro -fdebug-compilation-dir "C:\\Temp" -ferror-limit 19 -fmessage-length 120 -fms-extensions -fms-compatibility -fms-compatibility-version=19.<wbr>11.25614 -std=c++14 -fdelayed-template-parsing -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o "C:\\Users\\stl\\AppData\\Loca<wbr>l\\Temp\\1\\meow-1d7183.obj" -x c++ meow.cpp<br>
clang -cc1 version 5.0.0 based upon LLVM 5.0.0-rc2 default target x86_64-pc-windows-msvc<br>
#include "..." search starts here:<br>
#include <...> search starts here:<br>
S:\WCFB01\vctools\NonShip\Cla<wbr>ngLLVM\lib\clang\5.0.0\include<br>
S:\binaries\x86ret\atlmfc\inc<wbr>lude<br>
S:\binaries\x86ret\inc<br>
S:\WCFB01\ExternalApis\Window<wbr>s\10\sdk\inc<br>
S:\WCFB01\ExternalApis\Unifie<wbr>dCRT\inc<br>
S:\WCFB01\ExternalAPIs\Direct<wbr>X\Jun2010\Include<br>
End of search list.<br>
"S:\\WCFB01\\vctools\\<wbr>NonShip\\ClangLLVM\\bin\\lld-<wbr>link" -out:meow.exe -nologo "C:\\Users\\stl\\AppData\\Loca<wbr>l\\Temp\\1\\meow-1d7183.obj"<br>
I am Clang: 5.0.0 (tags/RELEASE_500/rc2)<br>
<br>
That works, although I'm a little nervous about using this for our whole test suite when it isn't the default.<br>
<br>
So my questions are:<br>
<br>
1. Why is Clang 5.0 behaving differently from Clang 4.0 here? I see <a href="https://github.com/llvm-mirror/clang/blob/master/lib/Driver/ToolChains/MSVC.cpp" rel="noreferrer" target="_blank">https://github.com/llvm-mirror<wbr>/clang/blob/master/lib/Driver/<wbr>ToolChains/MSVC.cpp</a> trying to detect VS 2017 and other versions.<br>
<br>
2. Is there a simple way for me to get Clang 4.0's behavior back, where having cl.exe and link.exe on my PATH makes Clang automatically detect the correct -fms-compatibility-version and link.exe to be used?<br>
<br>
Thanks,<br>
STL<br>
<br>
______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div></div></div></div>
<br>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>