Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fatalErrror trying to run tests on Windows #584

Open
2 tasks done
dabrahams opened this issue Sep 10, 2023 · 6 comments
Open
2 tasks done

fatalErrror trying to run tests on Windows #584

dabrahams opened this issue Sep 10, 2023 · 6 comments

Comments

@dabrahams
Copy link

Replace this paragraph with a short description of the incorrect incorrect behavior. If this is a regression, please note the last version that the behavior was correct in addition to your current version.

ArgumentParser version: the main branch
Swift version:
Swift version 5.9-dev (LLVM ad32770d6738638, Swift 753d54576e043ca)
Target: aarch64-unknown-windows-msvc

Checklist

  • If possible, I've reproduced the issue using the main branch of this package
  • I've searched for existing GitHub issues

Steps to Reproduce

Check it out on Windows. "swift test"

Expected behavior

All tests pass.

Actual behavior

Building for debugging...
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\DumpHelpGenerator.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import ArgumentParserToolInfo
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\DumpHelpGenerator.swift:13:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import class Foundation.JSONEncoder
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\MessageInfo.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import protocol Foundation.LocalizedError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\MessageInfo.swift:13:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import class Foundation.NSError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\UsageGenerator.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import protocol Foundation.LocalizedError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\DumpHelpGenerator.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import ArgumentParserToolInfo
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\DumpHelpGenerator.swift:13:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import class Foundation.JSONEncoder
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\MessageInfo.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import protocol Foundation.LocalizedError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\MessageInfo.swift:13:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import class Foundation.NSError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\UsageGenerator.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import protocol Foundation.LocalizedError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\DumpHelpGenerator.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import ArgumentParserToolInfo
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\DumpHelpGenerator.swift:13:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import class Foundation.JSONEncoder
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\MessageInfo.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import protocol Foundation.LocalizedError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\MessageInfo.swift:13:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import class Foundation.NSError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\UsageGenerator.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import protocol Foundation.LocalizedError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\DumpHelpGenerator.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import ArgumentParserToolInfo
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\DumpHelpGenerator.swift:13:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import class Foundation.JSONEncoder
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\MessageInfo.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import protocol Foundation.LocalizedError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\MessageInfo.swift:13:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import class Foundation.NSError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\UsageGenerator.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import protocol Foundation.LocalizedError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\DumpHelpGenerator.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import ArgumentParserToolInfo
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\DumpHelpGenerator.swift:13:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import class Foundation.JSONEncoder
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\MessageInfo.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import protocol Foundation.LocalizedError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\MessageInfo.swift:13:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import class Foundation.NSError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\UsageGenerator.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import protocol Foundation.LocalizedError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\DumpHelpGenerator.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import ArgumentParserToolInfo
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\DumpHelpGenerator.swift:13:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import class Foundation.JSONEncoder
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\MessageInfo.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import protocol Foundation.LocalizedError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\MessageInfo.swift:13:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import class Foundation.NSError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\UsageGenerator.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import protocol Foundation.LocalizedError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\DumpHelpGenerator.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import ArgumentParserToolInfo
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\DumpHelpGenerator.swift:13:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import class Foundation.JSONEncoder
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\MessageInfo.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import protocol Foundation.LocalizedError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\MessageInfo.swift:13:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import class Foundation.NSError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\UsageGenerator.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import protocol Foundation.LocalizedError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\DumpHelpGenerator.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import ArgumentParserToolInfo
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\DumpHelpGenerator.swift:13:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import class Foundation.JSONEncoder
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\MessageInfo.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import protocol Foundation.LocalizedError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\MessageInfo.swift:13:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import class Foundation.NSError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\UsageGenerator.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import protocol Foundation.LocalizedError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\DumpHelpGenerator.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import ArgumentParserToolInfo
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\DumpHelpGenerator.swift:13:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import class Foundation.JSONEncoder
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\MessageInfo.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import protocol Foundation.LocalizedError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\MessageInfo.swift:13:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import class Foundation.NSError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\UsageGenerator.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import protocol Foundation.LocalizedError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\DumpHelpGenerator.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import ArgumentParserToolInfo
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\DumpHelpGenerator.swift:13:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import class Foundation.JSONEncoder
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\MessageInfo.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import protocol Foundation.LocalizedError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\MessageInfo.swift:13:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import class Foundation.NSError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\UsageGenerator.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import protocol Foundation.LocalizedError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\DumpHelpGenerator.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import ArgumentParserToolInfo
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\DumpHelpGenerator.swift:13:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import class Foundation.JSONEncoder
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\MessageInfo.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import protocol Foundation.LocalizedError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\MessageInfo.swift:13:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import class Foundation.NSError
                     ^
