Swift 5.4 - No REPL / No print() output

Hi, I just discovered that Swift is now available for Windows, so thank you to all the people who made this possible :slight_smile:

So, I'm trying to get started with Swift on Windows, I downloaded the 5.4 toolchain (saw I don't know where that it's recommended vs the 5.3 one).
I already had all the necessary stuff installed on my machine (vs2019, sdks, python, ...) so I just did the modulemap copy.

First, I can't launch the REPL, no error, just a new line in my terminal.
Then, I tried running a simple hello world, literally just a print("Hello World !").
I'm doing swiftc -sdk $env:sdkroot .\main.swift -o main.exe && .\main.exe, and here again nothing...

I tried looking for the problem, without any real luck.

I get that it might still be early days for swift on windows, but if anyone can help I'd be really gratefull :slight_smile:

Cheers !

The REPL is known to be problematic right now. The problem is related to the library search paths which I've not yet figured out how to get setup correctly. You can copy all the runtime modules into %CD% to get it to work. Alternatively, changing into the runtime directory IIRC also works. There is a SR tracking this, though I don't have the number on hand. You should be able to find it (it should be tagged with Windows).

Hi, I'm a newer to swift. I trying it on win10 x64.
Where are the runtime modules?
Can copying them to %CD% solve my problem as the pic.
Problem: After input '1 + 2', press Enter key. an error happend.
Cheers !

The runtime modules should be %SystemDrive%\Library\swift-development\bin.

Yes, copying them into %SystemDrive%\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin would work. Keep in mind that doing so may impact the ability to uninstall using the installer and you would have two copies of the runtimes which could get out of sync if you were to re-install.

Thank you for reply.
It seems that something worked, but there is another error.
Looking forward to the next release.

Terms of Service

Privacy Policy

Cookie Policy