Compiler Crashes When Building Swift System
Table of Contents
Created by gh-md-toc
- Swift Version: 5.3, 5.4-dev (Windows)
- MacOS Version: 11.1, 10.15 (GitHub Actions)
- Linux Version: Ubuntu 20.04, 18.04 (Docker)
Windows Swift version:
compnerd.org Swift version 5.4-dev (LLVM e2976fe639d1f50, Swift 769cfce6ed904e0)
Target: x86_64-unknown-windows-msvc
Mac Swift version:
Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)
Target: x86_64-apple-darwin20.2.0
Reproduction Steps
Steps to reproduce:
- Install Docker to test on Linux
- Clone
main
branch of apple/swift-system - Run
swift build
on Mac and note that compilation succeeds - Run
docker run -v $(pwd):/src -w /src -it swift:latest swift build
to build on Linux and note that compilation fails
Compilation Output
Linux Compilation Output
Linux compilation output:
$ docker run -v $(pwd):/src -w /src -it swift:latest swift build
swift: /home/buildnode/jenkins/workspace/oss-swift-5.3-package-linux-ubuntu-18_04/swift/lib/SILGen/SILGenApply.cpp:4102: bool swift::Lowering::SILGenModule::isNonMutatingSelfIndirect(swift::SILDeclRef): Assertion `method->isNonMutating()' failed.
Stack dump:
0. Program arguments: /usr/bin/swift -frontend -c /src/Sources/System/Errno.swift /src/Sources/System/FileDescriptor.swift /src/Sources/System/FileHelpers.swift /src/Sources/System/FileOperations.swift /src/Sources/System/FilePath/FilePath.swift /src/Sources/System/FilePath/FilePathComponentView.swift /src/Sources/System/FilePath/FilePathComponents.swift /src/Sources/System/FilePath/FilePathParsing.swift /src/Sources/System/FilePath/FilePathString.swift -primary-file /src/Sources/System/FilePath/FilePathSyntax.swift -primary-file /src/Sources/System/FilePath/FilePathWindows.swift -primary-file /src/Sources/System/FilePermissions.swift /src/Sources/System/Platform/DarwinPlatformConstants.swift /src/Sources/System/Platform/LinuxPlatformConstants.swift /src/Sources/System/Platform/Platform.swift /src/Sources/System/Platform/PlatformString.swift /src/Sources/System/Platform/WindowsPlatformConstants.swift /src/Sources/System/SystemString.swift /src/Sources/System/Util.swift /src/Sources/System/UtilConsumers.swift -emit-module-path /src/.build/x86_64-unknown-linux-gnu/debug/SystemPackage.build/FilePath/FilePathSyntax~partial.swiftmodule -emit-module-path /src/.build/x86_64-unknown-linux-gnu/debug/SystemPackage.build/FilePath/FilePathWindows~partial.swiftmodule -emit-module-path /src/.build/x86_64-unknown-linux-gnu/debug/SystemPackage.build/FilePermissions~partial.swiftmodule -emit-module-doc-path /src/.build/x86_64-unknown-linux-gnu/debug/SystemPackage.build/FilePath/FilePathSyntax~partial.swiftdoc -emit-module-doc-path /src/.build/x86_64-unknown-linux-gnu/debug/SystemPackage.build/FilePath/FilePathWindows~partial.swiftdoc -emit-module-doc-path /src/.build/x86_64-unknown-linux-gnu/debug/SystemPackage.build/FilePermissions~partial.swiftdoc -emit-module-source-info-path /src/.build/x86_64-unknown-linux-gnu/debug/SystemPackage.build/FilePath/FilePathSyntax~partial.swiftsourceinfo -emit-module-source-info-path /src/.build/x86_64-unknown-linux-gnu/debug/SystemPackage.build/FilePath/FilePathWindows~partial.swiftsourceinfo -emit-module-source-info-path /src/.build/x86_64-unknown-linux-gnu/debug/SystemPackage.build/FilePermissions~partial.swiftsourceinfo -emit-dependencies-path /src/.build/x86_64-unknown-linux-gnu/debug/SystemPackage.build/FilePath/FilePathSyntax.d -emit-dependencies-path /src/.build/x86_64-unknown-linux-gnu/debug/SystemPackage.build/FilePath/FilePathWindows.d -emit-dependencies-path /src/.build/x86_64-unknown-linux-gnu/debug/SystemPackage.build/FilePermissions.d -emit-reference-dependencies-path /src/.build/x86_64-unknown-linux-gnu/debug/SystemPackage.build/FilePath/FilePathSyntax.swiftdeps -emit-reference-dependencies-path /src/.build/x86_64-unknown-linux-gnu/debug/SystemPackage.build/FilePath/FilePathWindows.swiftdeps -emit-reference-dependencies-path /src/.build/x86_64-unknown-linux-gnu/debug/SystemPackage.build/FilePermissions.swiftdeps -target x86_64-unknown-linux-gnu -disable-objc-interop -I /src/.build/x86_64-unknown-linux-gnu/debug -I /src/Sources/CSystem/include -color-diagnostics -enable-testing -g -module-cache-path /src/.build/x86_64-unknown-linux-gnu/debug/ModuleCache -swift-version 5 -Onone -D SWIFT_PACKAGE -D DEBUG -enable-anonymous-context-mangled-names -Xcc -fmodule-map-file=/src/.build/x86_64-unknown-linux-gnu/debug/CSystem.build/module.modulemap -parse-as-library -module-name SystemPackage -o /src/.build/x86_64-unknown-linux-gnu/debug/SystemPackage.build/FilePath/FilePathSyntax.swift.o -o /src/.build/x86_64-unknown-linux-gnu/debug/SystemPackage.build/FilePath/FilePathWindows.swift.o -o /src/.build/x86_64-unknown-linux-gnu/debug/SystemPackage.build/FilePermissions.swift.o -index-store-path /src/.build/x86_64-unknown-linux-gnu/debug/index/store -index-system-modules
1. Swift version 5.3.2 (swift-5.3.2-RELEASE)
2. While evaluating request SILGenSourceFileRequest(SIL Generation for file "/src/Sources/System/FilePath/FilePathSyntax.swift")
3. While emitting SIL for 'starts(with:)' (at /src/Sources/System/FilePath/FilePathSyntax.swift:70:10)
4. While silgen emitFunction SIL function "@$s13SystemPackage8FilePathV6starts4withSbAC_tF".
for 'starts(with:)' (at /src/Sources/System/FilePath/FilePathSyntax.swift:70:10)
5. While silgen closureexpr SIL function "@$s13SystemPackage8FilePathV6starts4withSbAC_tFSbyKXEfu_".
for expression at [/src/Sources/System/FilePath/FilePathSyntax.swift:72:39 - line:73:29] RangeText="components.starts(
with: other.components"
/usr/bin/swift[0x51fa1c4]
/usr/bin/swift[0x51f7dbe]
/usr/bin/swift[0x51fa49c]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12980)[0x7f56e772b980]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7)[0x7f56e5d96fb7]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x141)[0x7f56e5d98921]
/lib/x86_64-linux-gnu/libc.so.6(+0x3048a)[0x7f56e5d8848a]
/lib/x86_64-linux-gnu/libc.so.6(+0x30502)[0x7f56e5d88502]
/usr/bin/swift[0xaa6617]
/usr/bin/swift[0xa45ff7]
/usr/bin/swift[0xa3e1ea]
/usr/bin/swift[0xa3a12c]
/usr/bin/swift[0xa39e42]
/usr/bin/swift[0xa11e97]
/usr/bin/swift[0xa02968]
/usr/bin/swift[0xabe8fb]
/usr/bin/swift[0xaa8982]
/usr/bin/swift[0xabd577]
/usr/bin/swift[0xac7d19]
/usr/bin/swift[0xaadc3a]
/usr/bin/swift[0xaaadf2]
/usr/bin/swift[0xa0e720]
/usr/bin/swift[0x9ff5d4]
/usr/bin/swift[0xa7f75e]
/usr/bin/swift[0xa2af9e]
/usr/bin/swift[0x9baaff]
/usr/bin/swift[0xa1db99]
/usr/bin/swift[0xa0e73a]
/usr/bin/swift[0xa02968]
/usr/bin/swift[0xabe502]
/usr/bin/swift[0xaa8982]
/usr/bin/swift[0xabd577]
/usr/bin/swift[0xac7d19]
/usr/bin/swift[0xaadc3a]
/usr/bin/swift[0xaaadf2]
/usr/bin/swift[0xa0e720]
/usr/bin/swift[0x9ff5d4]
/usr/bin/swift[0xa7f75e]
/usr/bin/swift[0xa7c632]
/usr/bin/swift[0xa7a708]
/usr/bin/swift[0xa7a5fd]
/usr/bin/swift[0xa2a6e3]
/usr/bin/swift[0x9c2b57]
/usr/bin/swift[0x9b80fc]
/usr/bin/swift[0xa8c039]
/usr/bin/swift[0xa8713b]
/usr/bin/swift[0xa870fd]
/usr/bin/swift[0x9bfb3c]
/usr/bin/swift[0x9bf682]
/usr/bin/swift[0xa79fec]
/usr/bin/swift[0x9c5a96]
/usr/bin/swift[0x9c126e]
/usr/bin/swift[0x9c1174]
/usr/bin/swift[0x561d74]
/usr/bin/swift[0x55f069]
/usr/bin/swift[0x4e8ce8]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7f56e5d79bf7]
/usr/bin/swift[0x4e888a]
Windows Compilation Output
Windows compilation output:
PS C:\Users\user\test\swift-system> swift build -Xswiftc -sdk -Xswiftc $env:SDKROOT
[1/1] Compiling CSystem shims.c
[1/1] Compiling CSystem shims.c
* Build Completed!
<module-includes>:2:10: note: in file included from <module-includes>:2:
#include "C:\Users\user\test\swift-system\Sources\CSystem\include\CSystemWindows.h"
^
C:\Users\user\test\swift-system\Sources\CSystem\include\CSystemWindows.h:15:10: note: in file included from C:\Users\user\test\swift-system\Sources\CSystem\include\CSystemWindows.h:15:
#include <Windows.h>
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um/windows.h:172:10: note: in file included from C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um/windows.h:172:
#include <winbase.h>
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\winbase.h:5656:29: error: missing '#include <winbase.h>'; '_COPYFILE2_MESSAGE_TYPE' must be defined before it is used
COPYFILE2_MESSAGE_TYPE Type;
^
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\winbase.h:5621:14: note: definition here is not reachable
typedef enum _COPYFILE2_MESSAGE_TYPE {
^
Assertion failed: !D->isUnconditionallyVisible() && "expected a hidden declaration", file D:\a\1\s\llvm-project\clang\lib\Serialization\ASTWriter.cpp, line 6051
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0. C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\winbase.h:5723:3: current parser token 'COPYFILE2_MESSAGE'
#0 0x00007ff6db48b815 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x454b815)
#1 0x00007ff94fc71891 (C:\Windows\System32\ucrtbase.dll+0x71891)
#2 0x00007ff94fc72861 (C:\Windows\System32\ucrtbase.dll+0x72861)
#3 0x00007ff94fc741c5 (C:\Windows\System32\ucrtbase.dll+0x741c5)
#4 0x00007ff94fc74501 (C:\Windows\System32\ucrtbase.dll+0x74501)
#5 0x00007ff6da131a53 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x31f1a53)
#6 0x00007ff6d9e9ff12 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x2f5ff12)
#7 0x00007ff6da9fd00f (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x3abd00f)
#8 0x00007ff6da1edcf7 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x32adcf7)
#9 0x00007ff6da278767 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x3338767)
#10 0x00007ff6da089882 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x3149882)
#11 0x00007ff6da021fc2 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x30e1fc2)
#12 0x00007ff6da02ede9 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x30eede9)
#13 0x00007ff6da01e439 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x30de439)
#14 0x00007ff6d9ffca38 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x30bca38)
#15 0x00007ff6da00130e (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x30c130e)
#16 0x00007ff6da005883 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x30c5883)
#17 0x00007ff6d9e86e06 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x2f46e06)
#18 0x00007ff6d9e86c28 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x2f46c28)
#19 0x00007ff6d9e46103 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x2f06103)
#20 0x00007ff6d9e41dca (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x2f01dca)
#21 0x00007ff6db4706b4 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x45306b4)
#22 0x00007ff6db47083f (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x453083f)
#23 0x00007ff6db48c2fd (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe+0x454c2fd)
#24 0x00007ff94fc214c2 (C:\Windows\System32\ucrtbase.dll+0x214c2)
#25 0x00007ff951306fd4 (C:\Windows\System32\KERNEL32.DLL+0x16fd4)
#26 0x00007ff951d9cec1 (C:\Windows\SYSTEM32\ntdll.dll+0x4cec1)
On GitHub Actions, with this workflow file, the Swift compiler ends the build with a very helpful message: error: fatalError
(You can view the full output here)