Swift build fails on Windows

When running swift build on Windows I get the following error:
compiled module was created by a newer version of the compiler

I can use the Swift REPL, the swift package init command works, swift--version works as well.
I can compile Swift code via CMake and the SwiftSupport module.
I have installed the current dev trunk of swift (5.6 as the time of writing).

The error also occurs when creating a new Package with swift package init and then running swift build

I have tried the current release branch as well, which gave me the same error.

Hi Marcel,

Did you try using the REPL, or just launching it? I have been unable to use the REPL on Windows so far.

Did you upgrade from a previous installation? If so, did you uninstall the previous version first? It seems like it may be picking up something unintentionally. Perhaps you can spot something by running swift build -v.

1 Like

@compnerd
That was the issue. Kind of.
SPM was a leftover from 5.6, while the rest was 5.5