thebrowsercompany / swift-build

Swift toolchain builds by The Browser Company
365 stars 12 forks source link

Could not build C module "SwiftShims" - Windows ARM64 Toolchain #151

Closed plemarquand closed 3 months ago

plemarquand commented 6 months ago

I installed the latest ARM64 windows toolchain from https://github.com/thebrowsercompany/swift-build/releases/download/20240524.2/installer-arm64.exe.

I created a simple package with swift package init and then do swift build:

PS C:\Users\plemarquand\WindowsTestApp> swift build
error: 'windowstestapp': Invalid manifest (compiled with: ["C:\\Users\\plemarquand\\AppData\\Local\\Programs\\Swift\\Toolchains\\0.0.0+Asserts\\usr\\bin\\swiftc.exe", "-vfsoverlay", "C:\\Users\\PLEMAR~1\\AppData\\Local\\Temp\\TemporaryDirectory.qxYguG\\vfs.yaml", "-L", "C:\\Users\\plemarquand\\AppData\\Local\\Programs\\Swift\\Toolchains\\0.0.0+Asserts\\usr\\lib\\swift\\pm\\ManifestAPI", "-lPackageDescription", "-sdk", "C:\\Users\\plemarquand\\AppData\\Local\\Programs\\Swift\\Platforms\\0.0.0\\Windows.platform\\Developer\\SDKs\\Windows.sdk", "-libc", "MD", "-I", "C:\\Users\\plemarquand\\AppData\\Local\\Programs\\Swift\\Platforms\\0.0.0\\Windows.platform\\Developer\\Library\\XCTest-development\\usr\\lib\\swift\\windows", "-I", "C:\\Users\\plemarquand\\AppData\\Local\\Programs\\Swift\\Platforms\\0.0.0\\Windows.platform\\Developer\\Library\\XCTest-development\\usr\\lib\\swift\\windows\\aarch64", "-L", "C:\\Users\\plemarquand\\AppData\\Local\\Programs\\Swift\\Platforms\\0.0.0\\Windows.platform\\Developer\\Library\\XCTest-development\\usr\\lib\\swift\\windows\\aarch64", "-use-ld=lld", "-swift-version", "6", "-I", "C:\\Users\\plemarquand\\AppData\\Local\\Programs\\Swift\\Toolchains\\0.0.0+Asserts\\usr\\lib\\swift\\pm\\ManifestAPI", "-package-description-version", "6.0.0", "C:\\Users\\plemarquand\\WindowsTestApp\\Package.swift", "-o", "C:\\Users\\PLEMAR~1\\AppData\\Local\\Temp\\TemporaryDirectory.pJ279F\\windowstestapp-manifest.exe"])
<module-includes>:1:10: note: in file included from <module-includes>:1:
 1 | #include "AssertionReporting.h"
   |          `- note: in file included from <module-includes>:1:
 2 | #include "CoreFoundationShims.h"
 3 | #include "EmbeddedShims.h"

C:\Users\plemarquand\AppData\Local\Programs\Swift\Platforms\0.0.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\shims/AssertionReporting.h:16:10: note: in file included from C:\Users\plemarquand\AppData\Local\Programs\Swift\Platforms\0.0.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\shims/AssertionReporting.h:16:
14 | #define SWIFT_STDLIB_SHIMS_ASSERTIONREPORTING_H_

15 |
16 | #include "SwiftStdint.h"
   |          `- note: in file included from C:\Users\plemarquand\AppData\Local\Programs\Swift\Platforms\0.0.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\shims/AssertionReporting.h:16:
17 | #include "Visibility.h"
18 |

