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-1202] Use instructions on Swift.org Do Not Work for Debug-enabled Toolchain #43810

Open
swift-ci opened this issue Apr 10, 2016 · 8 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-1202
Radar None
Original Reporter hitstergtd (JIRA User)
Type Bug

Attachment: Download

Environment

Swift: Trunk Development (master)
OS X El Capitan
Darwin 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64

Additional Detail from JIRA
Votes 1
Component/s Project Infrastructure
Labels Bug
Assignee None
Priority Medium

md5: 80a37bffd10e910ba9d3ed6d2da0ed6d

cloned from:

  • SR-411 Cannot run xcode with toolchain after switching between debug & release versions

relates to:

  • SR-1074 Error displayed when using Swift -v
  • SR-1156 lldb-mi does not work
  • SR-975 SwiftPM seems broken in the latest snapshot
  • SR-976 Executable built by generated xcodeproj doesn't run

Issue Description:

Presently it is not possible to use the latest Debug-enabled toolchain with command-line tools as per the instructions at Swift.org/downloads.

3. Selecting a Swift toolchain affects the Xcode IDE only. To use the Swift toolchain with command-line tools, use xcrun --toolchain swift and xcodebuild TOOLCHAINS=swift, or ...


Reproducing the Problem:

  1. First error that happens:

    $ xcrun --toolchain swift swift -v
    Apple Swift version 3.0-dev (LLVM b010debd0e, Clang 3e4d01d89b, Swift 7182c58cb2)
    Target: x86_64-apple-macosx10.9
    /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a.xctoolchain/usr/bin/lldb "--repl=-target x86_64-apple-macosx10.9 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -color-diagnostics"
    dyld: Library not loaded: @rpath/LLDB.framework/LLDB
      Referenced from: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a.xctoolchain/usr/bin/lldb
      Reason: image not found
    Trace/BPT trap: 5
    
  2. After applying my workaround the following happens:

    $ xcrun --toolchain swift swift 
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ImportError: No module named lldb.embedded_interpreter
    ...
    warning: (x86_64) /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a.xctoolchain/System/Library/PrivateFrameworks/LLDB.framework/Resources/repl_swift empty dSYM file detected, dSYM was created with an executable with no debug info.
    

More information:

  1. The package downloaded was XCode (Debugging Symbols) as of Mar 24, 2016.

Why is it Happening?:

  1. After some investigation earlier on, it seems this is happening because the Debug build of swift-latest is missing key files, but not been able to track down the commit as of yet.

  2. Key files and symlinks that are present for LLDB in the Release build are not available in the Debug build called "Debugging Symbols", which affects the @rpath for dyld(1)

  3. Required Files and Symlinks that are not present in the Swift Debug Build but should be:

    lrwxr-xr-x   1 root     wheel          24 Mar 24 17:44 ./System/Library/PrivateFrameworks/LLDB.framework/Headers -> Versions/Current/Headers
    lrwxr-xr-x   1 root     wheel          21 Mar 24 17:44 ./System/Library/PrivateFrameworks/LLDB.framework/LLDB -> Versions/Current/LLDB
    lrwxr-xr-x   1 root     wheel          26 Mar 24 17:44 ./System/Library/PrivateFrameworks/LLDB.framework/Resources -> Versions/Current/Resources
    ...
    lrwxr-xr-x   1 root     wheel           1 Mar 24 17:44 ./System/Library/PrivateFrameworks/LLDB.framework/Versions/Current -> A
    -rw-r--r--   1 root     wheel        3983 Mar 24 17:45 ./System/Library/PrivateFrameworks/LLDB.framework/Versions/A/Resources/Python/lldb/embedded_interpreter.py
    ...
    
  4. Most of the Python/lldb module files are also missing in the Debug build

  5. There may be other files missing as well; please see attached diff for breakdown of files missing in Debug the build

Summary:

  1. If the Debugging Symbols package is meant to be installed AFTER the normal Release package, then this should be made very clear in the Swift.org instructions

  2. Although, I can't see why we the Debugging Symbols package should not be self-sufficient download/package

@swift-ci
Copy link
Collaborator Author

Comment by Hitster GTD (JIRA)

Workaround offered within SR-1074 is not appropriate when using toolchains from Swift.org, since @rpath refers to CommandLineTools.

@swift-ci
Copy link
Collaborator Author

Comment by Hitster GTD (JIRA)

+ @belkadan

@belkadan
Copy link
Contributor

@gribozavr, Hitster's suspicion that the debugging symbols go on top of the release toolchain is correct, yes?

@gribozavr
Copy link
Collaborator

Yes, debug symbols are an overlay package.

+ @shahmishal

@gribozavr
Copy link
Collaborator

hitstergtd (JIRA User) Note that the debug symbols are for debugging the toolchain itself. Just to confirm, is this what you are trying to do?

@swift-ci
Copy link
Collaborator Author

Comment by Hitster GTD (JIRA)

@belkadan,
Thanks, yes that exactly was my suspicion before I even downloaded the package, but that is not how the Swift.org/downloads section reads at the moment. Judging by the # of other bug reports on the same topic I thought I would test out said suspicion. 🙂

@gribozavr,
Thanks for confirming Dmitri. To confirm my intent, I am just attempting to get involved in the Swift community and I was also attempting to debug the Toolchain.
As part of that, I reviewed the instructions at Swift.org/downloads and there is no mention that Debugging Symbols is an addon package.

There are two ways to fix this:

  1. Add something like the following to the instructions at Swift.org/downloads:

    Please note: The Debugging Symbols package is an overlay and not required unless debugging the Swift toolchain itself.

  2. Make the Debugging Symbols package self-standing so that folks don't have to mess about with multiple packages; I don't see why this can't be possible.

If the Swift website was on GitHub, I would just send a pull request. Now there is an idea. 🙂

@gribozavr
Copy link
Collaborator

CC amartini (JIRA User) and @natecook1000 for suggested website changes.

@swift-ci
Copy link
Collaborator Author

Comment by Hitster GTD (JIRA)

@gribozavr / @belkadan,

Thanks! Maybe we can close the two open SRs related to this as well, now that they are linked to this issue?

@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
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
Development

No branches or pull requests

3 participants