Navigation Menu

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-7704] swiftc -emit-module -c, driver documentation and diagnostics #50244

Open
atrick opened this issue May 16, 2018 · 1 comment
Open

[SR-7704] swiftc -emit-module -c, driver documentation and diagnostics #50244

atrick opened this issue May 16, 2018 · 1 comment
Labels
compiler The Swift compiler in itself improvement legacy driver Area → compiler: the integrated C++ legacy driver. Succeeded by the swift-driver project

Comments

@atrick
Copy link
Member

atrick commented May 16, 2018

Previous ID SR-7704
Radar rdar://problem/40296524
Original Reporter @atrick
Type Improvement
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Improvement, Driver
Assignee None
Priority Medium

md5: 30fc405eb81f191e2424636662e06943

relates to:

  • SR-327 Add --outdir argument to swiftc
  • SR-10116 Driver does not handle single-file -c -o correctly when doing multiple frontend invocations

Issue Description:

Here is the likely story of someone trying to use the swiftc driver for the first time. Maybe they need to troubleshooot their build or provide a reduced test case.

`swiftc -help` lists a set of options. It doesn't explain which modes are supported by the driver: building an exe, building a dylib, building a swiftmodule, building a set of .o files, or whatever.

Since that isn't helpful, the next step is to look at the Swift package manager's output when they build their project. `swift build` output shows them something like:

swiftc -emit-module -c fileA.swift fileB.swift -module-name ModuleName -parse-as-library -whole-module-optimization -O <some obscure references to package manager artifacts>

followed by

swiftc -target x86_64-apple-macosx10.10 -sdk ... fileA.o fileB.o -o ExecutableName

That obviously implies that running swiftc on a set of swift files with "-emit-module -c" will produce a bunch of object files. So they try this:

swiftc -emit-module -c fileA.swift fileB.swift -module-name ReducedModuleName

The command runs with no diagnostics whatsoever, but fails to produce
any .o files, which is utterly baffling and gives no hint as to what to try next.

We obviously need to explain how to use the driver in `swiftc -help` or directly link to a documentation section.

We also need to print some diagnostics when someone tries to use the driver the same way that swiftpm does, explaining, in brief, how to correctly form a command line for what they are obviously trying to do.

I'm leaving it to @belkadan to make more specific suggestions and possibly split this up.

@atrick
Copy link
Member Author

atrick commented May 16, 2018

@swift-ci create

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself improvement legacy driver Area → compiler: the integrated C++ legacy driver. Succeeded by the swift-driver project
Projects
None yet
Development

No branches or pull requests

1 participant