[cfe-dev] Using Clang 5.0.0 RC2 with MSVC dev builds

Stephan T. Lavavej via cfe-dev cfe-dev at lists.llvm.org
Wed Aug 16 11:21:14 PDT 2017


[STL]
> Here's how to repro my directory structure in a clean VM.

[don hinton] 
> Currently, for pre-2017, the root directory must be in the form <some path>/VC.  

Note that these development builds (both my actual ones, and the repro constructed from the nuget package) are 2017-class. They just don't conform to 2017's normal installer.

> Could you try renaming x86ret and amd64ret to VC and try it again? e.g.:
> C:\Temp\binaries\x86ret\bin\i386       ==> C:\Temp\binaries\VC\bin\i386
> C:\Temp\binaries\amd64ret\bin\amd64    ==> C:\Temp\binaries\VC\bin\amd64

Sure. x86 still misbehaves, but x64 works properly! Does this indicate that Clang just needs to do slightly less strict validation of the root directory (possibly controlled by an option)?

*** x86: ***

C:\Temp>echo %PATH%
C:\Temp\binaries\VC\bin\i386;C:\Temp\ClangLLVM\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\stl\AppData\Local\Microsoft\WindowsApps;

C:\Temp>echo %INCLUDE%
C:\Temp\binaries\VC\inc;C:\Temp\ExternalApis\Windows\10\sdk\inc;C:\Temp\ExternalApis\UnifiedCRT\inc

C:\Temp>echo %LIB%
C:\Temp\binaries\VC\lib\i386;C:\Temp\ExternalApis\Windows\10\sdk\lib\x86;C:\Temp\ExternalApis\UnifiedCRT\lib\i386

C:\Temp>type meow.cpp
#include <iostream>
int main() {
#ifdef __clang__
    std::cout << "I am Clang: " << __clang_version__ << "\n";
#elif defined(_MSC_VER)
    std::cout << "I am C1XX: " << _MSC_FULL_VER << "\n";
#else
    std::cout << "I am something else.\n";
#endif
    std::cout << "And I am " << sizeof(void *) * 8 << "-bit.\n";
}

C:\Temp>where cl
C:\Temp\binaries\VC\bin\i386\cl.exe

C:\Temp>where link
C:\Temp\binaries\VC\bin\i386\link.exe

C:\Temp>cl /EHsc /nologo /W4 /MT meow.cpp && meow
meow.cpp
I am C1XX: 191125506
And I am 32-bit.

C:\Temp>where clang-cl
C:\Temp\ClangLLVM\bin\clang-cl.exe

C:\Temp>clang-cl -v -m32 /EHsc /nologo /W4 /MT meow.cpp && meow
clang version 5.0.0 (tags/RELEASE_500/rc2)
Target: i386-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Temp\ClangLLVM\bin
 "C:\\Temp\\ClangLLVM\\bin\\clang-cl.exe" -cc1 -triple i386-pc-windows-msvc18.0.0 -emit-obj -mrelax-all -mincremental-linker-compatible -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 "C:\\Temp\\ClangLLVM\\lib\\clang\\5.0.0" -internal-isystem "C:\\Temp\\ClangLLVM\\lib\\clang\\5.0.0\\include" -internal-isystem "C:\\Temp\\binaries\\VC\\inc" -internal-isystem "C:\\Temp\\ExternalApis\\Windows\\10\\sdk\\inc" -internal-isystem "C:\\Temp\\ExternalApis\\UnifiedCRT\\inc" -WCL4 -fdeprecated-macro -fdebug-compilation-dir "C:\\Temp" -ferror-limit 19 -fmessage-length 120 -fms-extensions -fms-compatibility -fms-compatibility-version=18 -std=c++11 -fno-threadsafe-statics -fdelayed-template-parsing -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o "C:\\Users\\stl\\AppData\\Local\\Temp\\2\\meow-514a85.obj" -x c++ meow.cpp
clang -cc1 version 5.0.0 based upon LLVM 5.0.0-rc2 default target x86_64-pc-windows-msvc
#include "..." search starts here:
#include <...> search starts here:
 C:\Temp\ClangLLVM\lib\clang\5.0.0\include
 C:\Temp\binaries\VC\inc
 C:\Temp\ExternalApis\Windows\10\sdk\inc
 C:\Temp\ExternalApis\UnifiedCRT\inc
