Swift Package Manager (SPM) still not working on Windows

I cannot get the SPM working on Windows... It depends on the Windows language settings and/or the Swift version to where SPM gets stuck, currently (with 5.6-dev) after having displayed "Computing version for ...", with the stable version 5.4 it was at some other point. Process Monitor displays some ugly errors (for both versions, see below).

...And sorry: I already created the bug report SR-14976 and added some comments to https://forums.swift.org/t/stochastic-errors-resolving-dependencies-and-or-building-with-feb-18-2021-snapshot/44929, but until now I got no solution. Maybe someone has an idea, therefore this new topic. Thanks!

(And yes, I can create symbolic links, and Git is up-to-date (version 2).)

Parts of the display in Process Monitor:

"21:10:45,9106501","swift.exe","6036","RegQueryValue","HKLM\System\CurrentControlSet\Control\Notifications\418A073AA3BC8075","BUFFER TOO SMALL","Length: 0"
"21:10:47,2787745","swift.exe","6036","RegQueryValue","HKCU\Control Panel\Desktop\PreferredUILanguages","BUFFER OVERFLOW","Length: 12"
"21:10:47,2788588","swift.exe","6036","RegQueryValue","HKCU\Control Panel\Desktop\MuiCached\MachinePreferredUILanguages","BUFFER OVERFLOW","Length: 12"
"21:10:47,2825415","swift-build.exe","1260","RegQueryValue","HKLM\System\CurrentControlSet\Control\Notifications\418A073AA3BC8075","BUFFER TOO SMALL","Length: 0"
"21:10:47,2885078","swift-build.exe","1260","RegQueryValue","HKCU\Control Panel\Desktop\PreferredUILanguages","BUFFER OVERFLOW","Length: 12"
"21:10:47,2885929","swift-build.exe","1260","RegQueryValue","HKCU\Control Panel\Desktop\MuiCached\MachinePreferredUILanguages","BUFFER OVERFLOW","Length: 12"
"21:10:47,4290534","swift-build.exe","1260","RegQueryValue","HKLM\System\CurrentControlSet\Control\Notifications\418A073AA3BC8075","BUFFER TOO SMALL","Length: 0"
"21:10:47,4311495","swift-build.exe","1260","RegQueryValue","HKLM\System\CurrentControlSet\Services\WinSock2\Parameters\WinSock_Registry_Version","BUFFER OVERFLOW","Length: 16"
"21:10:47,4312408","swift-build.exe","1260","RegQueryValue","HKLM\System\CurrentControlSet\Services\WinSock2\Parameters\NameSpace_Callout","BUFFER OVERFLOW","Length: 12"

Hm, so I tried this out in a Windows VM and I can replicate your issue. For some reason, it just can't checkout your dependency:

Running resolver because the following dependencies were added: 'https://github.com/stefanspringer1/SwiftXMLParser'
Updating https://github.com/stefanspringer1/SwiftXMLParser
git.exe -C C:\Users\User\Documents\Code\SwiftXMLParserDemo-main\.build\repositories\SwiftXMLParser-865d16bd remote update -p
git.exe -C C:\Users\User\Documents\Code\SwiftXMLParserDemo-main\.build\repositories\SwiftXMLParser-865d16bd tag -l
git.exe -C C:\Users\User\Documents\Code\SwiftXMLParserDemo-main\.build\repositories\SwiftXMLParser-865d16bd rev-parse --verify "0.1.46^{commit}"
git.exe -C C:\Users\User\Documents\Code\SwiftXMLParserDemo-main\.build\repositories\SwiftXMLParser-865d16bd rev-parse --verify "0726950da8025127a1fe63d9b590d12c1767a86b^{tree}"
git.exe -C C:\Users\User\Documents\Code\SwiftXMLParserDemo-main\.build\repositories\SwiftXMLParser-865d16bd ls-tree bbe163aedc25e11ad85232599362b723ff41367b
git.exe -C C:\Users\User\Documents\Code\SwiftXMLParserDemo-main\.build\repositories\SwiftXMLParser-865d16bd cat-file -p f104067f962aef18f37a60f42b667809ae3ed217

And it just gets stuck there. I use SwiftPM all the time in this VM with other dependencies, and they all work fine. I haven't had to do any fiddling with symlink permissions as you describe in your README for those packages to work.

I'm not convinced that it has anything to do with your language configuration, but it just doesn't like something about this repository. What is weird is that if I replace your dependency with another random package (I chose swift-system, for no particular reason), it will check it out successfully. There's just something about that dependency package in particular that it can't deal with.

Thanks for trying this out. macOS and CentOS 7 are "happy" with the involved repositories, vey strange.

The process monitor output here is irrelevant. These are all registry accesses, not file system operations. It is unlikely to just show up as in process monitor in any case if there is an issue with something like locking.

It is unclear what the process is waiting on, and without a stack trace, I suspect it won't be possible to diagnose this. I cannot reproduce the behavior in a Windows Sandbox instance nor my actual development environment. I wouldn't rule out the possibility that it could be a bug in git as well.