C:\Users\dave\src\swift-argument-parser\Sources\ArgumentParser\Usage\UsageGenerator.swift:12:22: warning: using '@_implementationOnly' without enabling library evolution for 'ArgumentParser' may lead to instability during execution
@_implementationOnly import protocol Foundation.LocalizedError
                     ^
error: emit-module command failed with exit code 1 (use -v to see invocation)
C:\Users\dave\src\swift-argument-parser\Examples\repeat\Repeat.swift:14:1: error: 'main' attribute cannot be used in a module that contains top-level code
@main
^
C:\Users\dave\src\swift-argument-parser\Examples\repeat\Repeat.swift:1:1: note: top-level code defined in this source file
//===----------------------------------------------------------*- swift -*-===//
^
C:\Users\dave\src\swift-argument-parser\Examples\repeat\Repeat.swift:1:1: note: pass '-parse-as-library' to compiler invocation if this is intentional
//===----------------------------------------------------------*- swift -*-===//
^
C:\Users\dave\src\swift-argument-parser\Examples\repeat\Repeat.swift:14:1: error: 'main' attribute cannot be used in a module that contains top-level code
@main
^
C:\Users\dave\src\swift-argument-parser\Examples\repeat\Repeat.swift:1:1: note: top-level code defined in this source file
//===----------------------------------------------------------*- swift -*-===//
^
C:\Users\dave\src\swift-argument-parser\Examples\repeat\Repeat.swift:1:1: note: pass '-parse-as-library' to compiler invocation if this is intentional
//===----------------------------------------------------------*- swift -*-===//
^
error: fatalError

error: fatalError
@rauhul
Copy link
Contributor

rauhul commented Sep 11, 2023

@compnerd any ideas here? All of the errors listed here seem wrong

The warnings about @_implementationOnly are correct and that should be removed in favor of import acls

@compnerd
Copy link
Collaborator

@rauhul hmm, I think that the @_implementationOnly import are predating the import ACLs - the intent is to avoid leaking the imports into the clients, and as long as that is done, I don't see a problem in changing them.

The fatal error is related to the missing -parse-as-library due to the use of @main which is a long standing issue.

@rauhul
Copy link
Contributor

rauhul commented Sep 11, 2023

Correct the use of implementation only was to avoid leaking api, but it also can produce complete broken code for non resilient libraries.

The fatal error is related to the missing -parse-as-library due to the use of @main which is a long standing issue.

Is this a windows specific thing?

@compnerd
Copy link
Collaborator

The fatal error is related to the missing -parse-as-library due to the use of @main which is a long standing issue.

Is this a windows specific thing?

No, this is a general Swift issue. apple/swift#56843 was the original bit of discussion around this, and there has always been a requirement to pass -parse-as-library for the use of @main.

@dabrahams
Copy link
Author

@compnerd I'm a bit confused. @main seems to work on Mac (and Linux IIRC) without that flag. Is this due to Windows having a stricter symbol linking model? If it's going to be a general requirement we should diagnose failures to pass the flag (on all platforms) rather than trapping in the compiler, right?

@compnerd
Copy link
Collaborator

@dabrahams no this behavior is not windows specific. The issue is reported by the frontend if you note. This really should be diagnosed on all platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants