Cocoapods: Can't build with Address Sanitizer enabled

Created on 11 Dec 2015  路  8Comments  路  Source: CocoaPods/CocoaPods

I'm having the same issue as #4586. The resolution there was to turn off the address sanitizer, but it's a tool for debugging that I'd like to be able to use.

If I make a new project in Xcode, it builds with the address sanitizer enabled.

(To turn on the address sanitizer, go to "Edit Scheme" and check the box for "Enable Address Sanitizer".)

screen shot 2015-12-11 at 1 53 59 pm
screen shot 2015-12-11 at 1 54 28 pm

Once I add CocoaPods to the project (following the guide here: https://guides.cocoapods.org/using/using-cocoapods.html) the project no longer builds with address sanitizer enabled.

I get a long list of errors like this:

Undefined symbols for architecture x86_64:
  "___asan_init", referenced from:
      _asan.module_ctor in libObjectiveSugar.a(ObjectiveSugar-dummy.o)
      _asan.module_ctor in libObjectiveSugar.a(NSArray+ObjectiveSugar.o)
      _asan.module_ctor in libObjectiveSugar.a(NSDictionary+ObjectiveSugar.o)
      _asan.module_ctor in libObjectiveSugar.a(NSMutableArray+ObjectiveSugar.o)
      _asan.module_ctor in libObjectiveSugar.a(NSNumber+ObjectiveSugar.o)
      _asan.module_ctor in libObjectiveSugar.a(NSSet+ObjectiveSugar.o)
      _asan.module_ctor in libObjectiveSugar.a(NSString+ObjectiveSugar.o)

Are there any steps I can follow to fix this?

awaiting input enhancement

Most helpful comment

Looking for an answer on this one also. I'm seeing the same problem.

All 8 comments

I'm guessing you have to ensure that all Pods are also build using the address sanitiser.

I tried editing the scheme for Pods and for ObjectiveSugar in my test project and turning on the address sanitizer for both of them, but I still get the same build errors for the main project. Anything else I might try?

Editing those schemes won't do anything, because you're not utilising them for the build. You have to dig up the right compiler settings and apply them to the other targets.

The issue happens for me too

Anyone figure this out?

Looking for an answer on this one also. I'm seeing the same problem.

Still exists...

This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem :+1:

Was this page helpful?
0 / 5 - 0 ratings