swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.53k stars 10.35k forks source link

Bootstrapping (aka. `SwiftCompilerSources`) state on Windows #61410

Open stevapple opened 2 years ago

stevapple commented 2 years ago

Describe the bug Bootstrapping the Swift toolchain on Windows still fails at the time. We should look into this problem before more features rely on it and the process becomes mandatory.

Steps To Reproduce Steps to reproduce the behavior:

  1. Build the Swift toolchain with -DBOOTSTRAPPING_MODE=BOOTSTRAPPING. ...

Expected behavior Ideally the toolchain should be able to bootstrap. This was formerly blocked by some linker / runtime issue, but now new problems occurred during build steps, before the link step.

Environment (please fill out the following information)

Additional Context The issue is used to track the state of Swift bootstrapping ability on Windows.

stevapple commented 2 years ago

Current blocker

[6031/7041][ 85%][8226.737s] Building swift module Basic
FAILED: bootstrapping1/tools/swift/SwiftCompilerSources/Basic.o T:/1/bootstrapping1/tools/swift/SwiftCompilerSources/Basic.o
cmd.exe /C "cd /D C:\Users\stevapple\Developer\swift\SwiftCompilerSources && T:\1\bootstrapping0\bin\swiftc.exe -c -o T:/1/bootstrapping1/tools/swift/SwiftCompilerSources/Basic.o -I T:/1/bootstrapping0/bin/../lib -target x86_64-unknown-windows-msvc -module-name Basic -emit-module -emit-module-path T:/1/bootstrapping1/tools/swift/SwiftCompilerSources/Basic.swiftmodule -parse-as-library C:/Users/stevapple/Developer/swift/SwiftCompilerSources/Sources/Basic/SourceLoc.swift C:/Users/stevapple/Developer/swift/SwiftCompilerSources/Sources/Basic/Utils.swift -wmo -Xfrontend -validate-tbd-against-ir=none -Xfrontend -enable-experimental-cxx-interop -Xcc -UIBOutlet -Xcc -UIBAction -Xcc -UIBInspectable -Xfrontend -disable-implicit-string-processing-module-import -O -cross-module-optimization -Xcc -I -Xcc C:/Users/stevapple/Developer/llvm-project/llvm/include -Xcc -I -Xcc T:/1/include -Xcc -I -Xcc C:/Users/stevapple/Developer/swift/include -Xcc -I -Xcc T:/1/tools/swift/SwiftCompilerSources/../include -I T:/1/bootstrapping1/tools/swift/SwiftCompilerSources"
<unknown>:0: warning: unable to perform implicit import of "_Concurrency" module: no such module found
C:\Users\stevapple\Developer\swift\include\swift/AST/ASTBridging.h:16:10: note: while building module 'BasicBridging' imported from C:\Users\stevapple\Developer\swift\include\swift/AST/ASTBridging.h:16:
#include "swift/Basic/BasicBridging.h"
         ^
C:/Users/stevapple/Developer/swift/include\swift/Basic/Debug.h:15:10: note: while building module 'LLVM_Utils' imported from C:/Users/stevapple/Developer/swift/include\swift/Basic/Debug.h:15:
#include "llvm/Support/Compiler.h"
         ^
C:/Users/stevapple/Developer/llvm-project/llvm/include\llvm/Support/MathExtras.h:18:10: note: while building module 'std' imported from C:/Users/stevapple/Developer/llvm-project/llvm/include\llvm/Support/MathExtras.h:18:
#include <climits>
         ^
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "ccomplex"
         ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include/ccomplex:12:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include/ccomplex:12:
#include <complex>
         ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\complex:13:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\complex:13:
#include <limits>
         ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\limits:13:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\limits:13:
#include <cwchar>
         ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\cwchar:13:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\cwchar:13:
#include <wchar.h>
         ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\wchar.h:236:26: error: missing '#include <vcruntime_string.h>'; 'memcpy' must be declared before it is used
        return (wchar_t*)memcpy(_S1, _S2, _N*sizeof(wchar_t));
                         ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\vcruntime_string.h:43:15: note: declaration here is not visible