The project that I am currently more interested to getting it built on Windows is https://github.com/stefanspringer1/SwiftXMLDemo.git, same problem here as for the project mentioned in my bug report.

Could you then please give me your git version number? Thanks.

Concerning Git: I actually installed the newest version (2.33.0.windows.1) (UPDATE: same problem with 2.23.0.windows.1). I have seen that in https://github.com/apple/swift-tools-support-core.git / Git.swift the environment variables GIT_TERMINAL_PROMPT and GIT_SSH_COMMAND are set to adjust the behaviour of Git, might be problematic in some "special" cases or with newer versions of Git? My Windows installation is quite a fresh one, in principle only Visual Studio, Git, and Swift installed (only changed the language settings), nothing really special here. Windows runs on a Mac in a Parallels VM with default configurations by Parallels.

I do not know which Git commands are actually used after "Computing version for ..." aka willComputeVersion(...) in https://github.com/apple/swift-package-manager.git / SwiftTool.swift, so could not try out Git in a separate command.

UPDATE: Made a fresh installation of Windows (Windows Home, English International version) with VS 2019, Git 2.33.0.windows.1, Swift 5.4.2. Differently from my old installation, I did not have to set the SE_CREATE_SYMBOLIC_LINK privilege separately, setting the Windows Developer Mode was enough. When trying to build https://github.com/stefanspringer1/SwiftXMLDemo.git via swift build -c release three consecutive times, the first two times the following error was now displayed:

error: Dependencies could not be resolved because no versions of 'SwiftXML' match the requirement 0.1.3..<1.0.0 and root depends on 'SwiftXML' 0.1.3..<1.0.0.

But https://github.com/stefanspringer1/SwiftXML.git has the tags 0.1.0, 0.1.1, 0.1.2, and 0.1.3, so 0.1.3 is (!) available.

The third time I issued swift build -c release, nothing was displayed after "Updating https://github.com/stefanspringer1/SwiftXML.git", it just got stuck.

UPDATE 2: After cleaning up the SPM caches, and calling the build from the Native VS Command Line as Administrator, the following error was displayed:

Fetching https://github.com/stefanspringer1/SwiftXML.git
error: the manifest is missing a Swift tools version specification; consider prepending to the manifest '// swift-tools-version:5.4.0' to specify the current Swift toolchain version as the lowest Swift version supported by the project; if such a specification already exists, consider moving it to the top of the manifest, or prepending it with '//' to help Swift Package Manager find it

The Swift Tools Version was '// swift-tools-version:5.4', I changed it to '// swift-tools-version:5.4.0' in all involved repsoitories. SPM then again gets stuck displaying "Fetching https://github.com/stefanspringer1/SwiftXML.git".

Note: Still everythings works on macOS and CentOS 7 with the changed repositories.

UPDATE 3: Installed a "Pro" version of Windows, SPM still gets stuck fetching.

UPDATE 4: Made a new empty package (library) with .package(url: "https://github.com/stefanspringer1/SwiftXMLParser.git", from: "0.1.48") and ... dependencies: ["SwiftXMLParser"]. SPM gets stuck fetching Fetching https://github.com/stefanspringer1/SwiftXMLParser.git. Absolutely unclear why this should be a problem. It still works on other plaforms (CentsOS 7 again testet with Git version 2.31.1).

Since you’re going to a lot of trouble to debug the issue anyway, you may have more luck building a debug SwiftPM from source. It isn’t very big, and can be built separately without needing to build the compiler.

That would let you find out more about why it’s getting stuck.

1 Like

Thank you for the suggestion. But I would have to build it on Windows where I have those problems, I tried before to build it, no luck.

I am thinking more about creating new repositories step by step and see if it then works.

Of course, it would be nicer to find out about the reason.

(I already added the ending "... .git" to one Github URL where it was missing, but that was not the cause, both versions seem to be OK.)

I tried exactly that:

  1. Created the packages directly under Windows with the installed Swift (5.4.2).
  2. Referenced one package (https://github.com/stefanspringer1/SwiftXMLInterfaces2.git) by the other (https://github.com/stefanspringer1/SwiftXMLParser2.git).

When trying to build SwiftXMLParser2 with the reference to SwiftXMLInterfaces2 (Package.swift see below), the following error is displayed:

error: the manifest is missing a Swift tools version specification; consider prepending to the manifest '// swift-tools-version:5.4.0' to specify the current Swift toolchain version as the lowest Swift version supported by the project; if such a specification already exists, consider moving it to the top of the manifest, or prepending it with '//' to help Swift Package Manager find it

This is already very strange because the package files were just created by the same SPM on the same system (only the dependency added)!

I removed the reference to the other package, the build was successful. When again referencing the other package and trying to build again (without any change), the following error is displayed:

Updating https://github.com/stefanspringer1/SwiftXMLInterfaces2.git
error: InternalError(description: "Internal error. Please file a bug at https://bugs.swift.org with this info. unable to get tag for swiftxmlinterfaces2[https://github.com/stefanspringer1/SwiftXMLInterfaces2.git] 0.0.1; available versions []")
error: ExitCode(rawValue: 1)
[0/1] Planning build
warning: failed to load the cached build description: fatalError

The current Package.swift file has the following content:

// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "SwiftXMLParser2",
    products: [
        // Products define the executables and libraries a package produces, and make them visible to other packages.
        .library(
            name: "SwiftXMLParser2",
            targets: ["SwiftXMLParser2"]),
    ],
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        .package(url: "https://github.com/stefanspringer1/SwiftXMLInterfaces2.git", from: "0.0.1"),
    ],
    targets: [
        // Targets are the basic building blocks of a package. A target can define a module or a test suite.
        // Targets can depend on other targets in this package, and on products in packages this package depends on.
        .target(
            name: "SwiftXMLParser2",
            dependencies: ["SwiftXMLInterfaces2"]),
        .testTarget(
            name: "SwiftXMLParser2Tests",
            dependencies: ["SwiftXMLParser2"]),
    ]
)

Something here is fundamentally broken! I do not think that my projects are not OK, because a) the projects are being built with no problem on macOS and CentOS 7, and b) besides the added dependency as above, both new packages are exactly as created by the SPM, c) I tried with different (also fresh) installations of Windows (Pro and Home, English and German, all running in a Parallels VM) and with different versions of Git (2.33, 2.23, 2.30), and d) with different settings for the tools version (5.3, 5.4, 5.4.0). Could something that Parallels sets for the Windows VMs be a problem?

UPDATE: After restarting also the host computer, every package in the line https://github.com/stefanspringer1/SwiftXMLInterfaces2.git -> https://github.com/stefanspringer1/SwiftXMLParser2.git -> https://github.com/stefanspringer1/SwiftXML2.git was built successfully, but when trying to build the executable https://github.com/stefanspringer1/SwiftXMLDemo2.git, again the following error:

Fetching https://github.com/stefanspringer1/SwiftXML2.git
Fetching https://github.com/stefanspringer1/SwiftXMLParser2.git from cache
error: Dependencies could not be resolved because root depends on 'SwiftXML2' 0.0.1..<1.0.0.
'SwiftXML2' cannot be used because 'SwiftXML2' depends on 'SwiftXMLParser2' 0.0.1..<1.0.0 and no versions of 'SwiftXMLParser2' match the requirement 0.0.1..<1.0.0.

This error message is nonsense, because the same SwiftXML2 that is not correct because of its dependency according to the error message had just been built correctly!

After again cleaning the caches up and trying to build again:

Fetching https://github.com/stefanspringer1/SwiftXML2.git
https://github.com/stefanspringer1/SwiftXML2.git @ 0.0.1: error: https://github.com/stefanspringer1/SwiftXML2.git has no Package.swift manifest for version 0.0.1 in https://github.com/stefanspringer1/SwiftXML2.git

That is no better than before.

Note: I also deactivated the Windows Defender etc. No help.

UPDATE 2: After re-trying a few times (also without cleaning up the caches) and after varying error messages, https://github.com/stefanspringer1/SwiftXMLDemo2.git could finally be build. Seems to be a little bit a game of luck...

UPDATE 3: Inserted my old source files into https://github.com/stefanspringer1/SwiftXMLInterfaces2.git and set the new tags 0.0.2 (following the initial 0.0.1) throughout the chain and referencing those. I then got the following error message which cites a version 0.0.3, but a version 0.0.3 is not written anywhere in those new repositories, SPM seems to search furher up from 0.0.2 because it does not like tools version 5.3(.0), the same tools version that did not pose a problem before and which was written by SPM itself when initializing the packages!

Updating https://github.com/stefanspringer1/SwiftXMLInterfaces2.git
Updating https://github.com/stefanspringer1/SwiftXML2.git
Updating https://github.com/stefanspringer1/SwiftXMLParser2.git
error: Dependencies could not be resolved because root depends on 'SwiftXML2' 0.0.2..<1.0.0.
'SwiftXML2' >= 0.0.2 cannot be used because no versions of 'SwiftXML2' match the requirement 0.0.3..<1.0.0 and 'SwiftXML2' 0.0.2 contains incompatible tools version (5.3.0).
error: ExitCode(rawValue: 1)
[0/1] Planning build
warning: failed to load the cached build description: fatalError

This might be unrelated, but I noticed that all GitHub URLs are still using https://.... GitHub turned off password authentication over HTTPS August 13th. See: Git password authentication is shutting down | GitHub Changelog

At my place of work we had to switch over to SSH authentication via keys completely, because our scripts that used git would otherwise fail too.

Yes, if you want to check-in something, yes; but SPM is only fetching, and for fetching you do not need any authorization for public Github repositories. And indeed SPM can fetch the above repositories in principle (sometimes). But thanks for the suggestion.

1 Like
>git --version
git version 2.31.1.windows.1

I'm using whatever is shipping in VS2022.

I just cloned and built the repository that you indicated that you were interested in. It builds just fine for me the first time around. I really do believe that you have some configuration that is different and is causing the issue. The use of Windows 10 English is definitely a good step - it should help bring the configurations closer together. Once you have it at a working point, then changing the settings to your environment should help isolate the setting. The other option is to actually do a complete build locally and use the debugger to figure out what is failing.

Summary
S:\SourceCache>git clone https://github.com/stefanspringer1/SwiftXMLDemo.git
Cloning into 'SwiftXMLDemo'...
remote: Enumerating objects: 27, done.
remote: Counting objects: 100% (27/27), done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 27 (delta 8), reused 19 (delta 4), pack-reused 0
Receiving objects: 100% (27/27), 10.03 KiB | 2.51 MiB/s, done.
Resolving deltas: 100% (8/8), done.

S:\SourceCache>cd SwiftXMLDemo

S:\SourceCache\SwiftXMLDemo>swift build
S:\SourceCache\SwiftXMLDemo: warning: Creating library C:\Users\compnerd\AppData\Local\Temp\TemporaryDirectory.2sYnvy\swiftxmldemo-manifest.lib and object C:\Users\compnerd\AppData\Local\Temp\TemporaryDirectory.2sYnvy\swiftxmldemo-manifest.exp
Fetching https://github.com/stefanspringer1/SwiftXML.git
Fetched https://github.com/stefanspringer1/SwiftXML.git (0.80s)
Computing version for https://github.com/stefanspringer1/SwiftXML.git
Computed https://github.com/stefanspringer1/SwiftXML.git at 0.1.6 (1.48s)
Fetching https://github.com/stefanspringer1/SwiftXMLParser.git
Fetched https://github.com/stefanspringer1/SwiftXMLParser.git (0.83s)
Computing version for https://github.com/stefanspringer1/SwiftXMLParser.git
Computed https://github.com/stefanspringer1/SwiftXMLParser.git at 0.1.48 (1.91s)
Fetching https://github.com/stefanspringer1/SwiftXMLInterfaces.git
Fetched https://github.com/stefanspringer1/SwiftXMLInterfaces.git (0.87s)
Computing version for https://github.com/stefanspringer1/SwiftXMLInterfaces.git
Computed https://github.com/stefanspringer1/SwiftXMLInterfaces.git at 0.1.36 (0.48s)
Creating working copy for https://github.com/stefanspringer1/SwiftXML.git
Working copy of https://github.com/stefanspringer1/SwiftXML.git resolved at 0.1.6
Creating working copy for https://github.com/stefanspringer1/SwiftXMLParser.git
Working copy of https://github.com/stefanspringer1/SwiftXMLParser.git resolved at 0.1.48
Creating working copy for https://github.com/stefanspringer1/SwiftXMLInterfaces.git
Working copy of https://github.com/stefanspringer1/SwiftXMLInterfaces.git resolved at 0.1.36
S:\SourceCache\SwiftXMLDemo\.build\checkouts\SwiftXML: warning: Creating library C:\Users\compnerd\AppData\Local\Temp\TemporaryDirectory.jCI1Aa\swiftxml-manifest.lib and object C:\Users\compnerd\AppData\Local\Temp\TemporaryDirectory.jCI1Aa\swiftxml-manifest.exp
S:\SourceCache\SwiftXMLDemo\.build\checkouts\SwiftXMLParser: warning: Creating library C:\Users\compnerd\AppData\Local\Temp\TemporaryDirectory.5cKHsN\swiftxmlparser-manifest.lib and object C:\Users\compnerd\AppData\Local\Temp\TemporaryDirectory.5cKHsN\swiftxmlparser-manifest.exp
S:\SourceCache\SwiftXMLDemo\.build\checkouts\SwiftXMLInterfaces: warning: Creating library C:\Users\compnerd\AppData\Local\Temp\TemporaryDirectory.naqhRr\swiftxmlinterfaces-manifest.lib and object C:\Users\compnerd\AppData\Local\Temp\TemporaryDirectory.naqhRr\swiftxmlinterfaces-manifest.exp
The system cannot find the path specified.
[1/8] Compiling SwiftXMLInterfaces Parsing.swift
[2/8] Compiling SwiftXMLInterfaces Production.swift
[3/8] Compiling SwiftXMLInterfaces Formatting.swift
[4/9] Merging module SwiftXMLInterfaces
[5/9] Wrapping AST for SwiftXMLInterfaces for debugging
[6/10] Compiling SwiftXMLParser SwiftXMLParser.swift
[7/11] Merging module SwiftXMLParser
[8/11] Wrapping AST for SwiftXMLParser for debugging
[9/17] Compiling SwiftXML Parsing.swift
[10/17] Compiling SwiftXML Iteration.swift
[11/17] Compiling SwiftXML Production.swift
[12/17] Compiling SwiftXML XMLBuilder.swift
[13/17] Compiling SwiftXML Document.swift
[14/17] Compiling SwiftXML Nodes.swift
[15/18] Merging module SwiftXML
[16/18] Wrapping AST for SwiftXML for debugging
[17/19] Compiling SwiftXMLDemo main.swift
[18/20] Merging module SwiftXMLDemo
[19/20] Wrapping AST for SwiftXMLDemo for debugging
   Creating library S:\SourceCache\SwiftXMLDemo\.build\x86_64-unknown-windows-msvc\debug\SwiftXMLDemo.lib and object S:\SourceCache\SwiftXMLDemo\.build\x86_64-unknown-windows-msvc\debug\SwiftXMLDemo.exp
LINK : warning LNK4217: symbol '$s18SwiftXMLInterfaces22DefaultXMLEventHandlerCAA0dE0AAWP' defined in 'Parsing.swift.o' is imported by 'Parsing.swift.o' in function '$s8SwiftXML05parseB04path22internalEntityResolverAA11XMLDocumentCSS_0A13XMLInterfaces08InternalfG0_ptKF'
LINK : warning LNK4217: symbol '$s14SwiftXMLParser5parse4path12eventHandler22internalEntityResolverySS_0A13XMLInterfaces08XMLEventF0_pAF08InternalhI0_pSgtKF' defined in 'SwiftXMLParser.swift.o' is imported by 'Parsing.swift.o' in function '$s8SwiftXML05parseB04path22internalEntityResolverAA11XMLDocumentCSS_0A13XMLInterfaces08InternalfG0_ptKF'
LINK : warning LNK4217: symbol '$s14SwiftXMLParser5parse4text8pathInfo12eventHandler22internalEntityResolverySS_SSSg0A13XMLInterfaces08XMLEventH0_pAH08InternaljK0_pSgtKF' defined in 'SwiftXMLParser.swift.o' is imported by 'Parsing.swift.o' in function '$s8SwiftXML05parseB04text8pathInfo22internalEntityResolverAA11XMLDocumentCSS_SSSg0A13XMLInterfaces08InternalhI0_ptKF'
LINK : warning LNK4217: symbol '$s14SwiftXMLParser5parse4data8pathInfo12eventHandler22internalEntityResolvery10Foundation4DataV_SSSg0A13XMLInterfaces08XMLEventH0_pAK08InternaljK0_pSgtKF' defined in 'SwiftXMLParser.swift.o' is imported by 'Parsing.swift.o' in function '$s8SwiftXML05parseB04data8pathInfo22internalEntityResolverAA11XMLDocumentC10Foundation4DataV_SSSg0A13XMLInterfaces08InternalhI0_ptKF'
LINK : warning LNK4217: symbol '$s18SwiftXMLInterfaces19DefaultXMLFormatterCACycfc' defined in 'Formatting.swift.o' is imported by 'Production.swift.o' in function '$s8SwiftXML19DefaultXMLFormatterCACycfc'
LINK : warning LNK4217: symbol '$s18SwiftXMLInterfaces19DefaultXMLFormatterCfd' defined in 'Formatting.swift.o' is imported by 'Production.swift.o' in function '$s8SwiftXML19DefaultXMLFormatterCfd'
LINK : warning LNK4217: symbol '$s18SwiftXMLInterfaces20DefaultXMLProductionC4file9formatterAC10Foundation10FileHandleCSg_AA12XMLFormatter_pSgtcfc' defined in 'Production.swift.o' is imported by 'Production.swift.o' in function '$s8SwiftXML20DefaultXMLProductionC4file9formatterAC10Foundation10FileHandleCSg_AA12XMLFormatter_pSgtcfc'
LINK : warning LNK4217: symbol '$s18SwiftXMLInterfaces20DefaultXMLProductionCfd' defined in 'Production.swift.o' is imported by 'Production.swift.o' in function '$s8SwiftXML20DefaultXMLProductionCfd'
LINK : warning LNK4217: symbol '$s18SwiftXMLInterfaces19DefaultXMLFormatterCAA0D0AAWP' defined in 'Formatting.swift.o' is imported by 'Production.swift.o' in function '$s8SwiftXML19DefaultXMLFormatterCAA0D0AAWI'
LINK : warning LNK4217: symbol '$s18SwiftXMLInterfaces20DefaultXMLProductionCAA0D0AAWP' defined in 'Production.swift.o' is imported by 'Production.swift.o' in function '$s8SwiftXML20DefaultXMLProductionCAA0D0AAWI'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces12XMLFormatterMp' defined in 'Formatting.swift.o' is imported by 'Production.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces19DefaultXMLFormatterCMn' defined in 'Formatting.swift.o' is imported by 'Production.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces19DefaultXMLFormatterCMn' defined in 'Formatting.swift.o' is imported by 'main.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces19DefaultXMLFormatterCACycfCTq' defined in 'Formatting.swift.o' is imported by 'Production.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces19DefaultXMLFormatterCACycfCTq' defined in 'Formatting.swift.o' is imported by 'main.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces13XMLProductionMp' defined in 'Production.swift.o' is imported by 'Production.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces20DefaultXMLProductionCMn' defined in 'Production.swift.o' is imported by 'Production.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces20DefaultXMLProductionC4file9formatterAC10Foundation10FileHandleCSg_AA12XMLFormatter_pSgtcfCTq' defined in 'Production.swift.o' is imported by 'Production.swift.o'
LINK : warning LNK4217: symbol '$s18SwiftXMLInterfaces22DefaultXMLEventHandlerCACycfc' defined in 'Parsing.swift.o' is imported by 'XMLBuilder.swift.o' in function '$s8SwiftXML10XMLBuilderC8document13currentBranchAcA11XMLDocumentCz_AA9XMLBranchCSgtcfc'
LINK : warning LNK4217: symbol '$s18SwiftXMLInterfaces22DefaultXMLEventHandlerCfd' defined in 'Parsing.swift.o' is imported by 'XMLBuilder.swift.o' in function '$s8SwiftXML10XMLBuilderCfd'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces22DefaultXMLEventHandlerCMn' defined in 'Parsing.swift.o' is imported by 'XMLBuilder.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces22DefaultXMLEventHandlerC13documentStartyyFTq' defined in 'Parsing.swift.o' is imported by 'XMLBuilder.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces22DefaultXMLEventHandlerC14xmlDeclaration7version8encoding10standaloneySS_SSSgAHtFTq' defined in 'Parsing.swift.o' is imported by 'XMLBuilder.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces22DefaultXMLEventHandlerC23documentTypeDeclaration4type8publicID06systemK0ySS_SSSgAHtFTq' defined in 'Parsing.swift.o' is imported by 'XMLBuilder.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces22DefaultXMLEventHandlerC12elementStart4name10attributes12combineTextsySS_SDyS2SGzSbtFTq' defined in 'Parsing.swift.o' is imported by 'XMLBuilder.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces22DefaultXMLEventHandlerC10elementEnd4nameySS_tFTq' defined in 'Parsing.swift.o' is imported by 'XMLBuilder.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces22DefaultXMLEventHandlerC4textAD12isWhitespaceySS_SbtFTq' defined in 'Parsing.swift.o' is imported by 'XMLBuilder.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces22DefaultXMLEventHandlerC12cdataSection4textySS_tFTq' defined in 'Parsing.swift.o' is imported by 'XMLBuilder.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces22DefaultXMLEventHandlerC14internalEntity4nameySS_tFTq' defined in 'Parsing.swift.o' is imported by 'XMLBuilder.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces22DefaultXMLEventHandlerC14externalEntity4nameySS_tFTq' defined in 'Parsing.swift.o' is imported by 'XMLBuilder.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces22DefaultXMLEventHandlerC21processingInstruction6target7contentySS_SSSgtFTq' defined in 'Parsing.swift.o' is imported by 'XMLBuilder.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces22DefaultXMLEventHandlerC7comment4textySS_tFTq' defined in 'Parsing.swift.o' is imported by 'XMLBuilder.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces22DefaultXMLEventHandlerC25internalEntityDeclaration4name5valueySS_SStFTq' defined in 'Parsing.swift.o' is imported by 'XMLBuilder.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces22DefaultXMLEventHandlerC25externalEntityDeclaration4name8publicID06systemK0ySS_SSSgSStFTq' defined in 'Parsing.swift.o' is imported by 'XMLBuilder.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces22DefaultXMLEventHandlerC25unparsedEntityDeclaration4name8publicID06systemK08notationySS_SSSgS2StFTq' defined in 'Parsing.swift.o' is imported by 'XMLBuilder.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces22DefaultXMLEventHandlerC19notationDeclaration4name8publicID06systemJ0ySS_SSSgAHtFTq' defined in 'Parsing.swift.o' is imported by 'XMLBuilder.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces22DefaultXMLEventHandlerC18elementDeclaration4name4textySS_SStFTq' defined in 'Parsing.swift.o' is imported by 'XMLBuilder.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces22DefaultXMLEventHandlerC24attributeListDeclaration4name4textySS_SStFTq' defined in 'Parsing.swift.o' is imported by 'XMLBuilder.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces22DefaultXMLEventHandlerC26parameterEntityDeclaration4name5valueySS_SStFTq' defined in 'Parsing.swift.o' is imported by 'XMLBuilder.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces22DefaultXMLEventHandlerC11documentEndyyFTq' defined in 'Parsing.swift.o' is imported by 'XMLBuilder.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces22DefaultXMLEventHandlerCACycfCTq' defined in 'Parsing.swift.o' is imported by 'XMLBuilder.swift.o'
LINK : warning LNK4217: symbol '$s8SwiftXML05parseB04path22internalEntityResolverAA11XMLDocumentCSS_0A13XMLInterfaces08InternalfG0_ptKF' defined in 'Parsing.swift.o' is imported by 'main.swift.o' in function 'main'
LINK : warning LNK4217: symbol '$s8SwiftXML19DefaultXMLFormatterCAA0D0AAWP' defined in 'Production.swift.o' is imported by 'main.swift.o' in function 'main'
LINK : warning LNK4217: symbol '$s8SwiftXML19DefaultXMLFormatterCACycfc' defined in 'Production.swift.o' is imported by 'main.swift.o' in function '$s12SwiftXMLDemo14MyXMLFormatterCACycfc'
LINK : warning LNK4217: symbol '$s18SwiftXMLInterfaces9escapeAllyS2SF' defined in 'Formatting.swift.o' is imported by 'main.swift.o' in function '$s12SwiftXMLDemo14MyXMLFormatterC14attributeValue5valueS2S_tF'
LINK : warning LNK4217: symbol '$s8SwiftXML19DefaultXMLFormatterCfd' defined in 'Production.swift.o' is imported by 'main.swift.o' in function '$s12SwiftXMLDemo14MyXMLFormatterCfd'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces22InternalEntityResolverMp' defined in 'Parsing.swift.o' is imported by 'main.swift.o'
LINK : warning LNK4286: symbol '$s8SwiftXML19DefaultXMLFormatterCMn' defined in 'Production.swift.o' is imported by 'main.swift.o'
LINK : warning LNK4286: symbol '$s8SwiftXML19DefaultXMLFormatterC34sortedDeclarationsInInternalSubset8documentSayAA014XMLDeclarationghI0CGAA11XMLDocumentC_tFTq' defined in 'Production.swift.o' is imported by 'main.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces19DefaultXMLFormatterC14attributeValue5valueS2S_tFTq' defined in 'Formatting.swift.o' is imported by 'main.swift.o'
LINK : warning LNK4286: symbol '$s18SwiftXMLInterfaces19DefaultXMLFormatterC4textADS2S_tFTq' defined in 'Formatting.swift.o' is imported by 'main.swift.o'
[20/20] Linking S:\SourceCache\SwiftXMLDemo\.build\x86_64-unknown-windows-msvc\debug\SwiftXMLDemo.exe
[20/20] Build complete!

