Skip to content

Driver: do not create a dSYM bundle for static archives #669

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

Merged
merged 2 commits into from
May 20, 2021

Conversation

compnerd
Copy link
Member

Creation of a dSYM bundle for a static library is not supported. Do not
create a job to create a dSYM bundle for a static library.

@compnerd
Copy link
Member Author

@swift-ci please test

Copy link
Contributor

@artemcm artemcm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change LGTM.

@artemcm
Copy link
Contributor

artemcm commented May 20, 2021

SwiftDriver/Jobs/Planning.swift:478:5: error: switch must be exhaustive
swift-driver/Sources/SwiftDriver/Jobs/Planning.swift:478:5: note: add missing case: '.none'

I'm really confused by this error, this is the enum type:
https://github.com/apple/swift-driver/blob/main/Sources/SwiftDriver/Driver/LinkKind.swift#L14

@cltnschlosser
Copy link
Contributor

cltnschlosser commented May 20, 2021

SwiftDriver/Jobs/Planning.swift:478:5: error: switch must be exhaustive
swift-driver/Sources/SwiftDriver/Jobs/Planning.swift:478:5: note: add missing case: '.none'

I'm really confused by this error, this is the enum type:

https://github.com/apple/swift-driver/blob/main/Sources/SwiftDriver/Driver/LinkKind.swift#L14

linkerOutputType is optional, so .none is nil in this case.
some version of swift from the last couple years allows you to do this:

enum MyEnum {
  case A
  case B
}
let optionalEnum: MyEnum?
switch optionalEnum {
  case .A:
  case .B:
  case .none:
}

where before you needed

switch optionalEnum {
  case .some(.A):
  case .some(.B):
  case .none:
}

Edit: to combat confusion, I think there is actually a warning if you add .none to an enum. Or maybe it's if you don't reference it directly optionalEnum: OtherEnum? = .none warns, but optionalEnum: OtherEnum? = Optional.none and optionalEnum: OtherEnum? = OtherEnum.none doesn't
where OtherEnum has a case none

@artemcm
Copy link
Contributor

artemcm commented May 20, 2021

linkerOutputType is optional, so .none is nil in this case.

Ah, didn't notice the optional. Thanks, @cltnschlosser!

@compnerd
Copy link
Member Author

@swift-ci please test

@gottesmm
Copy link
Contributor

@swift-ci test

@gottesmm
Copy link
Contributor

gottesmm commented May 20, 2021

compnerd and I looked at the error and the correct answer is indeed 3. You can see this since in the old driver this is how we used to emit it in terms of jobs:

-> ./build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/bin/swift-frontend -frontend -c -primary-file library.swift -emit-module-path /var/folders/k1/xd7p9h7j3tjbw5pfp95644kr0000gn/T/TemporaryDirectory.UiJSaT/library-1.swiftmodule -emit-module-doc-path /var/folders/k1/xd7p9h7j3tjbw5pfp95644kr0000gn/T/TemporaryDirectory.UiJSaT/library-1.swiftdoc -emit-module-source-info-path /var/folders/k1/xd7p9h7j3tjbw5pfp95644kr0000gn/T/TemporaryDirectory.UiJSaT/library-1.swiftsourceinfo -target x86_64-apple-macosx10.15 -enable-objc-interop -color-diagnostics -g -static -new-driver-path ./build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/bin/swift-driver -resource-dir ./build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/lib/swift -enable-anonymous-context-mangled-names -module-name rary -parse-as-library -o /var/folders/k1/xd7p9h7j3tjbw5pfp95644kr0000gn/T/TemporaryDirectory.UiJSaT/library-1.o
-> ./build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/bin/swift-frontend -frontend -merge-modules -emit-module /var/folders/k1/xd7p9h7j3tjbw5pfp95644kr0000gn/T/TemporaryDirectory.UiJSaT/library-1.swiftmodule -parse-as-library -disable-diagnostic-passes -disable-sil-perf-optzns -target x86_64-apple-macosx10.15 -enable-objc-interop -color-diagnostics -g -static -new-driver-path ./build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/bin/swift-driver -resource-dir ./build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/lib/swift -enable-anonymous-context-mangled-names -module-name rary -emit-module-doc-path /var/folders/k1/xd7p9h7j3tjbw5pfp95644kr0000gn/T/TemporaryDirectory.UiJSaT/rary-1.swiftdoc -emit-module-source-info-path /var/folders/k1/xd7p9h7j3tjbw5pfp95644kr0000gn/T/TemporaryDirectory.UiJSaT/rary-1.swiftsourceinfo -o /var/folders/k1/xd7p9h7j3tjbw5pfp95644kr0000gn/T/TemporaryDirectory.UiJSaT/rary-1.swiftmodule
-> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static /var/folders/k1/xd7p9h7j3tjbw5pfp95644kr0000gn/T/TemporaryDirectory.UiJSaT/library-1.o -o library.a
-> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil library.a -o library.a.dSYM

@gottesmm
Copy link
Contributor

@swift-ci test

@gottesmm
Copy link
Contributor

This is the swift-driver version of swiftlang/swift#37526

@gottesmm
Copy link
Contributor

@artemcm what do you think about the Linux failure here? It doesn't find lib tool.

Creation of a dSYM bundle for a static library is not supported.  Do not
create a job to create a dSYM bundle for a static library.
@compnerd
Copy link
Member Author

@swift-ci please test

// As per Unix conventions, /var/empty is expected to exist and be empty.
// This gives us a non-existent path that we can use for libtool which
// allows us to run this this on non-Darwin platforms.
env["SWIFT_DRIVER_LIBTOOL_EXEC"] = "/var/empty/libtool"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I expected this to work.

@compnerd
Copy link
Member Author

@swift-ci please test

@gottesmm gottesmm merged commit 9f8f6c6 into swiftlang:main May 20, 2021
@compnerd compnerd deleted the static-dsym branch May 20, 2021 20:51
@gottesmm
Copy link
Contributor

I am going to cherry-pick this to 5.5.

@compnerd
Copy link
Member Author

@gottesmm ugh, I forgot to do that, thank you so much for staying on top of that!

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

Successfully merging this pull request may close these issues.

4 participants