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

[SR-11900] 'swift help' doesn't work #1249

Closed
beccadax opened this issue Dec 5, 2019 · 8 comments
Closed

[SR-11900] 'swift help' doesn't work #1249

beccadax opened this issue Dec 5, 2019 · 8 comments

Comments

@beccadax
Copy link
Contributor

beccadax commented Dec 5, 2019

Previous ID SR-11900
Radar rdar://problem/56924692
Original Reporter @beccadax
Type New Feature
Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels New Feature, Driver, StarterBug
Assignee JhonnyBillM (JIRA)
Priority Medium

md5: 1ee0e9c459854e8821d1936d514204b9

Issue Description:

To implement command-line features like "swift build", the Swift driver treats swift <some name> as though you had written swift-<some name>. However, it does not respond sensibly to swift help package/build/test/etc. It would be better if it treated swift help <some name> as though you had written swift <some name> --help, and swift help <other args> as though you had written swift --help <other args>. (Pretty much all Swift executables handle --help; a few don't seem to handle -help.)

This can be implemented in swift-driver's swift-help executable, which is run if the user types "swift help <args>". The implementation of the tool can be found in the swift-driver repository: https://github.com/apple/swift-driver

@swift-ci
Copy link
Contributor

Comment by Jhonny Bill Mena (JIRA)

Hi, I have been trying to tackle this, but I have problems building the project.

I followed the instructions in the [getting started guide|https://github.com/apple/swift#getting-started] but:

  1. When running utils/build-script —xcode —release-debuginfo

It fails with:

 ** BUILD FAILED **
 
The following build commands failed: CompileC
../swift-source/build/Xcode-RelWithDebInfoAssert/swift-macosx-x86_64/lib/Sema/Swift.build/RelWithDebInfo/swiftSema.build/Objects-normal/x86_64/TypeCheckAttr.o lib/Sema/TypeCheckAttr.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
utils/build-script: fatal error: command terminated with a non-zero exit status 65, aborting
  2. When trying with Ninja using `utils/build-script —release-debuginfo` 

But this time it throws the following error:

../swift-source/swift/lib/Sema/TypeCheckAttr.cpp:3558:5: error: non-void function 'typeCheckDerivativeAttr' should return a value [-Wreturn-type]
    return;
    ^
1 error generated.
[584/1771][ 32%][395.978s] Building CXX object lib/Sema/CMakeFiles/swiftSema.dir/TypeCheckDecl.cpp.o
ninja: build stopped: subcommand failed.
utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting

Environment:

  • Apple Swift 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15). Target: x86_64-apple-darwin19.2.0

  • macOS Catalina 10.15.2

  • cmake 3.16.1

  • Ninja 1.9.0

  • Python 2.7.16

Thanks in advance!

@beccadax
Copy link
Contributor Author

JhonnyBillM (JIRA User) Thanks for taking a look at this bug!

The TypeCheckAttr.cpp error was fixed in PR #28897. If you run a "git pull" in your "swift" folder, you should get the fix for it as long as you're on master. (Pulling only the "swift" folder will keep you from having to rebuild LLVM and clang; if you used "utils/update-checkout", you'd probably have to start the build from scratch.)

The Xcode build also stopped while trying to build TypeCheckAttr.cpp, so I'm guessing it hit the same issue and the diagnostic was just buried earlier in the log.

If you need any more help you can keep posting here, or you can message me on Swift Forums or Twitter. My username in both places is "brentdax".

@swift-ci
Copy link
Contributor

Comment by Jhonny Bill Mena (JIRA)

Worked! Thank you brentdax (JIRA User) .

By the way, what do you think fits better for this case, adding a new swift-help executable (I do not know how to do it, but I can figure it out), or adding this as an "extra case" in the Swift Driver subcommand handling?

@swift-ci
Copy link
Contributor

Comment by Matei Oprea (JIRA)

brentdax (JIRA User) is this still open? I might have an implementation for it, but after compiling Swift, it didn't output "swift-build" or "swift-run" executables in swift-macosx-x86_64/bin/*. Any recommendations on how to take it from here?

@beccadax
Copy link
Contributor Author

beccadax commented Aug 2, 2020

owenvoorhees (JIRA User) I see that you added a swift-help tool to the new driver. Should this bug be closed?

@swift-ci
Copy link
Contributor

swift-ci commented Aug 2, 2020

Comment by Owen Voorhees (JIRA)

brentdax (JIRA User) Right now swift-driver's `swift-help` has pretty limited functionality and only works for driver options (so for example "swift help package" doesn't work). I think we can probably repurpose this issue to track at least handling subcommands properly, since that's an important use case.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@valeriyvan
Copy link
Contributor

Comment by Owen Voorhees (JIRA)

brentdax (JIRA User) Right now swift-driver's swift-help has pretty limited functionality and only works for driver options (so for example "swift help package" doesn't work). I think we can probably repurpose this issue to track at least handling subcommands properly, since that's an important use case.

swift help package working as expected now. Probably, this issue might be closed as implemented.

@AnthonyLatsis
Copy link

I think we should let the driver folks decide whether this is resolved.

@artemcm Could you transfer this issue to the swift-driver repo?

@artemcm artemcm transferred this issue from swiftlang/swift Jan 9, 2023
@artemcm artemcm closed this as completed Jan 9, 2023
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

5 participants