I installed the same Git version and it did not help. I am actually using VS 2019, not 2022 (VS 2022 is only a preview I think?), the Git form VS 2019 is of version 2.29.2.windows.4 (it can be found in C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\bin), using that did not help either.

Never did that – isn't there some debug option (via argument) for SPM displaying more info? E.g. displaying the Git commands?

This of course is good news and thank you for trying this again. It means that I probably have not done something too stupid in those repositories.

UPDATE:

Set host system (macOS) to English, installed Windows Pro in Parallels VM, set language to English also for Keyboard etc., removed German language completely, set Developer Mode (mklink does function), installed VS 2022 this time, inserted Swift adjustments for VS, added C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\bin to PATH, installed Swift 5.4.2. The only other installation was (as first installation) Visual Studio Code. All commands (also the ones listed below) issued from the x64 VS Native Tools Command Prompt, running in Admin mode.

Then:

  • git clone https://github.com/stefanspringer1/SwiftXMLDemo.git
  • cd SwiftXMLDemo
  • swift build

Result:

Fetching https://github.com/stefanspringer1/SwiftXML.git
error: Dependencies could not be resolved because no versions of 'SwiftXML' match the requirement 0.1.6..<1.0.0 and root depends on 'SwiftXML' 0.1.6..<1.0.0.