End of search list.
In file included from meow.cpp:1:
In file included from C:\Temp\binaries\VC\inc\iostream:6:
In file included from C:\Temp\binaries\VC\inc\istream:6:
In file included from C:\Temp\binaries\VC\inc\ostream:6:
In file included from C:\Temp\binaries\VC\inc\ios:6:
In file included from C:\Temp\binaries\VC\inc\xlocnum:7:
In file included from C:\Temp\binaries\VC\inc\cmath:617:
In file included from C:\Temp\binaries\VC\inc\xtgmath.h:9:
C:\Temp\binaries\VC\inc\xtr1common(204,22) :  error: use of undeclared identifier 'char16_t'
        struct _Is_integral<char16_t>
                            ^
[...more errors...]

C:\Temp>clang-cl -v -m32 /EHsc /nologo /W4 /MT -fms-compatibility-version=19.11.25506 meow.cpp && meow
clang version 5.0.0 (tags/RELEASE_500/rc2)
Target: i386-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Temp\ClangLLVM\bin
 "C:\\Temp\\ClangLLVM\\bin\\clang-cl.exe" -cc1 -triple i386-pc-windows-msvc19.11.25506 -emit-obj -mrelax-all -mincremental-linker-compatible -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 "C:\\Temp\\ClangLLVM\\lib\\clang\\5.0.0" -internal-isystem "C:\\Temp\\ClangLLVM\\lib\\clang\\5.0.0\\include" -internal-isystem "C:\\Temp\\binaries\\VC\\inc" -internal-isystem "C:\\Temp\\ExternalApis\\Windows\\10\\sdk\\inc" -internal-isystem "C:\\Temp\\ExternalApis\\UnifiedCRT\\inc" -WCL4 -fdeprecated-macro -fdebug-compilation-dir "C:\\Temp" -ferror-limit 19 -fmessage-length 120 -fms-extensions -fms-compatibility -fms-compatibility-version=19.11.25506 -std=c++14 -fdelayed-template-parsing -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o "C:\\Users\\stl\\AppData\\Local\\Temp\\2\\meow-a07665.obj" -x c++ meow.cpp
clang -cc1 version 5.0.0 based upon LLVM 5.0.0-rc2 default target x86_64-pc-windows-msvc
#include "..." search starts here:
#include <...> search starts here:
 C:\Temp\ClangLLVM\lib\clang\5.0.0\include
 C:\Temp\binaries\VC\inc
 C:\Temp\ExternalApis\Windows\10\sdk\inc
 C:\Temp\ExternalApis\UnifiedCRT\inc
End of search list.
 "link.exe" -out:meow.exe -nologo "C:\\Users\\stl\\AppData\\Local\\Temp\\2\\meow-a07665.obj"
clang-cl.exe: error: unable to execute command: program not executable
clang-cl.exe: error: linker command failed with exit code 1 (use -v to see invocation)

C:\Temp>clang-cl -v -m32 /EHsc /nologo /W4 /MT -fms-compatibility-version=19.11.25506 -fuse-ld=lld-link meow.cpp && meow
clang version 5.0.0 (tags/RELEASE_500/rc2)
Target: i386-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Temp\ClangLLVM\bin
 "C:\\Temp\\ClangLLVM\\bin\\clang-cl.exe" -cc1 -triple i386-pc-windows-msvc19.11.25506 -emit-obj -mrelax-all -mincremental-linker-compatible -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 "C:\\Temp\\ClangLLVM\\lib\\clang\\5.0.0" -internal-isystem "C:\\Temp\\ClangLLVM\\lib\\clang\\5.0.0\\include" -internal-isystem "C:\\Temp\\binaries\\VC\\inc" -internal-isystem "C:\\Temp\\ExternalApis\\Windows\\10\\sdk\\inc" -internal-isystem "C:\\Temp\\ExternalApis\\UnifiedCRT\\inc" -WCL4 -fdeprecated-macro -fdebug-compilation-dir "C:\\Temp" -ferror-limit 19 -fmessage-length 120 -fms-extensions -fms-compatibility -fms-compatibility-version=19.11.25506 -std=c++14 -fdelayed-template-parsing -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o "C:\\Users\\stl\\AppData\\Local\\Temp\\2\\meow-17ad61.obj" -x c++ meow.cpp
clang -cc1 version 5.0.0 based upon LLVM 5.0.0-rc2 default target x86_64-pc-windows-msvc
#include "..." search starts here:
#include <...> search starts here:
 C:\Temp\ClangLLVM\lib\clang\5.0.0\include
 C:\Temp\binaries\VC\inc
 C:\Temp\ExternalApis\Windows\10\sdk\inc
 C:\Temp\ExternalApis\UnifiedCRT\inc
