Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-10845] Fatal Error Encountered While Reading from Module 'Foundation' #53235

Closed
swift-ci opened this issue Jun 6, 2019 · 5 comments
Closed
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Jun 6, 2019

Previous ID SR-10845
Radar None
Original Reporter calebkleveter (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Apple Swift version 5.1 (swiftlang-1100.0.38.29 clang-1100.0.20.14) [Shipped with Xcode 11.0 beta (11M336w)]

Target: x86_64-apple-darwin18.6.0

macOS Mojave 10.14.5 (18F132)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 3c2cf38a556c6baa457fe26d2668513c

is duplicated by:

  • SR-10935 Swift 5.1: fatal error encountered while reading from module 'Foundation'

Issue Description:

While trying to generate the LinuxMain file for a new package, I got a fatal error while while the Foundation module was being read:

<unknown>:0: error: fatal error encountered while reading from module 'Foundation'; please file a bug report with your project and the crash log<unknown>:0: error: fatal error encountered while reading from module 'Foundation'; please file a bug report with your project and the crash log
*** DESERIALIZATION FAILURE (please include this section in any bug report) ***top-level value not foundCross-reference to module 'Foundation'... NSOrderedCollectionChange
Stack dump:0. Program arguments: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/calebkleveter/Development/calebkleveter/TestCrash/Tests/TestCrashTests/TestCrashTests.swift /Users/calebkleveter/Development/calebkleveter/TestCrash/Tests/TestCrashTests/XCTestManifests.swift -emit-module-path /Users/calebkleveter/Development/calebkleveter/TestCrash/.build/x86_64-apple-macosx/debug/TestCrashTests.build/TestCrashTests~partial.swiftmodule -emit-module-doc-path /Users/calebkleveter/Development/calebkleveter/TestCrash/.build/x86_64-apple-macosx/debug/TestCrashTests.build/TestCrashTests~partial.swiftdoc -emit-dependencies-path /Users/calebkleveter/Development/calebkleveter/TestCrash/.build/x86_64-apple-macosx/debug/TestCrashTests.build/TestCrashTests.d -emit-reference-dependencies-path /Users/calebkleveter/Development/calebkleveter/TestCrash/.build/x86_64-apple-macosx/debug/TestCrashTests.build/TestCrashTests.swiftdeps -target x86_64-apple-macosx10.10 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I /Users/calebkleveter/Development/calebkleveter/TestCrash/.build/x86_64-apple-macosx/debug -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -enable-testing -g -module-cache-path /Users/calebkleveter/Development/calebkleveter/TestCrash/.build/x86_64-apple-macosx/debug/ModuleCache -swift-version 5 -Onone -D SWIFT_PACKAGE -D DEBUG -color-diagnostics -enable-anonymous-context-mangled-names -parse-as-library -module-name TestCrashTests -o /Users/calebkleveter/Development/calebkleveter/TestCrash/.build/x86_64-apple-macosx/debug/TestCrashTests.build/TestCrashTests.swift.o -index-store-path /Users/calebkleveter/Development/calebkleveter/TestCrash/.build/x86_64-apple-macosx/debug/index/store -index-system-modules1. While reading from 'Foundation'2. While finishing conformance for protocol conformance to '_ObjectiveCBridgeable' (in module 'Swift') for type 'CollectionDifference<ChangeElement>.Change'0  swift                    0x000000010e92e8a3 PrintStackTraceSignalHandler(void*) + 511  swift                    0x000000010e92e076 SignalHandler(int) + 3582  libsystem_platform.dylib 0x00007fff70c49b5d _sigtramp + 293  swift                    0x000000010f324000 (anonymous namespace)::DarwinX86AsmBackend::getCompactUnwindRegNum(unsigned int) const::CU32BitRegs + 1172904  libsystem_c.dylib        0x00007fff70b036a6 abort + 1275  swift                    0x000000010b197700 swift::ModuleFile::fatal(llvm::Error) + 18566  swift                    0x000000010b1b80fb swift::ModuleFile::finishNormalConformance(swift::NormalProtocolConformance*, unsigned long long) + 52117  swift                    0x000000010a96534a (anonymous namespace)::IndexSwiftASTWalker::startEntity(swift::Decl*, swift::index::IndexSymbol&, bool) + 7948  swift                    0x000000010a962c82 (anonymous namespace)::IndexSwiftASTWalker::walkToDeclPre(swift::Decl*, swift::CharSourceRange) + 51869  swift                    0x000000010a8fe9ae (anonymous namespace)::SemaAnnotator::walkToDeclPre(swift::Decl*) + 79810 swift                    0x000000010b4443ef (anonymous namespace)::Traversal::doIt(swift::Decl*) + 23911 swift                    0x000000010b4f0980 swift::FileUnit::walk(swift::ASTWalker&) + 17612 swift                    0x000000010a968360 (anonymous namespace)::IndexSwiftASTWalker::visitModule(swift::ModuleDecl&, llvm::StringRef) + 40013 swift                    0x000000010a96b83b swift::index::indexModule(swift::ModuleDecl*, llvm::StringRef, swift::index::IndexDataConsumer&) + 42714 swift                    0x000000010a96d01f addModuleDependencies(llvm::ArrayRef<std::__1::pair<llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*> >, llvm::StringRef, bool, llvm::StringRef, clang::CompilerInstance const&, swift::DiagnosticEngine&, clang::index::IndexUnitWriter&, (anonymous namespace)::StringScratchSpace&) + 292715 swift                    0x000000010a96bc2b recordSourceFileUnit(swift::SourceFile*, llvm::StringRef, llvm::StringRef, bool, bool, llvm::StringRef, llvm::ArrayRef<clang::FileEntry const*>, clang::CompilerInstance const&, swift::DiagnosticEngine&) + 90716 swift                    0x000000010a5aa10b emitIndexDataIfNeeded(swift::SourceFile*, swift::CompilerInvocation const&, swift::CompilerInstance&) + 79517 swift                    0x000000010a5a2e91 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 3723318 swift                    0x000000010a596424 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 686819 swift                    0x000000010a5256b3 main + 121920 libdyld.dylib            0x00007fff70a5e3d5 start + 1

This issue can be reproduced by creating a new executable SPM project:

mkdir TestCrash && cd TestCrash
swift package init --type executable

Then try to generate LinuxMain

swift test --generate-linuxmain

The command succeeds with the 5.1-DEVELOPMENT-SNAPSHOT-2019-05-09-a toolchain.

@belkadan
Copy link
Contributor

belkadan commented Jun 6, 2019

Hm, that sounds like you're using the Swift 5.1 compiler with the Xcode 10.2 SDKs. Is it possible you have SDKROOT set in your environment?

(This will become a normal error by the release of Swift 5.1.)

@swift-ci
Copy link
Collaborator Author

swift-ci commented Jun 6, 2019

Comment by Caleb Kleveter (JIRA)

Not that I am seeing. I know for sure that I personally never set an SDKROOT.

@swift-ci
Copy link
Collaborator Author

swift-ci commented Jun 6, 2019

Comment by Caleb Kleveter (JIRA)

@belkadan You mentioned Xcode 10.2. That reminded me that I had never switch my default Xcode version. I just had to run xcode-select. It works now.

@belkadan
Copy link
Contributor

belkadan commented Jun 6, 2019

Oh, right, of course. If swiftc doesn't have an explicit SDK, it asks xcrun for one. That makes sense.

I'll keep this to track the error message about the wrong SDK, and maybe mentioning if it was inferred.

@belkadan
Copy link
Contributor

Fixed in master and the 5.1 branch, will make its way to an Xcode eventually.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

2 participants