Xcode error: Abort Trap 6

Occasionally, I get this error and I tried to research it but I couldnt figure out how to solve it. It says:


1. While deserializing SIL vtable for 'PostTextCVC' in module 'Appp'
error: Abort trap: 6

The only way to dismiss this is to user another simulator or my actual phone. I don't know how to fix it for real though, don't even know what that error means. It's not exactly descriptive. Any suggestions?


PS: Xcode version 10.0. beta 5

Facing the same issue with Xcode 10+

I have the same issue, when trying to build my App. I converted the project from Swift 3 to 4.2. All submodules to build only my project failes.


---
0  swift                    0x0000000104bb8bf5 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swift                    0x0000000104bb7e95 llvm::sys::RunSignalHandlers() + 85
2  swift                    0x0000000104bb91e2 SignalHandler(int) + 258
3  libsystem_platform.dylib 0x00007fff744d3b3d _sigtramp + 29
4  libsystem_platform.dylib 0x0000000000000001 _sigtramp + 2343748833
5  libsystem_c.dylib        0x00007fff743911c9 abort + 127
6  swift                    0x0000000100feebbb swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*)::$_1::__invoke(void*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) + 523
7  swift                    0x0000000104b4f47b llvm::report_fatal_error(llvm::Twine const&, bool) + 251
8  swift                    0x0000000104b4f37b llvm::report_fatal_error(char const*, bool) + 43
9  swift                    0x0000000104afe232 (anonymous namespace)::VerifierLegacyPass::doFinalization(llvm::Module&) + 210
10 swift                    0x0000000104a89596 llvm::FPPassManager::doFinalization(llvm::Module&) + 54
11 swift                    0x0000000104a88d75 llvm::legacy::FunctionPassManagerImpl::doFinalization(llvm::Module&) + 85
12 swift                    0x00000001011386e8 swift::performLLVMOptimizations(swift::IRGenOptions&, llvm::Module*, llvm::TargetMachine*) + 1176
13 swift                    0x00000001011393a6 swift::performLLVM(swift::IRGenOptions&, swift::DiagnosticEngine*, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*, llvm::TargetMachine*, swift::version::Version const&, llvm::StringRef, swift::UnifiedStatsReporter*) + 1910
14 swift                    0x0000000100fee534 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 16004
15 swift                    0x0000000100fe9948 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3000
16 swift                    0x0000000100f9b782 main + 690
17 libdyld.dylib            0x00007fff742e8ed9 start + 1
error: Abort trap: 6

I managed to get rid of the eorror:


Solution 1: go to Build settings an choose compilation mode 'Whole Module' instead of 'Incremental' - I'm not sure if this solution is always a good choice.


Solution 2: When using Xcode 10.2, with Swift 4.2 I got the above error all the time. Go to Swift.org, download latest Swift 4.2.3 Toolchain for Xcode and install it. Go the Menu and select Toolchain 4.2.3 -> voila my issue was got.

But now I'm not able to do Swift 5 migration - looks like the the Xcode default toolchain gets used.

I updated to Xcode 10.2.1 but still the same issue.

I was facing the same problem in Xcode 10.2.1.


After days trying to solve it, I discovered that in my case this error was caused by a Swift class that inherits an Objective-C Third Party class (more specifically the

FSCalendarCell
class from https://github.com/WenchaoD/FSCalendar).


I rewrote the Swift class for Objective-C and it compiled and ran without any issues.

I was using cocoapods, and this line was commented


use_frameworks!


So I did uncomment, updated the pods, cleaned and it worked

in my case, I found below code in the XXXBridgingHearder.h file


```

#import "OtherClassName.h" <- in this file, import "ClassA.h"

#import "Module/ClassA.h"

```


This module is a cocoapods dynamic lib. There is a swift ClassB inherit a OC ClassA in this module. It also encounter another error: MyClass is unavailable: cannot find Swift declaration for this class.

It really spend me a lot time to find out the issue.

Hope it can help.

Getting Same ERROR
Command CompileSwift failed with a nonzero exit code and
Abort Trap 6 error

Xcode Version : 12.3


I'm using Xcode 12.4. After making some changes to a class (to be precise, I changed the data type of a function argument), I ran into this problem. I've never faced this error before. Doing a clean (Product -> Clean) helped me resolve this problem. Hope this helps someone.

I've got the same error. The reason was here : guard let cell = cell { else return UITableViewCell } inside cellForRowAt method. After when i changed that "let cell" to "let currentCell" everything builds fine. I guess you should check if you have similar cases. Hope it will helps

@Max - thanks, that solved my issue too.

I had "guard let path = path else { return }" , which when changed to "guard let goodPath = path else { return }" solved the problem.

Strange, as there are loads of examples online/tutorials/books that use that form, but for some reason Swift doesn't like it.

(Xcode 12.5.1, Swift 5)

Remove all swift files from target.

Check target's build phases > compile source's count is zero

add files little by little to target

build and check to success

starting with the fewest dependencies. likes to entity, enums, views.. to VC

I solved the problem this way.

Like @Max suggested, it definitely happens around guard utilizing the same outer scope var name for the local scope. It's incredibly difficult to reproduce though. I've ran into this a few times now, and it's always around refactor changes, specifically variable name changes around these scopes. It feels as if precompiled/cached/magic fails to recognize the change and then is unable to bust the cache. The stack trace seems to drop you off somewhat near recent changes that have been done, but doesn't give you any other hints. Compiler isn't going to give you any hints either, sounds like a brute force trial and error where you start looking for your wallet in the microwave, or debugging purely off superstition. So thanks and sorry to ya'll who were able to track this down.

Same issue here. After trying everyone's suggestions from this thread and coming up dry, I finally narrowed down the needle-in-a-haystack.

In my case it was a Swift Package. Debug builds built fine, but Release builds (with optimizations) caused the Swift compiler to crash with the same stack trace and error: Abort trap: 6 as others have mentioned.

The culprit? A single missing import statement in one of the package's .swift files.

To elaborate the particulars:

  • PackageA (crashed compiler) has PackageB as a dependency, which in turn has PackageC as a dependency.
  • All three packages show up in the dependency pool of course.
  • PackageA was accessing methods from PackageC without actually using an import PackageC statement (possibly by way of PackageB exporting types from PackageC in some of its interfaces).
  • The missing import statement was forgotten because compilation succeeded in Debug builds and development and testing was only ever done in a Debug build. It wasn't until production Release builds of an application that imported PackageA that the compiler crash mysteriously cropped up with very little context.

My problem was with the line:

return ()

i removed the line and problem fixed!

Xcode error: Abort Trap 6
 
 
Q