LLDB Broken in Nightly Toolchains

LLDB seems to be broken in the nightly toolchains. LLDB.framework is not included in the toolchains anymore for some reason, resulting in the following linking error when trying to run the toolchain-provided lldb:

dyld: Library not loaded: @rpath/LLDB.framework/Versions/A/LLDB
  Referenced from: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-08-05-a.xctoolchain/usr/bin/lldb
  Reason: image not found
[1]    54252 abort

Is there a simple fix to this?


cc @dcci @Adrian_Prantl (dunno if you're the right people to ask)

I replicated the error with the macOS DEVELOPMENT-SNAPSHOT-2019-08-05-a toolchain.

$ lldb
dyld: Library not loaded: @rpath/LLDB.framework/Versions/A/LLDB
  Referenced from: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-08-05-a.xctoolchain/usr/bin/lldb
  Reason: image not found
[1]    25417 abort      lldb

A broken LLDB/Swift REPL seems like a serious problem that should be tested. :open_mouth:

1 Like

I looked at this today and I understand what's wrong. I wasn't really familiar with this whole machinery, so it was fun learning about it :)
During the migration from Xcode to CMake the install target has been implemented using "cache" files https://github.com/apple/swift/pull/25931

The cache file for macOS hardcodes the LLDB.framework install path to be

	# Choose the install location for LLDB.framework so that it matches the
	# INSTALL_RPATH of the lldb driver. It's either absolute or relative to
	# CMAKE_INSTALL_PREFIX. In any case, DESTDIR will be an extra prefix.
	set(LLDB_FRAMEWORK_INSTALL_DIR /Applications/Xcode.app/Contents/SharedFrameworks CACHE STRING "")

Which is obviously wrong in the case of a nightly toolchain. It should be something like ${CMAKE_INSTALL_PREFIX}../System/Library/PrivateFrameworks
So, LLDB.framework is not copied in the right place, which makes debugging not functional :)

I have a WIP patch, I need to do some additional testing to make sure this doesn't break internal use-cases (e.g. Xcode) & Linux. I'll try to have the patch merged tomorrow so the next toolchain should hopefully have a workin REPL [and lldb].

I'll also try to add an integration test.

1 Like

Folks interested can find updates here:

1 Like

Thanks a lot @dcci for figuring this out quickly! I was quite confused by what was happening in the CMake files with respect to LLDB. :)

I merged the PR, and I'll work on the integration test next. Wait for the next toolchain which should contain the fix. If you still run into issues, let me know.

1 Like
Terms of Service

Privacy Policy

Cookie Policy