An empty Cocoatouch Framework on Xcode errors out? - ios

I create a cocoatcouch framework, as soon as I add a blank swift file to the project I get an error:
An internal error has occurred. Source editor functionality is limited. Attempting to restore.
The language on the project is set to swift
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/Darwin.h"
^
/Users/aryan.ghassemi/Desktop/Darwin/Darwin/Darwin.h:9:9: error: 'UIKit/UIKit.h' file not found
#import <UIKit/UIKit.h>
^
<unknown>:0: error: could not build Objective-C module 'Darwin'
0 swift 0x0000000104cf959a PrintStackTraceSignalHandler(void*) + 42
1 swift 0x0000000104cf8d4e SignalHandler(int) + 302
2 libsystem_platform.dylib 0x00007fff7966eb3d _sigtramp + 29
3 libsystem_platform.dylib 0x00007fd4e542118f _sigtramp + 1809524335
4 swift 0x000000010223504b swift::SerializedModuleLoader::loadModule(swift::SourceLoc, llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >) + 891
5 swift 0x000000010237dbb3 swift::ASTContext::getModule(llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >) + 227
6 swift 0x000000010205bf7c swift::performNameBinding(swift::SourceFile&, unsigned int) + 2028
7 swift 0x0000000101d938e3 swift::CompilerInstance::performSema() + 3379
8 swift 0x0000000100f7f50b performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 731
9 swift 0x0000000100f7bd35 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7717
10 swift 0x0000000100f21965 main + 1349
11 libdyld.dylib 0x00007fff79483ed9 start + 1
12 libdyld.dylib 0x000000000000004c start + 2260189556
Stack dump:

this problem occurs mainly because of multiple XCodes.
Install Command line tool, and try to set the same tool version in below image.

Related

Termination Description: DYLD, Symbol not found: ___darwin_check_fd_set_overflow

I have such a problem, I put together a build for ios in unity.
When I run a app:
-IOS 14+ and IOS 13.6 starts up and works
-IOS 12.3.1 and IOS 13.2 crashes when start
The application opens, freezes and crashes.
Termination Description: DYLD, Symbol not found: ___darwin_check_fd_set_overflow | Referenced from: /var/containers/Bundle/Application/1C5FB058-3A1A-4845-A857-D4717591F4BA/ProductName.app/Frameworks/UnityFramework.framework/UnityFramework | Expected
Thread 39 Crashed:
0 dyld 0x0000000100a0a398 __abort_with_payload + 8
1 dyld 0x0000000100a099d8 abort_with_payload_wrapper_internal + 100
2 dyld 0x0000000100a09a08 fcntl + 0
3 dyld 0x00000001009cc8f8 dyld::fastBindLazySymbol+ 18680 (ImageLoader**, unsigned long) + 0
4 dyld 0x00000001009cca14 dyld::fastBindLazySymbol+ 18964 (ImageLoader**, unsigned long) + 284
5 libdyld.dylib 0x00000001a8524848 dyld_stub_binder + 60
6 UnityFramework 0x0000000107f0bf20 0x107000000 + 15777568
7 UnityFramework 0x0000000107ee75d0 0x107000000 + 15627728
8 UnityFramework 0x0000000107f07864 0x107000000 + 15759460
9 UnityFramework 0x0000000107f074bc 0x107000000 + 15758524
10 UnityFramework 0x0000000107ef03cc 0x107000000 + 15664076
11 UnityFramework 0x0000000108109b30 0x107000000 + 17865520
12 UnityFramework 0x0000000107f4d5ec 0x107000000 + 16045548
13 UnityFramework 0x0000000107f4f2cc 0x107000000 + 16052940
14 UnityFramework 0x0000000107f4f20c 0x107000000 + 16052748
15 libsystem_pthread.dylib 0x00000001a86f02c0 _pthread_body + 128
16 libsystem_pthread.dylib 0x00000001a86f0220 _pthread_start + 44
17 libsystem_pthread.dylib 0x00000001a86f3cdc thread_start + 4
Know someone who can answer?
Those are system components. Generally, you should only go into those folders when you have a reason to do so.
When you run the second command, the change is being made to the root account's settings and not those for your normal account.

