[swift-users] Compile error trying to follow Swift for Windows MSVC instructions

Eric Wing ewmailing at gmail.com
Thu Nov 9 12:36:40 CST 2017


I'm trying to build Swift for Windows with Visual Studio using the
directions found here:
https://github.com/apple/swift/blob/master/docs/Windows.md

I'm following the MSVC section for directions. I am stuck in step 6.
LLVM/Clang/Compiler-RT

I seem to be hitting a C++ error in the code in IndexDataStore.h. Any
ideas on how to get around this?


C:\PROGRA~2\MICROS~1\2017\COMMUN~1\VC\Tools\MSVC\1411~1.255\bin\Hostx64\x64\cl.exe
 /nologo /TP -DGTEST_HAS_RTTI=0 -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE
-D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE
-D_CRT_SECURE_NO_WARNINGS -D_GNU_SOURCE -D_HAS_EXCEPTIONS=0
-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-Itools\clang\lib\Index -IC:\Source\SWIFT\llvm\tools\clang\lib\Index
-IC:\Source\SWIFT\llvm\tools\clang\include -Itools\clang\include
-Iinclude -IC:\Source\SWIFT\llvm\include /DWIN32 /D_WINDOWS
/Zc:inline /Zc:strictStrings /Oi /Zc:rvalueCast /W4 -wd4141 -wd4146
-wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345 -wd4351 -wd4355
-wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4800
-wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245
-wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204
-wd4577 -wd4091 -wd4592 -wd4319 -wd4324 -w14062 -we4238 /MD /O1 /Ob1
-UNDEBUG  /EHs-c- /GR- /showIncludes
/Fotools\clang\lib\Index\CMakeFiles\clangIndex.dir\IndexDataStore.cpp.obj
/Fdtools\clang\lib\Index\CMakeFiles\clangIndex.dir\clangIndex.pdb /FS
-c C:\Source\SWIFT\llvm\tools\clang\lib\Index\IndexDataStore.cpp
C:\Source\SWIFT\llvm\tools\clang\include\clang/Index/IndexDataStore.h(41):
error C3646: 'ModTime': unknown override specifier
C:\Source\SWIFT\llvm\tools\clang\include\clang/Index/IndexDataStore.h(41):
error C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
C:\Source\SWIFT\llvm\tools\clang\include\clang/Index/IndexDataStore.h(74):
error C3646: 'ModTime': unknown override specifier
C:\Source\SWIFT\llvm\tools\clang\include\clang/Index/IndexDataStore.h(74):
error C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
C:\Source\SWIFT\llvm\tools\clang\lib\Index\IndexDataStore.cpp(164):
error C2039: 'ModTime': is not a member of
'clang::index::AbstractDirectoryWatcher::Event'
C:\Source\SWIFT\llvm\tools\clang\include\clang/Index/IndexDataStore.h(38):
note: see declaration of
'clang::index::AbstractDirectoryWatcher::Event'
C:\Source\SWIFT\llvm\tools\clang\lib\Index\IndexDataStore.cpp(164):
error C2039: '__this': is not a member of
'clang::index::AbstractDirectoryWatcher::Event'
C:\Source\SWIFT\llvm\tools\clang\include\clang/Index/IndexDataStore.h(38):
note: see declaration of
'clang::index::AbstractDirectoryWatcher::Event'
[2723/3603] Building CXX object
tools\clang\lib\Index\CMakeFiles\clangIndex.dir\IndexingContext.cpp.obj
ninja: build stopped: subcommand failed.


Note: I'm using VS2017 instead of VS2015 because it's supposed to have
better C++ conformance.

I also want to note, building Debug hits a different fatal error where
MSVC aborts saying you must compile with /bigobj because the files are
too large. I changed my build and then hit the above compile error
with IndexDataStore.h. I then tried building a release version without
/bigobj, but I hit the same compile error with IndexDataStore.h.





Also, can somebody clarify what the differences are between the
different build approaches in the document (clang vs. MSVC vs.
clang-cl). Will these all produce binaries that are interoperable with
each other and allow me to link against regular MSVC built C
libraries? And do one of these clang options need MSVC's clang-C2?

And also, what is Compiler-RT and since it is optional, what do I lose
if I skip it?

And finally, why is the Win10 SDK needed? Doesn't that mean it won't
work on Win7 or Win8? What could Swift need that requires Win10 APIs?

Thanks,
Eric


More information about the swift-users mailing list