End of search list.
 "C:\\Temp\\ClangLLVM\\bin\\lld-link" -out:meow.exe -nologo "C:\\Users\\stl\\AppData\\Local\\Temp\\2\\meow-17ad61.obj"
I am Clang: 5.0.0 (tags/RELEASE_500/rc2)
And I am 32-bit.

*** x64: ***

C:\Temp>echo %PATH%
C:\Temp\binaries\VC\bin\amd64;C:\Temp\ClangLLVM\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Users\stl\AppData\Local\Microsoft\WindowsApps;

C:\Temp>echo %INCLUDE%
C:\Temp\binaries\VC\inc;C:\Temp\ExternalApis\Windows\10\sdk\inc;C:\Temp\ExternalApis\UnifiedCRT\inc

C:\Temp>echo %LIB%
C:\Temp\binaries\VC\lib\amd64;C:\Temp\ExternalApis\Windows\10\sdk\lib\x64;C:\Temp\ExternalApis\UnifiedCRT\lib\amd64

C:\Temp>type meow.cpp
#include <iostream>
int main() {
#ifdef __clang__
    std::cout << "I am Clang: " << __clang_version__ << "\n";
#elif defined(_MSC_VER)
    std::cout << "I am C1XX: " << _MSC_FULL_VER << "\n";
#else
    std::cout << "I am something else.\n";
#endif
    std::cout << "And I am " << sizeof(void *) * 8 << "-bit.\n";
}

C:\Temp>where cl
C:\Temp\binaries\VC\bin\amd64\cl.exe

C:\Temp>where link
C:\Temp\binaries\VC\bin\amd64\link.exe

C:\Temp>cl /EHsc /nologo /W4 /MT meow.cpp && meow
meow.cpp
I am C1XX: 191125506
And I am 64-bit.

C:\Temp>where clang-cl
C:\Temp\ClangLLVM\bin\clang-cl.exe

C:\Temp>clang-cl -v -m64 /EHsc /nologo /W4 /MT meow.cpp && meow
clang version 5.0.0 (tags/RELEASE_500/rc2)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Temp\ClangLLVM\bin
 "C:\\Temp\\ClangLLVM\\bin\\clang-cl.exe" -cc1 -triple x86_64-pc-windows-msvc19.11.25506 -emit-obj -mrelax-all -mincremental-linker-compatible -disable-free -main-file-name meow.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -relaxed-aliasing -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -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 -momit-leaf-frame-pointer -v -dwarf-column-info -debugger-tuning=gdb -resource-dir "C:\\Temp\\ClangLLVM\\lib\\clang\\5.0.0" -internal-isystem "C:\\Temp\\ClangLLVM\\lib\\clang\\5.0.0\\include" -internal-isystem "C:\\Temp\\binaries\\VC\\inc" -internal-isystem "C:\\Temp\\ExternalApis\\Windows\\10\\sdk\\inc" -internal-isystem "C:\\Temp\\ExternalApis\\UnifiedCRT\\inc" -WCL4 -fdeprecated-macro -fdebug-compilation-dir "C:\\Temp" -ferror-limit 19 -fmessage-length 120 -fms-extensions -fms-compatibility -fms-compatibility-version=19.11.25506 -std=c++14 -fdelayed-template-parsing -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o "C:\\Users\\stl\\AppData\\Local\\Temp\\2\\meow-fcb42a.obj" -x c++ meow.cpp
clang -cc1 version 5.0.0 based upon LLVM 5.0.0-rc2 default target x86_64-pc-windows-msvc
#include "..." search starts here:
#include <...> search starts here:
 C:\Temp\ClangLLVM\lib\clang\5.0.0\include
 C:\Temp\binaries\VC\inc
 C:\Temp\ExternalApis\Windows\10\sdk\inc
 C:\Temp\ExternalApis\UnifiedCRT\inc
End of search list.
 "C:\\Temp\\binaries\\VC\\bin\\amd64\\link.exe" -out:meow.exe -nologo "C:\\Users\\stl\\AppData\\Local\\Temp\\2\\meow-fcb42a.obj"
I am Clang: 5.0.0 (tags/RELEASE_500/rc2)
And I am 64-bit.

