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

fatal compiler error on swift 5.7 and Swift 5.8 #94

Closed
1 of 2 tasks
sebsto opened this issue Aug 23, 2024 · 11 comments · Fixed by #96
Closed
1 of 2 tasks

fatal compiler error on swift 5.7 and Swift 5.8 #94

sebsto opened this issue Aug 23, 2024 · 11 comments · Fixed by #96
Labels
bug Something isn't working

Comments

@sebsto
Copy link

sebsto commented Aug 23, 2024

Description

using Swift Docc plugin 1.0.0, I receive fatal compilation error from Swift on 5.7 and 5.8

19:03:38 [2/2] Compiling plugin Swift-DocC
19:03:38 error: fatalError

or

19:01:05 Compiling plugin Swift-DocC...
19:01:05 error: emit-module command failed with exit code 1 (use -v to see invocation)
19:01:05 /code/.build/checkouts/swift-docc-plugin/Plugins/Swift-DocC Convert/Symbolic Links/SwiftDocCPluginUtilities/CommandLineArguments/CommandLineArguments.swift:31:50: error: consecutive declarations on a line must be separated by ';'
19:01:05     private var remainingOptionsOrFlags: [String].SubSequence
19:01:05                                                  ^
19:01:05                                                  ;
19:01:05 /code/.build/checkouts/swift-docc-plugin/Plugins/Swift-DocC Convert/Symbolic Links/SwiftDocCPluginUtilities/CommandLineArguments/CommandLineArguments.swift:31:50: error: expected declaration
19:01:05     private var remainingOptionsOrFlags: [String].SubSequence
19:01:05                                                  ^
19:01:05 /code/.build/checkouts/swift-docc-plugin/Plugins/Swift-DocC Convert/Symbolic Links/SwiftDocCPluginUtilities/CommandLineArguments/CommandLineArguments.swift:12:15: note: in declaration of 'CommandLineArguments'
19:01:05 public struct CommandLineArguments {
19:01:05               ^
19:01:05 /code/.build/checkouts/swift-docc-plugin/Plugins/Swift-DocC Convert/Symbolic Links/SwiftDocCPluginUtilities/CommandLineArguments/CommandLineArguments.swift:34:40: error: consecutive declarations on a line must be separated by ';'
19:01:05     private var literalValues: [String].SubSequence
19:01:05                                        ^
19:01:05                                        ;
19:01:05 /code/.build/checkouts/swift-docc-plugin/Plugins/Swift-DocC Convert/Symbolic Links/SwiftDocCPluginUtilities/CommandLineArguments/CommandLineArguments.swift:34:40: error: expected declaration
19:01:05     private var literalValues: [String].SubSequence
19:01:05                                        ^
19:01:05 /code/.build/checkouts/swift-docc-plugin/Plugins/Swift-DocC Convert/Symbolic Links/SwiftDocCPluginUtilities/CommandLineArguments/CommandLineArguments.swift:12:15: note: in declaration of 'CommandLineArguments'
19:01:05 public struct CommandLineArguments {
19:01:05               ^
19:01:05 error: fatalError

This breaks our pipeline for The Swift Lambda runtime, see the automated tests for this PR : swift-server/swift-aws-lambda-runtime#342

Checklist

  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue.

Expected Behavior

Should compile on last 3 Swift versions

Actual behavior

error: fatalError

Steps To Reproduce

Checkout this PR and compile with a 5.7 or 5.8 toolchain

Swift-DocC Version Information

1.0.0

Swift Compiler Version Information

5.7 and 5.8
@sebsto sebsto added the bug Something isn't working label Aug 23, 2024
@d-ronnqvist
Copy link
Contributor

Did you mean version 1.4.x of the plugin? Version 1.0.0 doesn't have the code that's referenced in that log output.

Assuming so, you can workaround this error by pinning your swift-docc-plugin dependency to 1.3.0

@d-ronnqvist
Copy link
Contributor

I'm on vacation next week, away from a computer, but I can look at this when I get back if no one else has fixed this by then.

@sebsto
Copy link
Author

sebsto commented Aug 23, 2024

Yes, I tried with version 1.0.0 and 1.3.0 of the plugin. both generates fatal errors when trying to compile with swift 5.7 or Swift 5.8

@d-ronnqvist
Copy link
Contributor

That makes no sense since the file that those errors are about is 1 day old and the 1.3.0 release is from June 2023

@sebsto
Copy link
Author

sebsto commented Aug 23, 2024

Here is the PR where I observed the error. It looks like the latest version is picked up because of the from

The Package@swift-5.7.swift, Package@swift-5.8.swift, and Package.swift,
have all this dependency

.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.0")

This is the error from Jenkins logs for Swift 5.7

Compiling plugin Swift-DocC...
19:59:10 error: emit-module command failed with exit code 1 (use -v to see invocation)
19:59:10 /code/.build/checkouts/swift-docc-plugin/Plugins/Swift-DocC Convert/Symbolic Links/SwiftDocCPluginUtilities/CommandLineArguments/CommandLineArguments.swift:31:50: error: consecutive declarations on a line must be separated by ';'
19:59:10     private var remainingOptionsOrFlags: [String].SubSequence
19:59:10                                                  ^
19:59:10                                                  ;
19:59:10 /code/.build/checkouts/swift-docc-plugin/Plugins/Swift-DocC Convert/Symbolic Links/SwiftDocCPluginUtilities/CommandLineArguments/CommandLineArguments.swift:31:50: error: expected declaration
19:59:10     private var remainingOptionsOrFlags: [String].SubSequence
19:59:10                                                  ^
19:59:10 /code/.build/checkouts/swift-docc-plugin/Plugins/Swift-DocC Convert/Symbolic Links/SwiftDocCPluginUtilities/CommandLineArguments/CommandLineArguments.swift:12:15: note: in declaration of 'CommandLineArguments'
19:59:10 public struct CommandLineArguments {
19:59:10               ^
19:59:10 /code/.build/checkouts/swift-docc-plugin/Plugins/Swift-DocC Convert/Symbolic Links/SwiftDocCPluginUtilities/CommandLineArguments/CommandLineArguments.swift:34:40: error: consecutive declarations on a line must be separated by ';'
19:59:10     private var literalValues: [String].SubSequence
19:59:10                                        ^
19:59:10                                        ;
19:59:10 /code/.build/checkouts/swift-docc-plugin/Plugins/Swift-DocC Convert/Symbolic Links/SwiftDocCPluginUtilities/CommandLineArguments/CommandLineArguments.swift:34:40: error: expected declaration
19:59:10     private var literalValues: [String].SubSequence
19:59:10                                        ^
19:59:10 /code/.build/checkouts/swift-docc-plugin/Plugins/Swift-DocC Convert/Symbolic Links/SwiftDocCPluginUtilities/CommandLineArguments/CommandLineArguments.swift:12:15: note: in declaration of 'CommandLineArguments'
19:59:10 public struct CommandLineArguments {
19:59:10               ^
19:59:10 error: fatalError

This is the error from Jenkins logs for Swift 5.8

19:59:21 [2/2] Compiling plugin Swift-DocC
19:59:21 error: fatalError

I'll force using the 1.3.0 version and report back

@sebsto
Copy link
Author

sebsto commented Aug 23, 2024

My bad, SPM was picking up the latest version (1.4.1) - I forced the exact 1.3.0 version and this solves the problem.
I updated the original description to mention plugin version 1.4.1

@d-ronnqvist d-ronnqvist transferred this issue from swiftlang/swift-docc Aug 24, 2024
clintonpi added a commit to clintonpi/swift-nio-http2 that referenced this issue Aug 27, 2024
Motivation:

Building swift-nio-http2 with Swift 5.8 fails due to a compiler error when building swift-docc-plugin (swiftlang/swift-docc-plugin#94).

Modifications:

- Adjust the dependency version of swift-docc-plugin from `from: "1.0.0"` to `"1.0.0"..<"1.4.0"`.

Result:

Building swift-nio-http2 with Swift 5.8 will now be successful.
gjcairo pushed a commit to apple/swift-nio-http2 that referenced this issue Aug 28, 2024
Motivation:

Building swift-nio-http2 with Swift 5.8 fails due to a compiler error
when building swift-docc-plugin
(swiftlang/swift-docc-plugin#94).

Modifications:

- Adjust the dependency version of swift-docc-plugin from `from:
"1.0.0"` to `"1.0.0"..<"1.4.0"`.

Result:

Building swift-nio-http2 with Swift 5.8 will now be successful.
Lukasa added a commit to Lukasa/swift-nio that referenced this issue Aug 28, 2024
Motivation:

Unfortunately, the DocC plugin no longer builds on 5.8:
swiftlang/swift-docc-plugin#94.
We need to keep building.

Modifications:

- Forcefully pin the DocC plugin down.

Result:

CI works now.
Lukasa added a commit to apple/swift-nio that referenced this issue Aug 28, 2024
Motivation:

Unfortunately, the DocC plugin no longer builds on 5.8:
swiftlang/swift-docc-plugin#94. We need to
keep building.

Modifications:

- Forcefully pin the DocC plugin down.

Result:

CI works now.
@Kyle-Ye
Copy link
Contributor

Kyle-Ye commented Aug 29, 2024

I'm on vacation next week, away from a computer, but I can look at this when I get back if no one else has fixed this by then.

I can help fix it. But I think besides it, we need to add some CI check for each PR.

Since the Package.swift is 5.6. We need to add a CI to check build success from 5.6 to 6.0 and main.

Background:
swift-docc has updated Package.swift to 5.9 recently
swift-markdown has updated Package.swift to 5.7 recently
swift-docc-symbolkit which this repo depends has not changed Package.swift yet and still support Swift 5.5+
Maybe we can consider updating Package.swift version to reduce the maintenance cost of CI job.

But sadly GitHub actions are disabled by default in org scope and we need to enable it for this repo or add the CI on ci.swift.org which I do not have permission to contribute.

See related issue and reply here

anferbui added a commit that referenced this issue Aug 29, 2024
swift-docc-plugin was not building with Swift 5.7 due to using newer syntax which did not exist yet.

Fixes the compilation issues to use older Swift syntax.
Fixes #94 and rdar://134859979.
@anferbui
Copy link
Contributor

Since the Package.swift is 5.6. We need to add a CI to check build success from 5.6 to 6.0 and main.

@Kyle-Ye Thank you for pinging that, I don't think we want to be supporting as far back as Swift 5.6 -- as part of my fix, I will update Package.swift to 5.7 :)

Also, +1 on having CI for all the versions we support, to ensure changes are compatible for all.

@thomasvl
Copy link

Will there be a release soon so projects that had to pin the docc version can unpin?

@anferbui
Copy link
Contributor

Just made a new release for swift-docc-plugin to get the fix out as soon as possible:
https://github.com/swiftlang/swift-docc-plugin/releases/tag/1.4.2

Pinned projects should now be able to unpin.

@thomasvl
Copy link

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants