tensorflow / swift

Swift for TensorFlow
https://tensorflow.org/swift
Apache License 2.0
6.13k stars 608 forks source link

Recent development snapshots cause Xcode runtime popup: "LLDB provided no error string" #532

Closed porterchild closed 4 years ago

porterchild commented 4 years ago

The build succeeds, but there is immediately an Xcode dialog popup: "Could not launch LLDB provided no error string". The center console at the top of Xcode immediately reads "Finished running ", with no program output in the console (not even the usual "Program ended with exit code: 0").

This has happened for a few small projects, and even happens with a small or empty program. I've tried with recent toolchains, including the August 26 snapshot, on Xcode 11.4.1, Xcode 12 beta 4, and Xcode 12 beta 6.

The v0.11 release doesn't cause this popup.

dan-zheng commented 4 years ago

Thanks for reporting. Could you please share a minimal project reproducing the issue?

I wasn't able to reproduce the issue with either a minimal Xcode project or a SwiftPM package using the tensorflow-DEVELOPMENT-2020-09-03-a macOS toolchain and Xcode 12 beta 4.

Running in Xcode succeeds without any error dialog:

demo

porterchild commented 4 years ago

I just did a bisect with your minimal Xcode project and found that the change is on the 8/05 toolchain. Before that, the popup doesn't happen. Starting on 8/05, the popup happens no matter the project. This is the same for Xcode 11.4, 12 beta 4 and 12 beta 6 on my machine. I was starting to think there was just something wrong with my Xcode installations, but I just had two colleagues try with the 9/03 toolchain and the popup happened there as well. All three computers are on MacOS 10.15.6. I hope the bisect date gives you some clue... Sorry I don't have any more context. Googling hasn't been helpful yet.

Screen Shot 2020-09-09 at 1 57 49 PM Screen Shot 2020-09-09 at 1 58 04 PM
porterchild commented 4 years ago

I get the same popup in Xcode 12.0

dan-zheng commented 4 years ago

Thanks for sharing all the context! Unfortunately, I still wasn't able to reproduce the issue (screen recording).

Environment:

I wonder what's different between our environments, it seems like we've tried the same permutations of macOS version + Xcode version + macOS toolchains. Is anyone else from the community able to reproduce the issue?

porterchild commented 4 years ago

As a temporary workaround, I found that the issue goes away if I uncheck Target-> Edit Scheme -> Run -> Info -> Debug executable. Of course, I don't have a debugger if I uncheck that box. So I can run, but can't use breakpoints or anything else the debugger provides.

porterchild commented 4 years ago

If I run Xcode from the command line with /Applications/Xcode.app/Contents/MacOS/Xcode, then each time I run and the popup happens, the console prints this:

  Reason: imagdyld: Library not loaded: @rpath/Python3.framework/Versions/3.8/Python3
  Referenced from: /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2020-09-16-a.xctoolchain/System/Library/PrivateFrameworks/LLDB.framework/Versions/A/LLDB
  Reason: image not found
 not loaded: @rpath/Python3.framework/Versions/3.8/Python3
  Referenced from: /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2020-09-16-a.xctoolchain/System/Library/PrivateFrameworks/LLDB.framework/Versions/A/LLDB

Based on the path in the console printout, otool -l <toolchain path>/System/Library/PrivateFrameworks/LLDB.framework/Versions/A/LLDB | grep -B 1 -A 10 RPATH gives

Load command 27
          cmd LC_RPATH
      cmdsize 80
         path /Applications/Xcode-beta.app/Contents/Developer/Library/Frameworks/ (offset 12)
Load command 28
--
Load command 28
          cmd LC_RPATH
      cmdsize 40
         path @loader_path/../../../ (offset 12)
porterchild commented 4 years ago

After adding a non-Xcode-beta.app rpath with sudo install_name_tool -add_rpath /Applications/Xcode.app/Contents/Developer/Library/Frameworks/ <toolchain path>/System/Library/PrivateFrameworks/LLDB.framework/Versions/A/LLDB

It works! I guess a normal Xcode.app path should be added by default? @dan-zheng

porterchild commented 4 years ago

@ematejska @texasmichelle this issue might be important to reference when making the new MacOS toolchains

VladimirBessonov commented 3 years ago

After adding a non-Xcode-beta.app rpath with sudo install_name_tool -add_rpath /Applications/Xcode.app/Contents/Developer/Library/Frameworks/ <toolchain path>/System/Library/PrivateFrameworks/LLDB.framework/Versions/A/LLDB

It works! I guess a normal Xcode.app path should be added by default? @dan-zheng

what is toolchain path in your answer?

andrekandore commented 3 years ago

After adding a non-Xcode-beta.app rpath with sudo install_name_tool -add_rpath /Applications/Xcode.app/Contents/Developer/Library/Frameworks/ <toolchain path>/System/Library/PrivateFrameworks/LLDB.framework/Versions/A/LLDB It works! I guess a normal Xcode.app path should be added by default? @dan-zheng

what is toolchain path in your answer?

i had installed the swift 5.5 toolchain and had the exact same issue, i fixed it like below: (please note, both xcode and toolchain are installed to my local user, not the normal global space)

install_name_tool -add_rpath ~/Applications/Xcode.app/Contents/Developer/Library/Frameworks ~/Library/Developer/Toolchains/swift-5.5-DEVELOPMENT-SNAPSHOT-2021-08-11-a.xctoolchain/System/Library/PrivateFrameworks/LLDB.framework/Versions/A/LLDB

as you can see ~/Library/Developer/Toolchains/swift-5.5-DEVELOPMENT-SNAPSHOT-2021-08-11-a.xctoolchain/ is the toolchain part

i think in normal installation scenario, that is in /Library instead of ~/Library

hope that helps 😅