Xcode 10.2 iOS Swift (+ React Native) project compilation error

After upgrading to Xcode 10.2 we cannot compile project anymore. We got this compilation errors. Looks like very wired LLVM compiler error. It is not React Native issue as far as I can see, but I cannot even imagine how to debug this error, there is no information about this in the whole Internet.
May be someone know something about this? Or at least how to debug it? Thanks.
Swift 4.2
React Native 0.59.3 (latest)
Xcode 10.2
Error:
LLVM ERROR: out of memory
Stack dump:
0. Program arguments: <....>
1. While emitting IR SIL function "#$sypSgIegn_Ieg_TR".
for <<debugloc at "<compiler-generated>":0:0>>0 swift 0x000000010b99eee3 PrintStackTraceSignalHandler(void*) + 51
1 swift 0x000000010b99e6bc SignalHandler(int) + 348
2 libsystem_platform.dylib 0x00007fff697f1b3d _sigtramp + 29
3 libsystem_platform.dylib 0x00007ffee848cee0 _sigtramp + 2127147968
4 libsystem_c.dylib 0x00007fff696af1c9 abort + 127
5 swift 0x000000010b94f644 llvm::report_bad_alloc_error(char const*, bool) + 100
6 swift 0x000000010786d210 swift::irgen::CallEmission::setArgs(swift::irgen::Explosion&, bool, swift::irgen::WitnessMetadata*) + 2560
7 swift 0x0000000107a21335 (anonymous namespace)::IRGenSILFunction::visitFullApplySite(swift::FullApplySite) + 2053
8 swift 0x0000000107a016aa swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 9898
9 swift 0x00000001078c0259 swift::irgen::IRGenerator::emitLazyDefinitions() + 1353
10 swift 0x00000001079e1250 performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::LLVMContext&, swift::SourceFile*, llvm::GlobalVariable**) + 1232
11 swift 0x00000001078030b9 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 49417
12 swift 0x00000001077f36de swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6862
13 swift 0x00000001077917be main + 1246
14 libdyld.dylib 0x00007fff69606ed9 start + 1
15 libdyld.dylib 0x000000000000010f start + 2527040055
error: Abort trap: 6
That's somehow is error report of unsupported syntax ¯_(ツ)_/¯
Specifically in our case problem was in new rule for Swift 5 (but we were on Swift 4!):
In Swift 5 mode, #autoclosure parameters can no longer be forwarded to #autoclosure arguments in another function call.
So we've changed:
completionHandler: resolver -> completionHandler: { resolver(nil) }
We've found this problem, when switched to Swift 5 and XCode reported it. Then we switched back to Swift 4 with this fix and everything worked.

Swift compiler segfaulting in handleDeferredImports

