3
votes

I've added GoogleMobileAds via CocoaPods as it was explained here: admob iOS quick start

My code looks like this:

import Firebase
import GoogleMobileAds
....
var interstitial: GADInterstitial!
  • I've imported Firebase to solve this error: Use of undeclared type 'GADInterstitial'. Now, this error is gone. but...

I have this error every time I try to compile:

 Command failed due to signal : Segmentation fault: 11

Cleaning and restarting is not helping. I don't have any other imports in this file, so this answer is not helping me. I am using the latest version of adMob fetched by pods, so altering the code as suggested here doesn't seem like the right direction either. How can this be fixed?

Here is the log:

MergeSwiftModule normal x86_64 /Users/luda/Library/Developer/Xcode/DerivedData/Playbuzz-cexhbhfyfhomayguuohivuzvrlzx/Build/Intermediates/Playbuzz.build/Debug-iphonesimulator/Playbuzz.build/Objects-normal/x86_64/Playbuzz.swiftmodule cd /Users/luda/Documents/Development/playbuzz.ios /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -emit-module /Users/luda/Library/Developer/Xcode/DerivedData/Playbuzz-cexhbhfyfhomayguuohivuzvrlzx/Build/Intermediates/Playbuzz.build/Debug-iphonesimulator/Playbuzz.build/Objects-normal/x86_64/AppDelegate~partial.swiftmodule /Users/luda/Library/Developer/Xcode/DerivedData/Playbuzz-cexhbhfyfhomayguuohivuzvrlzx/Build/Intermediates/Playbuzz.build/Debug-iphonesimulator/Playbuzz.build/Objects-normal/x86_64/QuizResult~partial.swiftmodule +++++++++++++++++++++++++++++++++++ I/Users/luda/Documents/Development/playbuzz.ios/Pods/Headers/Public/GoogleUtilities -Xcc -I/Users/luda/Library/Developer/Xcode/DerivedData/Playbuzz-cexhbhfyfhomayguuohivuzvrlzx/Build/Intermediates/Playbuzz.build/Debug-iphonesimulator/Playbuzz.build/DerivedSources/x86_64 -Xcc -I/Users/luda/Library/Developer/Xcode/DerivedData/Playbuzz-cexhbhfyfhomayguuohivuzvrlzx/Build/Intermediates/Playbuzz.build/Debug-iphonesimulator/Playbuzz.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -DCOCOAPODS=1 -Xcc -working-directory/Users/luda/Documents/Development/playbuzz.ios -emit-module-doc-path /Users/luda/Library/Developer/Xcode/DerivedData/Playbuzz-cexhbhfyfhomayguuohivuzvrlzx/Build/Intermediates/Playbuzz.build/Debug-iphonesimulator/Playbuzz.build/Objects-normal/x86_64/Playbuzz.swiftdoc -module-name Playbuzz -emit-objc-header-path /Users/luda/Library/Developer/Xcode/DerivedData/Playbuzz-cexhbhfyfhomayguuohivuzvrlzx/Build/Intermediates/Playbuzz.build/Debug-iphonesimulator/Playbuzz.build/Objects-normal/x86_64/Playbuzz-Swift.h -o /Users/luda/Library/Developer/Xcode/DerivedData/Playbuzz-cexhbhfyfhomayguuohivuzvrlzx/Build/Intermediates/Playbuzz.build/Debug-iphonesimulator/Playbuzz.build/Objects-normal/x86_64/Playbuzz.swiftmodule

  1. While loading members for 'ItemViewController' at
  2. While deserializing decl #182 (PATTERN_BINDING_DECL)
  3. While deserializing decl #21 (VAR_DECL)
3
Try include "<ProjectName>-Bridging-Header.h" in the Target Settings > Build Settings > Swift Compiler - Code Generation > Objective-C Bridging HeaderMrunal
@Mrunal the bridging header is included properly, as other files that needed to be imported are working properlyLuda
Can you post compilation log please ?sage444
@sage444, I've updated the question with the log. (some of it was omitted due to its size)Luda
@Mrunal, This doesn't happen on an empty project, that I've started from scratch.Luda