<unknown>:0: error: could not build C module 'SwiftShims'
C:\Users\plemarquand\AppData\Local\Programs\Swift\Platforms\0.0.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\shims/SwiftStdint.h:28:10: error: 'stdint.h' file not found
26 | // __UINTxx_TYPE__ are defined only since Clang 3.5.
27 | #if !defined(__APPLE__) && !defined(__linux__) && !defined(__OpenBSD__) && !defined(__wasi__)
28 | #include <stdint.h>
   |          `- error: 'stdint.h' file not found
29 | typedef int64_t __swift_int64_t;
30 | typedef uint64_t __swift_uint64_t;
error: 'windowstestapp': Invalid manifest (compiled with: ["C:\\Users\\plemarquand\\AppData\\Local\\Programs\\Swift\\Toolchains\\0.0.0+Asserts\\usr\\bin\\swiftc.exe", "-vfsoverlay", "C:\\Users\\PLEMAR~1\\AppData\\Local\\Temp\\TemporaryDirectory.hdpSqm\\vfs.yaml", "-L", "C:\\Users\\plemarquand\\AppData\\Local\\Programs\\Swift\\Toolchains\\0.0.0+Asserts\\usr\\lib\\swift\\pm\\ManifestAPI", "-lPackageDescription", "-sdk", "C:\\Users\\plemarquand\\AppData\\Local\\Programs\\Swift\\Platforms\\0.0.0\\Windows.platform\\Developer\\SDKs\\Windows.sdk", "-libc", "MD", "-I", "C:\\Users\\plemarquand\\AppData\\Local\\Programs\\Swift\\Platforms\\0.0.0\\Windows.platform\\Developer\\Library\\XCTest-development\\usr\\lib\\swift\\windows", "-I", "C:\\Users\\plemarquand\\AppData\\Local\\Programs\\Swift\\Platforms\\0.0.0\\Windows.platform\\Developer\\Library\\XCTest-development\\usr\\lib\\swift\\windows\\aarch64", "-L", "C:\\Users\\plemarquand\\AppData\\Local\\Programs\\Swift\\Platforms\\0.0.0\\Windows.platform\\Developer\\Library\\XCTest-development\\usr\\lib\\swift\\windows\\aarch64", "-use-ld=lld", "-swift-version", "6", "-I", "C:\\Users\\plemarquand\\AppData\\Local\\Programs\\Swift\\Toolchains\\0.0.0+Asserts\\usr\\lib\\swift\\pm\\ManifestAPI", "-package-description-version", "6.0.0", "C:\\Users\\plemarquand\\WindowsTestApp\\Package.swift", "-o", "C:\\Users\\PLEMAR~1\\AppData\\Local\\Temp\\TemporaryDirectory.8LCxeX\\windowstestapp-manifest.exe"])
<module-includes>:1:10: note: in file included from <module-includes>:1:
 1 | #include "AssertionReporting.h"
   |          `- note: in file included from <module-includes>:1:
 2 | #include "CoreFoundationShims.h"
 3 | #include "EmbeddedShims.h"

C:\Users\plemarquand\AppData\Local\Programs\Swift\Platforms\0.0.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\shims/AssertionReporting.h:16:10: note: in file included from C:\Users\plemarquand\AppData\Local\Programs\Swift\Platforms\0.0.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\shims/AssertionReporting.h:16:
14 | #define SWIFT_STDLIB_SHIMS_ASSERTIONREPORTING_H_
15 |
16 | #include "SwiftStdint.h"
   |          `- note: in file included from C:\Users\plemarquand\AppData\Local\Programs\Swift\Platforms\0.0.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\shims/AssertionReporting.h:16:
17 | #include "Visibility.h"
18 |

<unknown>:0: error: could not build C module 'SwiftShims'
C:\Users\plemarquand\AppData\Local\Programs\Swift\Platforms\0.0.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\shims/SwiftStdint.h:28:10: error: 'stdint.h' file not found
26 | // __UINTxx_TYPE__ are defined only since Clang 3.5.
27 | #if !defined(__APPLE__) && !defined(__linux__) && !defined(__OpenBSD__) && !defined(__wasi__)
28 | #include <stdint.h>
   |          `- error: 'stdint.h' file not found
29 | typedef int64_t __swift_int64_t;
30 | typedef uint64_t __swift_uint64_t;
plemarquand commented 3 months ago

This is resolved by installing Visual Studio first.