We have started seeing a strange problem, appearing somewhat out of nowhere, where the compiler segfaults in handleDeferredImports. This doesn't always happen, sometimes I need to clean & rebuild 2-3 times to trigger it again, so it's very hard to determine what's the root cause of it.
I've also not been able to reproduce it in a separate sample project, but after two days of looking for solutions I'm drawing a blank.
This is the segfault: error: Segmentation fault: 11 with following stack:
0 swift 0x000000011307064a PrintStackTraceSignalHandler(void*) + 42
1 swift 0x000000011306fdfe SignalHandler(int) + 302
2 libsystem_platform.dylib 0x00007fff76391b3d _sigtramp + 29
3 libsystem_platform.dylib 000000000000000000 _sigtramp + 2311513312
4 swift 0x0000000110605df0 swift::ClangImporter::Implementation::handleDeferredImports() + 512
5 swift 0x00000001106058dc swift::ClangImporter::Implementation::importHeader(swift::ModuleDecl*, llvm::StringRef, swift::SourceLoc, bool, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer> >, bool) + 1804
6 swift 0x0000000110606754 swift::ClangImporter::importBridgingHeader(llvm::StringRef, swift::ModuleDecl*, swift::SourceLoc, bool, bool) + 932
7 swift 0x000000011010acfd swift::CompilerInstance::performSema() + 2029
8 swift 0x000000010f2f859b performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 731
9 swift 0x000000010f2f4dc5 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7717
10 swift 0x000000010f29aa35 main + 1349
11 libdyld.dylib 0x00007fff761a808d start + 1
12 libdyld.dylib 0x0000000000000123 start + 2313519255
There's no indication to individual files or headers.
We do use a mix of Objective-C and Swift, importing ProjectModuleName-Swift.h in a lot of files, and similar, have a very large ProjectModuleName-Bridging-Header.h file. In addition to this, for legacy reasons, there's a ProjectModuleName-Prefix.pch for default Objective-C includes (yes, I know that's awful).
What's strange here is the segfault in handleDeferredImports which is different from all the other Swift compiler segfault issues found on Stack Overflow.
Swift version is 4.2, and we're using the "New Build System" in Xcode 10 (it also segfaults on the "Legacy Build System").
Workaround for the Swift 4 compiler was to enable Whole Module optimisation for all builds.
The issue itself appears to been fixed in Swift 5.0
Should anyone see this issue in the future, please refer to https://bugs.swift.org/browse/SR-9528

Stored value type does not match pointer operand type! - store i64, swift.bridge, dictionaryUpCasts

We have recently migrated code from Swift 2.3 to 4.0.
The app working fine when run in debug mode on devices as well as simulators. No issues in compile and build.
But as soon as it is archived, it fails in compilation with the following error. And, more importantly, it is not pointing to any location (no file, no function, no statement) in the code.
Even I am finding difficulty in deducing - where and what the issue is.
It is built using Xcode 9.0. Previously I thought it is the issue of Beta version as I was using the Beta and GM seed of XCode 9.0 on Mac OS Sierra.
Stored value type does not match pointer operand type!
store i64 %119, %swift.bridge** %128, align 8, !dbg !402
%swift.bridge*<unknown>:0: error: fatal error encountered during compilation; please file a bug report with your project and the crash log
<unknown>:0: note: Broken function found, compilation aborted!
0 swift 0x000000010454adba PrintStackTraceSignalHandler(void*) + 42
1 swift 0x000000010454a1f6 SignalHandler(int) + 662
2 libsystem_platform.dylib 0x00007fffacd39b3a _sigtramp + 26
3 libsystem_platform.dylib 0x0000000000000004 _sigtramp + 1395418340
4 libsystem_c.dylib 0x00007fffacbbe420 abort + 129
5 swift 0x0000000100eb9fe7 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*)::$_0::__invoke(void*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) + 551
6 swift 0x00000001045083fb llvm::report_fatal_error(llvm::Twine const&, bool) + 571
7 swift 0x00000001045081ba llvm::report_fatal_error(char const*, bool) + 42
8 swift 0x00000001044de6b6 (anonymous namespace)::VerifierLegacyPass::runOnFunction(llvm::Function&) + 54
9 swift 0x000000010448baaa llvm::FPPassManager::runOnFunction(llvm::Function&) + 506
10 swift 0x0000000104493609 llvm::legacy::FunctionPassManagerImpl::run(llvm::Function&) + 377
11 swift 0x00000001044933fa llvm::legacy::FunctionPassManager::run(llvm::Function&) + 410
12 swift 0x0000000101033778 swift::performLLVM(swift::IRGenOptions&, swift::DiagnosticEngine*, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*, llvm::TargetMachine*, swift::version::Version const&, llvm::StringRef, swift::UnifiedStatsReporter*) + 5016
13 swift 0x00000001010376d5 ThreadEntryPoint(swift::irgen::IRGenerator*, llvm::sys::SmartMutex<false>*, int) + 181
14 swift 0x000000010103772f void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(swift::irgen::IRGenerator*, llvm::sys::SmartMutex<false>*, int), swift::irgen::IRGenerator*, llvm::sys::SmartMutex<false>*, int> >(void*) + 47
15 libsystem_pthread.dylib 0x00007fffacd4393b _pthread_body + 180
16 libsystem_pthread.dylib 0x00007fffacd43887 _pthread_body + 0
17 libsystem_pthread.dylib 0x00007fffacd4308d thread_start + 13
Stack dump:
0. Running pass 'Module Verifier' on function '#_T0s17_dictionaryUpCasts10DictionaryVyq0_q1_GACyxq_Gs8HashableRzsAFR0_r2_lFTfq4g_nSi_SQySayACyS2SGGGSiAHSgTg5'
This is a bug in Swift code generation.
Select Project, go to your desired Target, and under build settings, you may try by changing code optimization level before you compile. Try whole-module-optimization with the respective configuration, as shown below:
With Swift 3.0 this is the default, and Swift 4.0 shouldn't be any different, IMHO.

