Good call, CodeLLDB depends on Python 3.9.
@dave256 what does python --version
show?
Good call, CodeLLDB depends on Python 3.9.
@dave256 what does python --version
show?
Yes, I found a Python 3.9 for ARM. You'll see in the output from my post above that it's in the Path environment variable
c:\\Users\\dreed\\AppData\\Local\\Programs\\Python\\Python39-arm64
which is where the python39.dll file is.
In the Windows terminal:
PS C:\Users\dreed> python --version
Python 3.9.10
A new version of the VS Code extension was just released (1.11.2), it fixes a few issues related to debugging the tests on Windows:
.build/debug
was being created with the wrong permissions by the toolchain, so it couldn't be followed to the testing binary (Windows: symbolic links not created correctly with relative paths ยท Issue #928 ยท swiftlang/swift-foundation ยท GitHub). The extension works around this by being more explicit and using the build triple folder..exe
was being erroneously added to the testing binary's path before being passed to the debug adapterLet me know if you run in to issues.
I think we got it working on my students x86 Window's computer. We updated the extension and it didn't seem to. We downloaded the latest Swift 6 from swift.org (the exe installer) and ran that. At first VSCode said it couldn't find the toolchain. I looked in the /usr/bin directory within the Toolchains director and the swift compiler wasn't there. We double-clicked on the installer and did a repair and the files showed up. At first it seemed to run but wasn't stopping at breakpoints, but eventually we got it to work. I asked the student to let me know if it stops working, but hopefully he's all set now. Thank you.
Any news on the VS Code sourcekit-lsp bug eating CPU usage > 25% on Windows ? Is this fixed ?
@plemarquand @dschaefer2 @compnerd For a number of my students on Windows, Swift in VS Code just stopped working last week. I don't know if it's the Swift VSCode extension or something else. In some cases, we updated from the 5.10.1 to the latest official 6 release and got it working but in other cases we couldn't get it working again. I'm going to try when I get home today to see what's happening on the old borrowed Windows laptop I have and see if it still works there and then try updating to Swift 6 on it. Any ideas on what happened? Thanks.
You can try Swift installer from Plain Swift. The product is shareware, but it can correctly (I hope) install the Swift compiler v6.0.1 for you.
If you go this route, first update Plain Swift to the latest version (currently v1.15) using the Help | About... menu command, and only then allow it to install the compiler. It has free trial period, and after it will install Swift 6 for you, you can uninstall Plain Swift.
I would need to know what was failing. Was it vscode-swift, or was it swift-package-manager. It would probably be best at this point to raise issues against those repos so we can track fixes.
I am working on fixing up all the symbol warnings and errors people are seeing on Windows. That should solve a lot of problems with swift build.
OK, I can hint at some potential problems with Swift installation:
Couple of times an update from Microsoft (Build Tools and Windows SDK) caused C++ interoperability to stop working, but not the whole thing. The update from Swift 5.10.1 to 6.0.1 did help last lime, so I think maybe updating to the latest Swift version may help in your case too (if you haven't updated yet). The latest Swift is more "in sync" with latest Microsoft components.
@dschaefer2 I tried it on a borrowed old Windows laptop I have that had Swift 6 from a July 2nd snapshot when I originally got this working. It still worked. I updated the Swift extension in VSCode and it still worked. I ran all the Windows software updates and it still worked. I uninstalled the Swift 6 snapshot, installed the Swift 6.0.1 release and it still worked (after I edited the environment variables to remove the 6.0.0 references and leave the 6.0.1 ones there and rebooted). So right now I'm at a loss but it happened on 3 or 4 of the students Windows computers so I don't think one of them just deleted files or changed something. I'll see if I can get one of them to stop by again in the next week and see if we can narrow it down (i.e., see if command line builds work/run/debug and then try again in VSCode). The visible diagnostics we get from VSCode just aren't very helpful to see what went wrong - it just wants to create a launch.json when it fails.
You should also try running Visual Studio Installer (it should be there in Start menu if you have Visual Studio or C++ Build Tools installed), and click the Update button there. This theoretically may break older version of Swift (5.10.1 or earlier), but should not break Swift 6.0.1 (yet).
@dima_kozhinov thanks for the suggestion. I'll see if I can try that on one of the students' computers next week.
@dschaefer2 I'm back to trying to get this to work. It works for me on my ARM M1 using Parallels with an ARM version of Windows 11, but I have students who don't have it working on their x86 Windows laptop. I using a Swift package init'ed with the executable type option. It appears VSCode is compiling it just fine but the run option (with or without debugging does nothing). If open the shell app on their computer, we can run swift build
and then cd into the various subdirectories in the .build to find the create .exe file and run it. So it appears to be an issue with VSCode running it. Any suggestions or any diagnostic data I can get for you?
Thanks,
Dave
I'm not sure how VSCode runs things. @plemarquand and friends are working in that area.
Yeah, print statements haven't worked on Windows (in VS Code) for more than 2.5 years now
I consider this issue one of the main blockers for Swift adoption on Windows: On Windows 10, at launch of LLDB, program is unable to access stdout or stdin ยท Issue #309 ยท swiftlang/vscode-swift ยท GitHub
I mean, if print("Hello, world")
doesn't even work (when ran from an IDE, not the command line), shouldn't this be considered a top-priority issue?
Ah, yeah, handling console output on Windows is definitely hard from my past experience with other tools. There we had to resort to win32 calls to create the right console sessions to allow the invoking tool to capture the streams. Could be hard from JavaScript. But we have some good people working on the extension so hopefully we can find a solution.
I have yet to be able to get this to work in Parallels and ARM Windows. I really wish there was a "build a Windows app using Swift" for dummies like myself. Meaning the simplest step by step guide possible.