[TIMOB-1408] iAd's related linking failure when building an app with a custom titanium extension module
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Trivial |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2011-04-15T02:51:31.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | module, obj-c, sdk |
Reporter | Robby |
Assignee | Reggie Seagraves |
Created | 2011-04-15T02:51:26.000+0000 |
Updated | 2017-03-09T23:17:40.000+0000 |
Description
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 MACOSX_DEPLOYMENT_TARGET 10.6
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).
Attachments
File | Date | Size |
---|---|---|
ek.zip | 2011-04-15T02:51:27.000+0000 | 789291 |
st-johns.zip | 2011-04-15T02:51:27.000+0000 | 127723 |
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
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.
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. :/
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
Remove:
After fixing the comment issue above and then wiping out my build folder entirely, I can successfully build with the -weak_framework flags
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$_EKEvent", referenced from:
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 { }
@end
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 {
}
-(void)shutdown:(id)sender {
}
pragma mark Cleanup
-(void)dealloc {
}
pragma mark Internal Memory Management
-(void)didReceiveMemoryWarning:(NSNotification*)notification {
}
pragma mark Listener Notifications
-(void)_listenerAdded:(NSString *)type count:(int)count {
}
-(void)_listenerRemoved:(NSString *)type count:(int)count {
}
pragma Public APIs
-(id)newevent:(id)args {
}
@end
Des,
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.
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 didn
t 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 doesn
t 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.
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.
Robby
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
Des
Thanks Des for the files. Much appreciated.
Unable to duplicate as described. Probably an issue with the external module at some point. 1.6.0 RC1.
Closing ticket as invalid.