swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.51k stars 10.35k forks source link

The latest Xcode fails to compile due to "Command SwiftCompile failed with a nonzero exit code" #61814

Open Simon-To opened 1 year ago

Simon-To commented 1 year ago

Describe the bug The latest Xcode fails to compile our project despite it being able to be built on earlier version (more specifically on OS 12.6, Xcode 13.4 (13F17a).

Steps To Reproduce Steps to reproduce the behavior:

  1. Simply press Command+B to build the project
  2. Build will fail with the following error message:
  3. Apple Swift version 5.7 (swiftlang-5.7.0.127.4 clang-1400.0.29.50)
  4. Compiling with the current language version
  5. While evaluating request IRGenRequest(IR Generation for file "/Users/simonto/Library/Mobile Documents/com~apple~CloudDocs/USC Undergraduate/SwapSpot/SwapU/ViewModels/ItemVMs/ItemGridViewModel.swift")
  6. While emitting IR SIL function "@$sytIegHr_yts5Error_pIegHrzo_TR". for <<debugloc at "":0:0>>Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var LLVM_SYMBOLIZER_PATH to point to it): 0 swift-frontend 0x000000010a2ce7f7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39 1 swift-frontend 0x000000010a2cd828 llvm::sys::RunSignalHandlers() + 248 2 swift-frontend 0x000000010a2cee10 SignalHandler(int) + 288 3 libsystem_platform.dylib 0x00007ff80a3f7c1d _sigtramp + 29 4 libsystem_platform.dylib 0x00007ff7bb1e79c0 _sigtramp + 18446744072381988288 5 libsystem_c.dylib 0x00007ff80a316ca5 abort + 123 6 swift-frontend 0x0000000104e96408 swift::performFrontend(llvm::ArrayRef<char const>, char const, void, swift::FrontendObserver)::$_3::invoke(void, char const, bool) + 728 7 swift-frontend 0x000000010a21536d llvm::report_fatal_error(llvm::Twine const&, bool) + 397 8 swift-frontend 0x000000010a26fdd2 report_size_overflow(unsigned long, unsigned long) + 210 9 swift-frontend 0x000000010a26fc01 llvm::SmallVectorBase::grow_pod(void, unsigned long, unsigned long) + 225 10 swift-frontend 0x000000010515ae51 (anonymous namespace)::AsyncCallEmission::setArgs(swift::irgen::Explosion&, bool, swift::irgen::WitnessMetadata) + 641 11 swift-frontend 0x0000000105333239 (anonymous namespace)::IRGenSILFunction::visitFullApplySite(swift::FullApplySite) + 4553 12 swift-frontend 0x000000010530d0e2 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction) + 10706 13 swift-frontend 0x00000001051b5907 swift::irgen::IRGenerator::emitLazyDefinitions() + 1415 14 swift-frontend 0x00000001052d99b1 swift::IRGenRequest::evaluate(swift::Evaluator&, swift::IRGenDescriptor) const + 10545 15 swift-frontend 0x000000010530a3ec swift::SimpleRequest<swift::IRGenRequest, swift::GeneratedModule (swift::IRGenDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::IRGenRequest const&, swift::Evaluator&) + 204 16 swift-frontend 0x00000001052e4740 llvm::Expected swift::Evaluator::getResultUncached(swift::IRGenRequest const&) + 832 17 swift-frontend 0x00000001052ddfcc swift::performIRGeneration(swift::FileUnit, swift::IRGenOptions const&, swift::TBDGenOptions const&, std::__1::unique_ptr<swift::SILModule, std::1::default_delete >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::StringRef, llvm::GlobalVariable*) + 348 18 swift-frontend 0x0000000104e8bc5b performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete >, llvm::PointerUnion<swift::ModuleDecl, swift::SourceFile>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver) + 2539 19 swift-frontend 0x0000000104e8d9b5 swift::performFrontend(llvm::ArrayRef<char const>, char const, void, swift::FrontendObserver) + 5701 20 swift-frontend 0x0000000104e238ea swift::mainEntry(int, char const**) + 3082 21 dyld 0x00007ff80a09c310 start + 2432 Command SwiftCompile failed with a nonzero exit code

Expected behavior Build successfully.

Screenshots

Screenshot 2022-10-30 at 2 48 32 PM

Environment (please fill out the following information) Confirmed version that is able to successfully build our project:

Confirmed version that fails to build our project:

Additional context

Screenshot 2022-10-30 at 2 52 40 PM
michakfromparis commented 1 year ago

Same thing happening with our project that was working perfectly fine with 14.2 after the upgrade to 14.3. Updating the deployment target of Pods doesn't help

viewDidAppear commented 1 year ago

Also seeing this on a random file that had no issues previously. There are no warnings/errors displayed other than this.

linconz commented 1 year ago

Same problem in Xcode 14.3.1 My project is empty demo, have a few swift file, jsut played one or two hours,the build error appened When I clean the DerivedData is doesn't work.

IshuRocks commented 1 year ago

Same thing happening with our project, anyone solved this issue?

linconz commented 1 year ago

When I checked the code, I found that I was using an Objective-C runtime method in a swift code to load a class dynamically, but the class name was misspelled, it didn't exist, but swift is a static language, and it was an error at compile time, but Xcode didn't provide the correct error.

tbkka commented 1 year ago

It's difficult to diagnose and fix an error like this unless we can reproduce it. Can anyone provide a self-contained example project that reproduces this issue?

aayushbatwara commented 11 months ago

How did you all fix this? I'm facing the same issue with Xcode 15.0.1

oguzhanabuhanoglu commented 11 months ago

This is same for me and also i am getting another error with that one (No such module 'FirebaseAuth').I tought there is something wrong in my pod file or cocoapods and i update all the pods it didnt change.Then i clean build folder also i updated my xcode version 14.1 to 15.0.1.Did you guys solve this issue ?