Tried gain, SPM got stuck ("Updating https://github.com/stefanspringer1/SwiftXML.git").Then also deactivated Windows Defender (all firewalls etc.), removed C:\Users\stefan\.swiftpm, C:\Users\stefan\AppData\Local\Temp\org.swift.foundation.URLCache, C:\Users\stefan\AppData\Local\Temp\org.swift.swiftpm, and SwiftXMLDemo\.build (no packages.resolved available), restarted the computer and tried again. SPM got stuck again (again: "Updating https://github.com/stefanspringer1/SwiftXML.git"). After restarting and repeating the cleanup the following error message with the ...incompatible tools version... message:

Fetching https://github.com/stefanspringer1/SwiftXML.git
error: Dependencies could not be resolved because root depends on 'SwiftXML' 0.1.6..<1.0.0.
'SwiftXML' >= 0.1.6 cannot be used because no versions of 'SwiftXML' match the requirement 0.1.7..<1.0.0 and 'SwiftXML' 0.1.6 contains incompatible tools version (5.4.0).

I really do not know how to do better.

No, you will have to build SPM from source to debug this. You will additionally need WinDBG Preview to get the stack trace as well as lldb (which will require tweaking your path to ensure that Python is in the path).

This is unlikely to be the cause - the behavioural aspects apply to Windows.

Make sure that you rd /s /q .build each time. Doing the incremental builds is likely to be cause of "getting stuck". The failure is likely leaving something in an incorrect state.

I wonder if there is some bug in the 5.4 release's dependency resolution? Perhaps @tomerd or @abertelrud know if there was such a thing. However, the resolution failing really needs to be understood, as it is possible that there is some change that is getting applied and causing the package graph to not be equivalent.

You can get a lot more information with -v. (That is how @Karl got the output he posted in the second comment.)

1 Like

swift build -v result in an error no versions of 'SwiftXML' match the requirement 0.1.6..<1.0.0:

