Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1408] iAd's related linking failure when building an app with a custom titanium extension module

GitHub Issuen/a
Resolution Date2011-04-15T02:51:31.000+0000
Affected Version/sn/a
Fix Version/sn/a
Labelsmodule, obj-c, sdk
AssigneeReggie Seagraves


SDK 1.4.0, iOS SDK 4.0.1, XCode 3.2.3
When attempting to build a stock new project with a very basic Titanium SDK extension module (http://github.com/xavierlacot/titanium_mobile_clipboard_module)">http://github.com/xavierlacot/titanium_mobile_clipboard_module), I get the following linking error:

Ld build/Debug-iphonesimulator/SCApp.app/SCApp normal i386
    cd "/Users/jamie/Documents/Aptana Studio Workspace/myprojmyproj/SCApp/build/iphone"
    setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk "-L/Users/jamie/Documents/Aptana Studio Workspace/myproj/SCApp/build/iphone/build/Debug-iphonesimulator" "-L/Users/jamie/Documents/Aptana Studio Workspace/myproj/SCApp/build/iphone/lib" "-L/Library/Application Support/Titanium/modules/iphone/titanium.clipboard/0.1" "-L/Library/Application Support/Titanium/modules/iphone/titanium.ekext/0.1" "-L/Users/jamie/Documents/Aptana Studio Workspace/myproj/SCApp/build/iphone/../../../../tmp/debug/build" "-L/Users/jamie/Documents/Aptana Studio Workspace/myproj/SCApp/build/iphone/../../../../tmp/staticlib/build/Debug-iphonesimulator" "-L/Users/jamie/Documents/Aptana Studio Workspace/myproj/SCApp/build/iphone/../../../tijs/TiCore/TiCore/build/Release-iphonesimulator" "-F/Users/jamie/Documents/Aptana Studio Workspace/myproj/SCApp/build/iphone/build/Debug-iphonesimulator" -filelist "/Users/jamie/Documents/Aptana Studio Workspace/myproj/SCApp/build/iphone/build/SCApp.build/Debug-iphonesimulator/SCApp.build/Objects-normal/i386/SCApp.LinkFileList" -mmacosx-version-min=10.6 -ObjC -Xlinker -objc_abi_version -Xlinker 2 -framework Foundation -weak_framework UIKit -framework CoreGraphics -framework AddressBook -framework AddressBookUI -framework CFNetwork -framework CoreLocation -framework MapKit -framework MessageUI -framework MobileCoreServices -framework OpenGLES -framework QuartzCore -framework SystemConfiguration -lsqlite3 -lz -framework AudioToolbox -weak_framework MediaPlayer -framework AVFoundation -lxml2 -framework StoreKit -lTiCore -ltitanium.clipboard -ltitanium.ekext -framework ExternalAccessory -ltiverify -o "/Users/jamie/Documents/Aptana Studio Workspace/myproj/SCApp/build/iphone/build/Debug-iphonesimulator/SCApp.app/SCApp"

ld: warning: directory '/Users/jamie/Documents/Aptana Studio Workspace/myproj/SCApp/build/iphone/../../../../tmp/debug/build' following -L not found
ld: warning: directory '/Users/jamie/Documents/Aptana Studio Workspace/myproj/SCApp/build/iphone/../../../../tmp/staticlib/build/Debug-iphonesimulator' following -L not found
ld: warning: directory '/Users/jamie/Documents/Aptana Studio Workspace/myproj/SCApp/build/iphone/../../../tijs/TiCore/TiCore/build/Release-iphonesimulator' following -L not found
Undefined symbols:
  "_ADBannerContentSizeIdentifier320x50", referenced from:
      _ADBannerContentSizeIdentifier320x50$non_lazy_ptr in TiUIiOSAdViewProxy.o
     (maybe you meant: _ADBannerContentSizeIdentifier320x50$non_lazy_ptr)
  "_OBJC_CLASS_$_ADBannerView", referenced from:
      objc-class-ref-to-ADBannerView in TiUIiOSAdView.o
  "_ADBannerContentSizeIdentifier480x32", referenced from:
      _ADBannerContentSizeIdentifier480x32$non_lazy_ptr in TiUIiOSAdViewProxy.o
     (maybe you meant: _ADBannerContentSizeIdentifier480x32$non_lazy_ptr)
ld: symbol(s) not found
collect2: ld returned 1 exit status

Both I and another individual ran into this same error with two recent versions of Titanium SDK (1.3.2 and 1.4.0). For the full error and process, please see:
http://developer.appcelerator.com/question/46541/extending-titanium-mobile-with-module-sdk-possible"> http://developer.appcelerator.com/question/46541/extending-titanium...

Also, when adding an extension module up against a titanium app, and launching the app in the emulator, the build scripts seem to want to recompile the whole Titanium libraries every time…making it take 5+ minutes every time I try to build the app (maybe this is just because of the linking problem above).




  1. Robby 2011-04-15

    It looks like just adding "-framework iAd" into that linking statement will resolve the error. Now I just need to find where in the Titanium codebase that linking statement is being assembled.... :o

  2. Robby 2011-04-15

    Note that this appears to be a side-effect to the issue identified in ticket #1339. Commenting out that line fixes this issue and allows the build to succeed.

  3. Robby 2011-04-15

    The issue of a full Titanium rebuild every time I make an app revision still persists however...perhaps it's that "force_xcode = True" in iphone/builder.py on line 478?? Is there a particular reason for having to rebuild everything? This makes test/debug cycles unbearably long (5-10 minutes, instead of the normal

    I'd really like to use Titanium but if I have to have 5-10 minute rebuild cycles every time I'll have to just write this app natively. :/

  4. Jake Howerton 2011-04-15

    One part of the issue which resolves my original ticket is that the comment banner at the top of the automatically generated module.xcconfig creates a syntax error. Comments should use double slash (//) in xcconfig files





  5. Jake Howerton 2011-04-15

    After fixing the comment issue above and then wiping out my build folder entirely, I can successfully build with the -weak_framework flags

  6. Des 2011-04-15

    I have been trying to create a module to use the Event Kit over the last few days and found exactly the same issue. Both of the tips above have not helped. Is there anything else to try?

    The error I get is:

    Undefined symbols:
    "OBJC_CLASS$_EKEventStore", referenced from:

         objc-class-ref-to-EKEventStore in libcalendar.a(CalendarModule.o)

    "OBJC_CLASS$_EKEvent", referenced from:

         objc-class-ref-to-EKEvent in libcalendar.a(CalendarModule.o)

    ld: symbol(s) not found
    collect2: ld returned 1 exit status

    This may be down to my module as I have never used Objective C before and have just been cutting and pasting what I have found in Appcelerator and Apple documentation. If it is of any use the code is as follows:

    CalendarModule.h :-

    import "TiModule.h"

    @interface CalendarModule : TiModule { }


    CalendarModule.m :-

    import "CalendarModule.h"

    import "TiBase.h"

    import "TiHost.h"

    import "TiUtils.h"

    import <EventKit/EventKit.h>

    @implementation CalendarModule

    pragma mark Lifecycle

    -(void)startup {

       [super startup];
       NSLog(@"[INFO] %@ loaded",self);


    -(void)shutdown:(id)sender {

       [super shutdown:sender];


    pragma mark Cleanup

    -(void)dealloc {

       [super dealloc];


    pragma mark Internal Memory Management

    -(void)didReceiveMemoryWarning:(NSNotification*)notification {

       [super didReceiveMemoryWarning:notification];


    pragma mark Listener Notifications

    -(void)_listenerAdded:(NSString *)type count:(int)count {

       if (count == 1 && [type isEqualToString:@"my_event"])


    -(void)_listenerRemoved:(NSString *)type count:(int)count {

       if (count == 0 && [type isEqualToString:@"my_event"])


    pragma Public APIs

    -(id)newevent:(id)args {

       id arg1 = [args objectAtIndex:0];  // Start Date
       id arg2 = [args objectAtIndex:1];  // End Date
       id arg3 = [args objectAtIndex:2];  // Title
       id arg4 = [args objectAtIndex:3];  // Location
       id arg5 = [args objectAtIndex:4];  // Text
       NSDateFormatter *df = [[NSDateFormatter alloc] init];
       [df setDateFormat:@"yyyy-MM-dd hh:mm:ss"];
       NSDate *startdate = [df dateFromString: arg1];
       NSDate *enddate = [df dateFromString: arg2];
       EKEventStore *eventStore = [[[EKEventStore alloc] init] autorelease];
       EKEvent *event  = [EKEvent eventWithEventStore:eventStore];
       event.title     = arg3;
       event.location  = arg4;
       event.notes     = arg5;
       event.startDate = startdate;
       event.endDate   = enddate;
       [event setCalendar:[eventStore defaultCalendarForNewEvents]];
       NSError *err;
       [eventStore saveEvent:event span:EKSpanThisEvent error:&err];
       return event.eventIdentifier;



  7. Robby 2011-04-15


    hmm, check your compiler build strings. Is it trying to link to the Eventkit framework? If not, you should remove those # comments that ticket #1339 talks about. Then, add a -framework switch for eventkit in your module's OTHER_LDFLAGS variable (I think OTHER_LDFLAGS is right...forget the exact named, and it should be in a file called module.xcconfig ..which is xconfig-specific parameters for your project)

    I'll be going through this here in a few days, so let me know how it turns out.

  8. Des 2011-04-15

    Dear Robby,

    Sorry for the delay replying, I have had 24 hours of hair pulling. My previous attempt was such a messed up bodge (using sdk 1.4 with the 1.3.2 module builder as it had moved, modified build.py and builder.py, every conceivable setting in xcode messed about....) so I thought I would start from scratch with a clean module.

    Deleted 1.4 and re-downloaded, used it's module builder, deleted the # comments and recreated the module from scratch. Added the following line to module.xcconfig, OTHER_LDFLAGS=$(inherited) -framework EventKit.

    And it didnt work. I have been trying everything and eventually realised that I am a complete idiot! I wanted to leave my original module there for reference (it was called Calendar) so I created a new module called EK (completely forgetting Titanium's naming requirements). Once all references to EK were changed to Ek it works perfectly. It doesnt do much, but it does let me put events into the iPhone Calendar and shouldnt be very hard to extend.

    Thanks very much for the help.

  9. Robby 2011-04-15

    Hey Des,

    Glad you got it working!

    Would you be able to send me the module you made by chance (that or put it on github, etc)? I'm going to be doing this myself for my app and it would save me a lot of time. I'd be happy to send you back any additions.


  10. Des 2011-04-15

    Dear Robby,

    Attached are two files, the module EK.zip and a simple titanium project that lets you add and inspect calendar events StJohns.zip

    It is really just a proof of concept at the moment as I know that I will need it for an app that I plan to start working on in the next month or so. Please note that this is no use in the emulator as it appears not to support the calendar at all, you have to install on a phone.

    There is a bit of fiddling required to get it going, but I think this ticket could now be reduced to a faq.

    I am not too concerned about the full rebuild, having got the functionality required in the module working I will comment out the entry in tiapp.xml and work on the rest of the app, just uncommenting every now and then to do a test build.

    Best wishes


  11. Robby 2011-04-15

    Thanks Des for the files. Much appreciated.

  12. Stephen Tramer 2011-04-15

    Unable to duplicate as described. Probably an issue with the external module at some point. 1.6.0 RC1.

  13. Lee Morris 2017-03-09

    Closing ticket as invalid.

JSON Source