3 Answers

4
votes

Yea that issue kept me up for days...I finally found the solution by enabling whole module optimisation. Here's a link that explains how to:

http://useyourloaf.com/blog/swift-whole-module-optimization/

Good luck!

0
votes

This segfault was occurring for us because we were autogenerating a Core Data entity class but also including its manually generated source file in one of our development pods. For what it's worth, although our error message was the same, we are not using AdMob, and enabling whole-module optimization did not solve the problem for us.

We are using development pods for a variety of internal libraries. When we tried to compile our main app project after adding a new Core Data entity to one of our development pods (call this pod A), we would get "Segmentation fault: 11" while Xcode built pods B and C that depend on A. Xcode reported no errors from pod A itself. The errors building B and C occurred when running MergeSwiftModule. Here's a cleaned-up version of the stack trace we received:

MergeSwiftModule normal x86_64 /Users/me/Library/Developer/Xcode/DerivedData/MyApp-xyz/Build/Intermediates/Pods.build/Debug-iphonesimulator/PodB.build/Objects-normal/x86_64/PodB.swiftmodule
cd /Users/me/Code/ios/MyApp/Pods
"/Applications/Xcode 8.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift" -frontend -emit-module ... (long command omitted here)
0  swift                    0x00000001091bf3ad PrintStackTraceSignalHandler(void*) + 45
1  swift                    0x00000001091beb56 SignalHandler(int) + 790
2  libsystem_platform.dylib 0x00007fff9916552a _sigtramp + 26
3  libsystem_platform.dylib 000000000000000000 _sigtramp + 1726589680
4  swift                    0x00000001067cb996 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 806
5  swift                    0x00000001067c4178 swift::ModuleFile::getDecl(llvm::PointerEmbeddedInt<unsigned int, 31>, llvm::Optional<swift::DeclContext*>) + 18664
6  swift                    0x00000001067cfb2c swift::ModuleFile::maybeReadPattern() + 332
7  swift                    0x00000001067cfece swift::ModuleFile::maybeReadPattern() + 1262
8  swift                    0x00000001067c2d82 swift::ModuleFile::getDecl(llvm::PointerEmbeddedInt<unsigned int, 31>, llvm::Optional<swift::DeclContext*>) + 13554
9  swift                    0x00000001067d44a7 swift::ModuleFile::loadAllMembers(swift::Decl*, unsigned long long) + 647
10 swift                    0x0000000106b6706a (anonymous namespace)::Traversal::visitNominalTypeDecl(swift::NominalTypeDecl*) + 314
11 swift                    0x0000000106b6501b (anonymous namespace)::Traversal::doIt(swift::Decl*) + 219
12 swift                    0x000000010651cc2f swift::SILPassManager::SILPassManager(swift::SILModule*, llvm::StringRef) + 1423
13 swift                    0x0000000106521cef swift::runSILDiagnosticPasses(swift::SILModule&) + 159
14 swift                    0x00000001061cbf7e performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 19758
15 swift                    0x00000001061c52b3 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 17859
16 swift                    0x00000001061815cf main + 8239
17 libdyld.dylib            0x00007fff956745ad start + 1
18 libdyld.dylib            0x0000000000000068 start + 1788394172
Stack dump:
0. Program arguments: /Applications/Xcode 8.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -emit-module ... (long command omitted here)

When we opened pod A's project file individually and tried to compile it, Xcode complained that we had two references to the same filename. Once we fixed that by turning the Codegen setting for the offending entity to "Manual/None", all the problems magically went away, when building both pod A's project and the main app project as a whole.

0
votes

I faced the same problem with different pods. Unfortunately, everytime I cleaned the product, it was some other pod.

So I simply de-installed pod by pod, had x-code cleaned the product each time and tried to run the app (which was a bitch, since the pods were in active use).

After having it running again, I installed the pods (in one step) - and everything was fine again.