...
git.exe clone -c core.symlinks=true --mirror https://github.com/stefanspringer1/SwiftXML.git C:/Users/stefan/AppData/Local/Temp\org.swift.swiftpm\repositories\SwiftXML-6088ac03
git.exe -C C:\Users\stefan\Projects\SwiftXMLDemo\.build\repositories\SwiftXML-6088ac03 tag -l
error: Dependencies could not be resolved because no versions of 'SwiftXML' match the requirement 0.1.6..<1.0.0 and root depends on 'SwiftXML' 0.1.6..<1.0.0.

But: The last command listed there:

git.exe -C C:\Users\stefan\Projects\SwiftXMLDemo\.build\repositories\SwiftXML-6088ac03 tag -l

has the output:

error: cannot spawn less: No such file or directory
0.1.0
0.1.1
0.1.2
0.1.3
0.1.4
0.1.5
0.1.6

So 0.1.6 is part of the output and should be recognized, but at the same time an error cannot spawn less occurs, so that could be the cause that Swift does not recognize 0.1.6.

Cf. https://stackoverflow.com/questions/60371641/git-error-cannot-spawn-more-no-such-file-or-directory. Proposed solution for that problem: Git config:

git config --global core.pager '\"C:\Windows\System32\more.com\"'

New error: Now the build process stops after displaying swiftxml-manifest.exe -handle ...:

One Windows installation:

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\4_2 -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\x86_64 -L C:\Library\Developer\Platforms\Windows.platform\Developer\Library\XCTest-development\usr\lib\swift\windows -use-ld=lld -swift-version 5 -I C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\lib\swift\pm\4_2 -package-description-version 5.4.0 C:\Users\stefan\AppData\Local\Temp\TemporaryFile.xwBc5H.swift -o C:\Users\stefan\AppData\Local\Temp\TemporaryDirectory.FaigZ3\swiftxml-manifest.exe
C:\Users\stefan\AppData\Local\Temp\TemporaryDirectory.FaigZ3\swiftxml-manifest.exe -handle 428

Other Windows installation:

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\4_2 -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\x86_64 -L C:\Library\Developer\Platforms\Windows.platform\Developer\Library\XCTest-development\usr\lib\swift\windows -use-ld=lld -swift-version 5 -I C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\lib\swift\pm\4_2 -package-description-version 5.4.0 C:\Users\stefan\AppData\Local\Temp\TemporaryFile.q2VjKb.swift -o C:\Users\stefan\AppData\Local\Temp\TemporaryDirectory.W1ssYN\swiftxml-manifest.exe
C:\Users\stefan\AppData\Local\Temp\TemporaryDirectory.W1ssYN\swiftxml-manifest.exe -handle 41c

The directory C:\Users\stefan\AppData\Local\Temp\TemporaryDirectory.W1ssYN (or what the current name is) exists for a short moment, but not any more when the build process stops. So I think the halting of the process has nothing to do with that last command (assuming the directory is not removed too early).

With Swift 5.6-dev (instead of 5.4.2 as above) the process halts just before that, after displaying

...\swiftc.exe ...  -o C:\Users\stefan\AppData\Local\Temp\TemporaryDirectory.0iBoZK\swiftxml-manifest.exe

and the temporary directory e.g. C:\Users\stefan\AppData\Local\Temp\TemporaryDirectory.0iBoZK persists, containing swiftxml-manifest and swiftxml-manifest.lib (but not swiftxml-manifest.exe as in the above call, the file extension is missing).

This indicates that you aren't using the x64 Native Tools Command Prompt.

less is normally not in the path, as it is a tool that is installed by Git, which needs to be in your path. You should be able to add that to your path as:

path %PATH%;%ProgramFiles%\Git\usr\bin

Its unclear where/why this is not completing. The command should building the manifest executable. If that is hanging, then you should build a debug version of the compiler and determine where the hang is (I've not seen that before). Alternatively, it could be when it is trying to actually execute the manifest binary, in which case, it is likely that either

  • your path is getting corrupted or is incorrect and the binary fails to launch
  • the pipe construction is silently failing (see ManifestLoader.swift in swift package manager)
  • the pipe isn't getting flushed properly and the communication channel never terminates (again see the manifest loading path in Swift Package Manager)

The manifest loading has had some changes recently by @tomerd though I don't believe that they are yet available in a prebuilt nightly image on swift.org.

Everything was executed from the x64 Native Tools Command Prompt.

Would be nice to try. Is there any chance for this within the next few days?

Building Swift myself was not really something I planned. Isn't there some kind of debug version of Swift where such an analysis is possible?

If Swift uses a Git command that needs the less command and it is not available for a standard installation of Git on Windows without adjusting the path, I consider it problematic.

@tomerd: Are your changes somehow "available" yes? I still get stuck with a message like:

C:\Users\stefan\AppData\Local\Temp\TemporaryDirectory.eK9Mr0\swiftxml-manifest.exe -handle 414

At that moment that directory does not exist any more, so maybe the problem is at some later step.

I now re-installed Windows and VS and Swift in different versions again and again, not once did my project get built, the same project that always gets built on macOS and CentOS 7. I really do not know what to do. Any help?

Posted the followoing two new bug reports:

The first suggests adding some information to the Getting Started page.

The second describes my problem that still persists after that suggested info is considered.