Xcode 12 - Segmentation Fault 11 - SegFault

I am getting the following error which was NOT present on Xcode 11. I have trouble reproducing the issue since this is a large project and I can't pinpoint the file in which it happens. The error doesn't say which file it is.
  1. Apple Swift version 5.3 (swiftlang-1200.0.29.2 clang-1200.0.30.1)

  2. While reading from 'Swift'

0 swift          0x0000000107e1c865 llvm::sys::PrintStackTrace(llvm::rawostream&) + 37
1 swift          0x0000000107e1b865 llvm::sys::RunSignalHandlers() + 85
2 swift          0x0000000107e1ce1f SignalHandler(int) + 111
3 libsystem
platform.dylib 0x00007fff73ac35fd sigtramp + 29
4 libsystem
platform.dylib 0x00007ffe00000002 sigtramp + 18446744067473918498
5 swift          0x0000000107df11bc llvm::vfs::VFSFromYamlDirIterImpl::incrementImpl(bool) + 156
6 swift          0x0000000107df10fd llvm::vfs::VFSFromYamlDirIterImpl::VFSFromYamlDirIterImpl(llvm::Twine const&, std::
1::wrapiter<std::1::uniqueptr<llvm::vfs::RedirectingFileSystem::Entry, std::1::defaultdelete<llvm::vfs::RedirectingFileSystem::Entry> >>, std::1::wrapiter<std::1::uniqueptr<llvm::vfs::RedirectingFileSystem::Entry, std::1::defaultdelete<llvm::vfs::RedirectingFileSystem::Entry> >>, bool, llvm::vfs::FileSystem&, std::1::errorcode&) + 141
7 swift          0x0000000107dee3d8 llvm::vfs::RedirectingFileSystem::dirbegin(llvm::Twine const&, std::1::errorcode&) + 216
8 swift          0x0000000107a5c628 clang::HeaderSearch::loadSubdirectoryModuleMaps(clang::DirectoryLookup&) + 264
9 swift          0x0000000107a5c264 clang::HeaderSearch::lookupModule(llvm::StringRef, llvm::StringRef, bool) + 916
10 swift          0x0000000107a5be39 clang::HeaderSearch::lookupModule(llvm::StringRef, bool, bool) + 105
11 swift          0x0000000104958b77 swift::ClangImporter::Implementation::loadModuleClang(swift::SourceLoc, llvm::ArrayRef<swift::Located<swift::Identifier> >) + 103
12 swift          0x000000010495969b swift::ClangImporter::loadModule(swift::SourceLoc, llvm::ArrayRef<swift::Located<swift::Identifier> >) + 75
13 swift          0x00000001043fb766 swift::ModuleFile::getModule(llvm::ArrayRef<swift::Identifier>, bool) + 534
14 swift          0x000000010444bdeb swift::ModuleFile::associateWithFileContext(swift::FileUnit*, swift::SourceLoc, bool) + 1787
15 swift          0x00000001044b455d swift::SerializedModuleLoaderBase::loadAST(swift::ModuleDecl&, llvm::Optional<swift::SourceLoc>, llvm::StringRef, std::1::uniqueptr<llvm::MemoryBuffer, std::1::defaultdelete<llvm::MemoryBuffer> >, std::1::uniqueptr<llvm::MemoryBuffer, std::1::defaultdelete<llvm::MemoryBuffer> >, std::1::uniqueptr<llvm::MemoryBuffer, std::1::defaultdelete<llvm::MemoryBuffer> >, bool, bool) + 1037
16 swift          0x00000001044b6a59 swift::SerializedModuleLoaderBase::loadModule(swift::SourceLoc, llvm::ArrayRef<swift::Located<swift::Identifier> >) + 825
17 swift          0x0000000104acb2b6 swift::ASTContext::getStdlibModule(bool) + 406
18 swift          0x0000000103abe869 swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 3497
19 swift          0x000000010398032d swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6845
20 swift          0x0000000103904c37 main + 1255
21 libdyld.dylib      0x00007fff738cacc9 start + 1
22 libdyld.dylib      0x0000000000000084 start + 18446603338577564604
error: Segmentation fault: 11

Replies

Did you first try the usual option-clean build folder ?

Could it be a problem similar to this one
https ://github .com/xmartlabs/Eureka/issues/2057

where self in some extension or some code was confusing the compiler ?
See also detail
https ://github .com/xmartlabs/Eureka/pull/2061
Yes, I've cleaned multiple times. I've actually been "battling" this issue for a couple of days now and I did see this problem, but I hadn't seen the solution to it. I do have two places where a protocol is constrained with Self: Some Class, so I removed both of them to test, but that unfortunately didn't help. SegFault again. I see that a lot of people seem to be experiencing SegFault due to different kinds of issues, e.g. https://bugs.swift.org/browse/SR-13800?jql=ORDER%20BY%20created%20DESC%2C%20creator%20DESC

I'm not sure what to do at this point.

I removed both of them to test, but that unfortunately didn't help. 

Are you sure you have cleaned up your project at each time you touch the suspects?
In some cases, remains of an old code causes SegFault, even if you fixed it correctly.

I see that a lot of people seem to be experiencing SegFault due to different kinds of issues

True. So, it is hard to say how to fix just seeing the crash log.
You may need to pinpoint the file in which it happens, even if it is so hard.


As far as I see, the crash occurred when importing some module.
Does your project import some third party library? That may very often cause some issues when updating Xcode.