Open alexanderjung-sdxag opened 9 months ago
Not sure what swift package restore
is? Did you maybe mean swift package resolve
? I don't have access to a Windows machine but at least in the toolchain we ship on macOS, there is no such thing as swift package restore
.
swift package restore
and swift package resolve
seem to be doing the same, (At least the resulting error is.)
I don't remember where I've gotten this from. (I'm going to change the title though.)
BTW: I also don't remember the option to pass to swift to get the detailed commands (i.e. swift package restore/resolve
)...
Here's the output with --vv
if that is any help:
c:\Swift\MyCLI>swift build --vv
debug: C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe -print-target-info
debug: C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe -print-target-info
debug: C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe -print-target-info
debug: C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe -print-target-info
debug: registering 'repository fetching' with terminator
debug: registering 'registry downloads' with terminator
debug: registering 'binary artifacts downloads' with terminator
debug: registering 'plugin runner' with terminator
debug: registering 'build system' with terminator
debug: 'mycli': evaluating manifest for 'mycli' v. unknown
debug: C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin\swiftc.exe -L C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\lib\swift\pm\ManifestAPI -lPackageDescription -sdk C:\Library\Developer\Platforms\Windows.platform\Developer\SDKs\Windows.sdk -libc MD -I C:\Library\Developer\Platforms\Windows.platform\Developer\Library\XCTest-development\usr\lib\swift\windows -I C:\Library\Developer\Platforms\Windows.platform\Developer\Library\XCTest-development\usr\lib\swift\windows\x86_64 -L C:\Library\Developer\Platforms\Windows.platform\Developer\Library\XCTest-development\usr\lib\swift\windows\x86_64 -use-ld=lld -swift-version 5 -I C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\lib\swift\pm\ManifestAPI -package-description-version 5.9.0 C:\Users\JungAl\AppData\Local\Temp\TemporaryDirectory.UNDgPt\manifest.swift -Xfrontend -disable-implicit-concurrency-module-import -Xfrontend -disable-implicit-string-processing-module-import -v -o C:\Users\JungAl\AppData\Local\Temp\TemporaryDirectory.o1Ia3x\mycli-manifest.exe
debug: C:\Users\JungAl\AppData\Local\Temp\TemporaryDirectory.o1Ia3x\mycli-manifest.exe -handle 370 -context "{""packageDirectory"":""C:\\Users\\JungAl\\AppData\\Local\\Temp\\TemporaryDirectory.UNDgPt""}"
error: 'mycli': Error Domain=NSCocoaErrorDomain Code=257 "You don’t have permission."
Looks like this is an issue in manifest loading, not sure where mycli
comes from or what it is supposed to be, it looks like we're trying to execute mycli-manifest.exe
and maybe that gets cut off somewhere and we're trying to execute something that doesn't exist instead?
mycli
is just a minimalist hello world application, created as per these instructions: https://www.swift.org/getting-started/cli-swiftpm/
And I can only guess what swift.exe is doing here - that is the reason I am stuck.
To be clear: This is the "You are new to swift? Try this simple hello-word-application to get you started"-example from the official swift documentation. And it does not work as advertised.
I'm one step further: ist seems that the toolchain creates an .exe in the temp folder and tries to access it.
This is denied by Microsoft Defender (and IMHO rightly so).
I would consider this a bug....
I have just renamed the issue to: "swift package resolve" creates a .exe in a temp folder
Rationale: Placing executables in temporary folders is a typical behavior of malware. For this reason accessing executables in temporary folders is prevented by Microsoft Defender in many companies.
My suggestion would be that the swift toolchain uses a local build folder (usually ./obj in other systems) for its temporary output.
Description I am new to swift and got stuck with the example https://www.swift.org/getting-started/cli-swiftpm/ under Windows 11.
swift build
- and I have narrowed it down toswift package restore
- results in the following error message:I could not find out, for which file or directory the permissions are missing.
Steps to reproduce I just followed the steps described in: https://www.swift.org/getting-started/ https://www.swift.org/install/windows/#installation-via-windows-package-manager https://www.swift.org/getting-started/cli-swiftpm/
Expected behavior
swift build
without error.Environment
Any help solving the issue - or at least tracking down the root cause - would be appreciated!
Additional info Same issue in VS Code.
swiftc Sources\main.swift -o MyCLI.exe
works.