You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/WindowsBuild.md
+48-16Lines changed: 48 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -705,22 +705,24 @@ cmake -B S:\b\11 ^
705
705
cmake --build S:\b\11
706
706
```
707
707
708
-
## Gather the toolchain and SDK
708
+
## Use the toolchain and SDK
709
709
710
-
If you want a toolchain for real-world testing, you can use CMake to perform the install step.
710
+
If you want a toolchain for real-world testing, you can use CMake to perform the install step. However, the built toolchain is not expected to be distributed, mainly because there're plenty of unnecessary or local files that need to be stripped.
711
711
712
-
### Swift compiler and standard libraries
712
+
### Swift compiler
713
713
714
714
```cmd
715
715
cmake --build S:\b\1 --target install
716
716
```
717
717
718
-
For testing, add the target to path:
718
+
For testing, add the toolchain to path:
719
719
720
720
```cmd
721
-
path S:\b\toolchain\usr\bin:%PATH%
721
+
path S:\b\toolchain\usr\bin;%PATH%
722
722
```
723
723
724
+
> **NOTE**: The built compiler cannot actually compile Swift files without a compatible SDK. You may need to specify `-sdk <sdk>` explicitly.
You may notice that the SDK is not functioning correctly. This is caused by the mismatch of expected SDK layout and the build output. Before these issues get addressed, we may need some extra workaround.
751
+
752
+
1. Compiler expects Swift libraries to live in `\usr\lib\swift\windows\x86_64`, but the build output is `\usr\lib\swift\windows`. This is likely to trigger `unable to load standard library for target 'x86_64-unknown-windows-msvc'` error. Fix by:
753
+
754
+
```cmd
755
+
for /D %m in (S:\b\sdk\usr\lib\swift\windows\*.swiftmodule) do ^
756
+
move /Y %m S:\b\sdk\usr\lib\swift\windows\x86_64
757
+
```
758
+
759
+
> **NOTE(stevapple)**: The compiler convention shall be wrong here — Swift libraries can be bundled with multiple architectures, so there's no need to place them in arch-specific directory.
760
+
761
+
2. Compiler expects underlying modules to be imported from `\usr\include`, but the build output is `\usr\lib\swift`. This is likely to trigger `cannot load underlying module for '<Module>'` error. Fix by:
3. Compiler expects Swift runtime import libraries to live in `\usr\lib\swift\windows\x86_64`, but the build output is `\usr\lib\swift\windows`. This is likely to trigger `fatal error LNK1104: cannot open file '<Module>.lib'` error. Fix by:
> **NOTE(stevapple)**: The build script shall be wrong here — Swift shared libraries are closely tied to target architecture, so we should place them in arch-specific directory if Universal binary is not available.
0 commit comments