Issues with ninja build and lldb on M1 machine

Hi folks! After finally upgrading to an M1 machine I'm having some issues with the compiler build. After a seemingly successful ninja build (--release-debuginfo --debug-swift), I'm not really able to debug effectively because lldb can't properly load the debug information from the generated object files.

Specifically, trying to set breakpoints results in a deluge of errors:

(lldb) break set -n simplifyKeyPathConstraint
error: libswiftSema.a(BuilderTransform.cpp.o) failed to load objfile for /Users/freddy/Developer/git/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-arm64/lib/libswiftSema.a
error: libswiftSema.a(CSApply.cpp.o) failed to load objfile for /Users/freddy/Developer/git/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-arm64/lib/libswiftSema.a
error: libswiftSema.a(CSBindings.cpp.o) failed to load objfile for /Users/freddy/Developer/git/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-arm64/lib/libswiftSema.a
error: libswiftSema.a(CSClosure.cpp.o) failed to load objfile for /Users/freddy/Developer/git/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-arm64/lib/libswiftSema.a
error: libswiftSema.a(CSGen.cpp.o) failed to load objfile for /Users/freddy/Developer/git/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-arm64/lib/libswiftSema.a
error: libswiftSema.a(CSRanking.cpp.o) failed to load objfile for /Users/freddy/Developer/git/swift-project/build/Ninja-RelWithDebInfoAssert+swift-DebugAssert/swift-macosx-arm64/lib/libswiftSema.a

for, as far as I can tell, every object file in the library containing the named symbol. I've seen whispers of similar issues with M1 machines online but nothing conclusive, and nothing related to the Swift build specifically. Wondering if I somehow missed a setup step when building the compiler for this machine, or if there's any known issues with the build on M1 that other folks have encountered?

1 Like

Hey Frederick,
I'm also on M1 for sometime now, never seems any issues like that, but since trying new setup having some issues with debug info, but I don't think they are related to what you are seeing.
One question is how are you launching the swift-frontend executable from lldb? I'm using Xcode to launch ninja built executable and everything looks fine.
Also what is the full build script command that you are using? Maybe I can try similar setup and check.