void* __cdecl memcpy(
              ^
C:\Users\stevapple\Developer\swift\include\swift/AST/ASTBridging.h:16:10: note: while building module 'BasicBridging' imported from C:\Users\stevapple\Developer\swift\include\swift/AST/ASTBridging.h:16:
#include "swift/Basic/BasicBridging.h"
         ^
C:/Users/stevapple/Developer/swift/include\swift/Basic/Debug.h:15:10: note: while building module 'LLVM_Utils' imported from C:/Users/stevapple/Developer/swift/include\swift/Basic/Debug.h:15:
#include "llvm/Support/Compiler.h"
         ^
C:/Users/stevapple/Developer/llvm-project/llvm/include\llvm/Support/MathExtras.h:18:10: note: while building module 'std' imported from C:/Users/stevapple/Developer/llvm-project/llvm/include\llvm/Support/MathExtras.h:18:
#include <climits>
         ^
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "ccomplex"
         ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include/ccomplex:12:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include/ccomplex:12:
#include <complex>
         ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\complex:13:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\complex:13:
#include <limits>
         ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\limits:13:10: note: in file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\limits:13:
#include <cwchar>
         ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\cwchar:32:13: error: missing '#include <corecrt_wtime.h>'; 'tm' must be declared before it is used
using _CSTD tm;
            ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt_wtime.h:26:8: note: declaration here is not visible
struct tm
       ^
C:\Users\stevapple\Developer\swift\include\swift/AST/ASTBridging.h:16:10: note: while building module 'BasicBridging' imported from C:\Users\stevapple\Developer\swift\include\swift/AST/ASTBridging.h:16:
#include "swift/Basic/BasicBridging.h"
         ^
C:/Users/stevapple/Developer/swift/include\swift/Basic/Debug.h:15:10: note: while building module 'LLVM_Utils' imported from C:/Users/stevapple/Developer/swift/include\swift/Basic/Debug.h:15:
#include "llvm/Support/Compiler.h"
         ^
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "ADT\APFixedPoint.h"
         ^
C:\Users\stevapple\Developer\llvm-project\llvm\include\llvm/ADT\APFixedPoint.h:19:10: note: in file included from C:\Users\stevapple\Developer\llvm-project\llvm\include\llvm/ADT\APFixedPoint.h:19:
#include "llvm/ADT/APSInt.h"
         ^
C:/Users/stevapple/Developer/llvm-project/llvm/include\llvm/ADT/APSInt.h:18:10: note: in file included from C:/Users/stevapple/Developer/llvm-project/llvm/include\llvm/ADT/APSInt.h:18:
#include "llvm/ADT/APInt.h"
         ^
C:/Users/stevapple/Developer/llvm-project/llvm/include\llvm/ADT/APInt.h:19:10: note: in file included from C:/Users/stevapple/Developer/llvm-project/llvm/include\llvm/ADT/APInt.h:19:
#include "llvm/Support/MathExtras.h"
         ^
C:/Users/stevapple/Developer/llvm-project/llvm/include\llvm/Support/MathExtras.h:18:10: error: could not build module 'std'
#include <climits>
         ^
C:\Users\stevapple\Developer\swift\include\swift/AST/ASTBridging.h:16:10: note: while building module 'BasicBridging' imported from C:\Users\stevapple\Developer\swift\include\swift/AST/ASTBridging.h:16:
#include "swift/Basic/BasicBridging.h"
         ^
C:/Users/stevapple/Developer/swift/include\swift/Basic/Debug.h:15:10: note: while building module 'LLVM_Utils' imported from C:/Users/stevapple/Developer/swift/include\swift/Basic/Debug.h:15:
#include "llvm/Support/Compiler.h"
         ^
C:/Users/stevapple/Developer/llvm-project/llvm/include\llvm/Support/DataTypes.h:19:10: note: while building module 'LLVM_C' imported from C:/Users/stevapple/Developer/llvm-project/llvm/include\llvm/Support/DataTypes.h:19:
#include "llvm-c/DataTypes.h"
         ^
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include ".\Analysis.h"
         ^
C:\Users\stevapple\Developer\llvm-project\llvm\include\llvm-c/.\Analysis.h:23:10: note: in file included from C:\Users\stevapple\Developer\llvm-project\llvm\include\llvm-c/.\Analysis.h:23:
#include "llvm-c/Types.h"
         ^
C:/Users/stevapple/Developer/llvm-project/llvm/include\llvm-c/Types.h:17:10: note: in file included from C:/Users/stevapple/Developer/llvm-project/llvm/include\llvm-c/Types.h:17:
#include "llvm-c/DataTypes.h"
         ^
C:\Users\stevapple\Developer\llvm-project\llvm\include\llvm-c\DataTypes.h:53:10: error: could not build module 'std'
#include <cstddef>
         ^
C:\Users\stevapple\Developer\swift\include\swift/AST/ASTBridging.h:16:10: note: while building module 'BasicBridging' imported from C:\Users\stevapple\Developer\swift\include\swift/AST/ASTBridging.h:16:
#include "swift/Basic/BasicBridging.h"
         ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "Basic/BasicBridging.h"
         ^
C:\Users\stevapple\Developer\swift\include\swift/Basic/BasicBridging.h:17:10: note: in file included from C:\Users\stevapple\Developer\swift\include\swift/Basic/BasicBridging.h:17:
#include "swift/Basic/SourceLoc.h"
         ^
C:/Users/stevapple/Developer/swift/include\swift/Basic/SourceLoc.h:20:10: note: in file included from C:/Users/stevapple/Developer/swift/include\swift/Basic/SourceLoc.h:20:
#include "swift/Basic/Debug.h"
         ^
C:/Users/stevapple/Developer/swift/include\swift/Basic/Debug.h:15:10: error: could not build module 'LLVM_Utils'
#include "llvm/Support/Compiler.h"
         ^
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "AST/ASTBridging.h"
         ^
C:\Users\stevapple\Developer\swift\include\swift/AST/ASTBridging.h:16:10: error: could not build module 'BasicBridging'
#include "swift/Basic/BasicBridging.h"
         ^
C:/Users/stevapple/Developer/swift/include\swift/Localization/LocalizationFormat.h:25:10: note: while building module 'LLVM_Bitstream' imported from C:/Users/stevapple/Developer/swift/include\swift/Localization/LocalizationFormat.h:25:
#include "llvm/Bitstream/BitstreamReader.h"
         ^
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "Bitstream\BitCodes.h"
         ^
C:\Users\stevapple\Developer\llvm-project\llvm\include\llvm/Bitstream\BitCodes.h:20:10: error: could not build module 'LLVM_Utils'
#include "llvm/ADT/SmallVector.h"
         ^
C:/Users/stevapple/Developer/swift/SwiftCompilerSources/Sources/Basic/SourceLoc.swift:13:8: error: could not build C module 'ASTBridging'
import ASTBridging
       ^
[6032/7041][ 85%][8285.350s] Building swift module _CompilerRegexParser

This looks like a compiler bug regarding C++-Interop with MSVC, but it could also be related to module maps of used C++ modules.

finagolfin commented 2 years ago

Note that the mandatory bootstrapping will not use C++ Interop, only C Interop for the first year, so you may have more time to figure this out.