Xcode 8.2.1/Swift 3.0 Product/Archive failing with Segmentation Fault 11

I went to create a Archive through Xcode and was presented with
Command failed due to signal: Segmentation fault: 11
#selector(NSDecimalNumberBehaviors.scale)
0 swift 0x00000001067b93ad PrintStackTraceSignalHandler(void*) + 45
1 swift 0x00000001067b8b56 SignalHandler(int) + 790
2 libsystem_platform.dylib 0x00007fffd13feb3a _sigtramp + 26
3 swift 0x0000000106722d51 llvm::MCDwarfLineTableHeader::getFile(llvm::StringRef&, llvm::StringRef&, unsigned int) + 3169
4 swift 0x0000000105ae7c38 llvm::DwarfDebug::endModule() + 1080
5 swift 0x0000000105abe571 llvm::AsmPrinter::doFinalization(llvm::Module&) + 2481
6 swift 0x00000001065edee5 llvm::FPPassManager::doFinalization(llvm::Module&) + 53
7 swift 0x00000001065f789b llvm::legacy::PassManager::run(llvm::Module&) + 1803
8 swift 0x000000010391420a performLLVM(swift::IRGenOptions&, swift::DiagnosticEngine&, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*, llvm::TargetMachine*, llvm::StringRef) + 8234
9 swift 0x0000000103910ccb ThreadEntryPoint(swift::irgen::IRGenerator*, llvm::sys::SmartMutex<false>*, int) + 171
10 swift 0x0000000103910d53 void* std::__1::__thread_proxy<std::__1::tuple<void (*)(swift::irgen::IRGenerator*, llvm::sys::SmartMutex<false>*, int), swift::irgen::IRGenerator*, llvm::sys::SmartMutex<false>*, int> >(void*) + 99
11 libsystem_pthread.dylib 0x00007fffd1408aab _pthread_body + 180
12 libsystem_pthread.dylib 0x00007fffd14089f7 _pthread_body + 0
13 libsystem_pthread.dylib 0x00007fffd14081fd thread_start + 13
The project compiles and runs perfectly fine (Cmd+R)
I've tried:
Clearing the derived data
Rebooting
Searching both Google and SO for any viable options which might match my circumstances.
I've had this before, but have always had some idea of "where" the problem lies, there doesn't seem to be any indication from the stack trace of where to begin to look
The project is (reasonably) large and contains a number of other libraries managed through Carthage, so not easy to post.
I have a "sneaking" suspicion that having opened the project (by mistake) in Xcode 8.3b1 "might" be part of the issue
By following this answer I can make it work, but this is not a long term solution I want to live with.
I know this is long shot and it seems to every question on this has a different cause, but I'd really like to know ANY suggestions that I might look into to solve this issue

Resources