C:\Temp>clang-cl -v -m64 /EHsc /nologo /W4 /MT -fms-compatibility-version=19.11.25506 meow.cpp && meow
clang version 5.0.0 (tags/RELEASE_500/rc2)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Temp\ClangLLVM\bin
 "C:\\Temp\\ClangLLVM\\bin\\clang-cl.exe" -cc1 -triple x86_64-pc-windows-msvc19.11.25506 -emit-obj -mrelax-all -mincremental-linker-compatible -disable-free -main-file-name meow.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -relaxed-aliasing -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -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 -momit-leaf-frame-pointer -v -dwarf-column-info -debugger-tuning=gdb -resource-dir "C:\\Temp\\ClangLLVM\\lib\\clang\\5.0.0" -internal-isystem "C:\\Temp\\ClangLLVM\\lib\\clang\\5.0.0\\include" -internal-isystem "C:\\Temp\\binaries\\VC\\inc" -internal-isystem "C:\\Temp\\ExternalApis\\Windows\\10\\sdk\\inc" -internal-isystem "C:\\Temp\\ExternalApis\\UnifiedCRT\\inc" -WCL4 -fdeprecated-macro -fdebug-compilation-dir "C:\\Temp" -ferror-limit 19 -fmessage-length 120 -fms-extensions -fms-compatibility -fms-compatibility-version=19.11.25506 -std=c++14 -fdelayed-template-parsing -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o "C:\\Users\\stl\\AppData\\Local\\Temp\\2\\meow-61735d.obj" -x c++ meow.cpp
clang -cc1 version 5.0.0 based upon LLVM 5.0.0-rc2 default target x86_64-pc-windows-msvc
#include "..." search starts here:
#include <...> search starts here:
 C:\Temp\ClangLLVM\lib\clang\5.0.0\include
 C:\Temp\binaries\VC\inc
 C:\Temp\ExternalApis\Windows\10\sdk\inc
 C:\Temp\ExternalApis\UnifiedCRT\inc
End of search list.
 "C:\\Temp\\binaries\\VC\\bin\\amd64\\link.exe" -out:meow.exe -nologo "C:\\Users\\stl\\AppData\\Local\\Temp\\2\\meow-61735d.obj"
I am Clang: 5.0.0 (tags/RELEASE_500/rc2)
And I am 64-bit.

C:\Temp>clang-cl -v -m64 /EHsc /nologo /W4 /MT -fms-compatibility-version=19.11.25506 -fuse-ld=lld-link meow.cpp && meow
clang version 5.0.0 (tags/RELEASE_500/rc2)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Temp\ClangLLVM\bin
 "C:\\Temp\\ClangLLVM\\bin\\clang-cl.exe" -cc1 -triple x86_64-pc-windows-msvc19.11.25506 -emit-obj -mrelax-all -mincremental-linker-compatible -disable-free -main-file-name meow.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -relaxed-aliasing -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -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 -momit-leaf-frame-pointer -v -dwarf-column-info -debugger-tuning=gdb -resource-dir "C:\\Temp\\ClangLLVM\\lib\\clang\\5.0.0" -internal-isystem "C:\\Temp\\ClangLLVM\\lib\\clang\\5.0.0\\include" -internal-isystem "C:\\Temp\\binaries\\VC\\inc" -internal-isystem "C:\\Temp\\ExternalApis\\Windows\\10\\sdk\\inc" -internal-isystem "C:\\Temp\\ExternalApis\\UnifiedCRT\\inc" -WCL4 -fdeprecated-macro -fdebug-compilation-dir "C:\\Temp" -ferror-limit 19 -fmessage-length 120 -fms-extensions -fms-compatibility -fms-compatibility-version=19.11.25506 -std=c++14 -fdelayed-template-parsing -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o "C:\\Users\\stl\\AppData\\Local\\Temp\\2\\meow-607867.obj" -x c++ meow.cpp
clang -cc1 version 5.0.0 based upon LLVM 5.0.0-rc2 default target x86_64-pc-windows-msvc
#include "..." search starts here:
#include <...> search starts here:
 C:\Temp\ClangLLVM\lib\clang\5.0.0\include
 C:\Temp\binaries\VC\inc
 C:\Temp\ExternalApis\Windows\10\sdk\inc
 C:\Temp\ExternalApis\UnifiedCRT\inc
End of search list.
 "C:\\Temp\\ClangLLVM\\bin\\lld-link" -out:meow.exe -nologo "C:\\Users\\stl\\AppData\\Local\\Temp\\2\\meow-607867.obj"
I am Clang: 5.0.0 (tags/RELEASE_500/rc2)
And I am 64-bit.

Thanks,
STL


More information about the cfe-dev mailing list