I'm running LLDB from Xcode in a project with SPM dependencies. The app runs fine, but when trying to debug no variable watches are displayed and issuing commands just output errors like:
error: warning: Failed to load linked library swiftSwiftOnoneSupport of module SwiftOnoneSupport - errors:
Failed to find "libswiftSwiftOnoneSupport.dylib" in paths:
, /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator
/usr/lib/swift
Failed to find "libswiftSwiftOnoneSupport.dylib" on RPATH, error: dlopen failed for unknown reasons.
error: <EXPR>:3:1: error: cannot find 'x' in scope
x
^
I've found instructions on this forum to enable logs and I've found more errors below:
SwiftASTContext("MyAppWithPackages")::CreateInstance(Module)
SwiftASTContext("MyAppWithPackages")::SetTriple("x86_64-apple-ios14.5.0-simulator") setting to "x86_64-apple-ios14.5.0-simulator"
SwiftASTContext("MyAppWithPackages")::SetTriple("x86_64-apple-ios14.5.0-simulator") setting to "x86_64-apple-ios14.5.0-simulator"
SwiftASTContext("MyAppWithPackages")::DeserializeAllCompilerFlags() -- Found 9 AST file data entries.
SwiftASTContext("MyAppWithPackages")::DeserializeAllCompilerFlags() -- SDK path from module "MyAppWithPackages" was "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk".
SwiftASTContext("MyAppWithPackages")::DeserializeAllCompilerFlags() -- SDK path from module "RxCoreData" was "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk".
SwiftASTContext("MyAppWithPackages")::DeserializeAllCompilerFlags() -- SDK path from module "RxSwift" was "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk".
SwiftASTContext("MyAppWithPackages")::DeserializeAllCompilerFlags() -- SDK path from module "RxCocoa" was "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk".
SwiftASTContext("MyAppWithPackages")::DeserializeAllCompilerFlags() -- SDK path from module "RxRelay" was "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk".
SwiftASTContext("MyAppWithPackages")::DeserializeAllCompilerFlags() -- SDK path from module "RxCoreData" was "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk".
SwiftASTContext("MyAppWithPackages")::DeserializeAllCompilerFlags() -- SDK path from module "RxSwift" was "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk".
SwiftASTContext("MyAppWithPackages")::DeserializeAllCompilerFlags() -- SDK path from module "RxCocoa" was "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk".
SwiftASTContext("MyAppWithPackages")::DeserializeAllCompilerFlags() -- SDK path from module "RxRelay" was "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk".
SwiftASTContext("MyAppWithPackages")::DeserializeAllCompilerFlags() -- Picking SDK path "".
SwiftASTContext("MyAppWithPackages")::CreateInstance() -- Found serialized triple x86_64-apple-ios8.0-simulator.
SwiftASTContext("MyAppWithPackages")::SetTriple("x86_64-apple-ios8.0-simulator") setting to "x86_64-apple-ios8.0-simulator"
SwiftASTContext("MyAppWithPackages")::CreateInstance() -- No serialized SDK path.
SwiftASTContext("MyAppWithPackages")::CreateInstance() -- Host SDK path is /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk.
SwiftASTContext::GetResourceDir() -- trying toolchain path:
SwiftASTContext::GetResourceDir() -- trying Xcode path: /Applications/Xcode.app/Contents
SwiftASTContext::GetResourceDir() -- trying Xcode-based lib path: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift
SwiftASTContext::GetResourceDir() -- found Swift resource dir via Xcode contents path + default toolchain relative dir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift
SwiftASTContext("MyAppWithPackages")::GetASTContext() -- Using Clang module cache path: /Users/brunno/Library/Developer/Xcode/DerivedData/ModuleCache.noindex
SwiftASTContext("MyAppWithPackages")::GetASTContext() -- SDK version: 14.5
SwiftASTContext("MyAppWithPackages")::GetASTContext() -- Using prebuilt Swift module cache path: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/prebuilt-modules/14.5
SwiftASTContext("MyAppWithPackages")::RegisterSectionModules("MyAppWithPackages") retrieved 9 AST Data blobs from the symbol vendor.
SwiftASTContext("MyAppWithPackages")::RegisterSectionModules() -- parsed module "MyAppWithPackages" from Swift AST section 1 of 9.
SwiftASTContext("MyAppWithPackages")::RegisterSectionModules() -- parsed module "RxCoreData" from Swift AST section 2 of 9.
SwiftASTContext("MyAppWithPackages")::RegisterSectionModules() -- parsed module "RxSwift" from Swift AST section 3 of 9.
SwiftASTContext("MyAppWithPackages")::RegisterSectionModules() -- parsed module "RxCocoa" from Swift AST section 4 of 9.
SwiftASTContext("MyAppWithPackages")::RegisterSectionModules() -- parsed module "RxRelay" from Swift AST section 5 of 9.
SwiftASTContext("MyAppWithPackages")::RegisterSectionModules() -- parsed module "RxCoreData" from Swift AST section 6 of 9.
SwiftASTContext("MyAppWithPackages")::RegisterSectionModules() -- parsed module "RxSwift" from Swift AST section 7 of 9.
SwiftASTContext("MyAppWithPackages")::RegisterSectionModules() -- parsed module "RxCocoa" from Swift AST section 8 of 9.
SwiftASTContext("MyAppWithPackages")::RegisterSectionModules() -- parsed module "RxRelay" from Swift AST section 9 of 9.
SwiftASTContext("MyAppWithPackages")::GetModule("MyAppWithPackages")
SwiftASTContext("MyAppWithPackages")::GetModule("MyAppWithPackages") -- <module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/Apptimize.h"
^
error: /Users/brunno/Library/Developer/Xcode/DerivedData/MyAppWithPackages-dkydaoxeegtwiccrxjvetzwpndty/Build/Products/Debug-iphonesimulator/Apptimize.framework/Headers/Apptimize.h:16:2: error: "The Apptimize library uses features only available in iOS SDK 11.0 and later."
#error "The Apptimize library uses features only available in iOS SDK 11.0 and later."
^
error: could not build Objective-C module 'Apptimize'
SwiftASTContext("MyAppWithPackages")::CreateInstance((Module*)0x7fc4cad18f28, "MyAppWithPackages") = 0x7fc4cc030ca0
SwiftASTContext("MyAppWithPackages")::() -- Failed to create module context - <module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/Apptimize.h"
^
error: /Users/brunno/Library/Developer/Xcode/DerivedData/MyAppWithPackages-dkydaoxeegtwiccrxjvetzwpndty/Build/Products/Debug-iphonesimulator/Apptimize.framework/Headers/Apptimize.h:16:2: error: "The Apptimize library uses features only available in iOS SDK 11.0 and later."
#error "The Apptimize library uses features only available in iOS SDK 11.0 and later."
^
error: could not build Objective-C module 'Apptimize'
To me it seems the error arises from the fact that it chose "x86_64-apple-ios8.0-simulator"
for the environment when it doesn't satisfy the minimum support version for all packages.
Is this caused by an error in the packages specification? Or a bug?
How is the serialized triple chosen?
I could reproduce it with just a pair of dependencies in a simple project -> GitHub - brunnobga/swift-lldb-error-repro