Windows 10 installation - cannot use REPL

Hello members,

I'm trying to install Swift on my Windows 10 PC, but it failed when I ran a command in REPL.

Steps I did:

  1. Installed required items via Visual Studio 2022 community installation (required, recommended, and suggested). Note that I already have python installed before.

  2. Installed Swift 5.7.1 for Windows 10

  3. Did the file copy steps on x64 Native Tools Command Prompt for VS2022 as admin

Then, I can check Swift version, check :help and enter REPL on Command Prompt, but when I just input 1+2 it failed with a bunch of lines as follow:

1> 1 + 2
Assertion failed: false && "called into swift language runtime stub", file D:\a\1\s\llvm-project\lldb\source\Plugins\LanguageRuntime\Swift\SwiftLanguageRuntime.cpp, line 392
PLEASE submit a bug report to and include the crash backtrace.
 #0 0x00007ff6cf6e4bd5 (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\lldb.exe+0x24bd5)
 #1 0x00007ffa11361861 (C:\WINDOWS\System32\ucrtbase.dll+0x71861)
 #2 0x00007ffa11362831 (C:\WINDOWS\System32\ucrtbase.dll+0x72831)
 #3 0x00007ffa1136424e (C:\WINDOWS\System32\ucrtbase.dll+0x7424e)
 #4 0x00007ffa11364145 (C:\WINDOWS\System32\ucrtbase.dll+0x74145)
 #5 0x00007ffa113644d1 (C:\WINDOWS\System32\ucrtbase.dll+0x744d1)
 #6 0x00007ff995271559 PyInit__lldb (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\liblldb.dll+0x6d1559)
 #7 0x00007ff99a494ce4 PyInit__lldb (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\liblldb.dll+0x58f4ce4)
 #8 0x00007ff99a49a93b PyInit__lldb (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\liblldb.dll+0x58fa93b)
 #9 0x00007ff99a497eea PyInit__lldb (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\liblldb.dll+0x58f7eea)
#10 0x00007ff99a49233b PyInit__lldb (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\liblldb.dll+0x58f233b)
#11 0x00007ff994f86bac PyInit__lldb (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\liblldb.dll+0x3e6bac)
#12 0x00007ff994f95802 PyInit__lldb (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\liblldb.dll+0x3f5802)
#13 0x00007ff994f63206 PyInit__lldb (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\liblldb.dll+0x3c3206)
#14 0x00007ff994f0e62a PyInit__lldb (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\liblldb.dll+0x36e62a)
#15 0x00007ff994f0c4ee PyInit__lldb (C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\liblldb.dll+0x36c4ee)
#16 0x00007ffa11311542 (C:\WINDOWS\System32\ucrtbase.dll+0x21542)
#17 0x00007ffa11f56fd4 (C:\WINDOWS\System32\KERNEL32.DLL+0x16fd4)
#18 0x00007ffa134dcec1 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x4cec1)

Did I do something wrong or missed a step?
Please help advice.

Edit: seems like a common problem? Found a bug report at swift repl on windows 11 not work · Issue #61062 · apple/swift · GitHub

I tried the "workaround" there, but still cannot print to console.

Please search the forums for associated posts. There are known issues with lldb that have not yet been solved (CC: @Adrian_Prantl) that require significant amount of handholding to get the REPL working properly. I highly recommend that you compile and execute rather than use the REPL.

1 Like

Thanks. I got it working on WSL now.

I understood the language works by compiling but I got too accustomed to interpreter after developing on Python and JS...

I'll tell you right away that Swift will not work correctly on Windows 10, and I do not know people at all who would work in this programming language on Windows. Everyone I know uses macOS, because this programming language was created only for this OS. Therefore, I am not surprised that you will have errors when installing Swift on Windows. Yes, I myself love Windows much more than macOS, I even bought it recently windows 10 reddit key, but I also have a Macbook on which I work on Swift.

In this based on your own experience? Yes, Swift on Windows currently has some limitations:

  • on x86_64, async/await still waits for the according optimization in LLVM
  • REPL does not work
  • no static linking

Besides this, Swift on Windows runs very well and there are people using it.

From what I heard, Apple itself uses Swift on Linux.