Re: Xcode Framework wrapper for Library ( Exposing library headers)
Re: Xcode Framework wrapper for Library ( Exposing library headers)
- Subject: Re: Xcode Framework wrapper for Library ( Exposing library headers)
- From: Mr steve davis <email@hidden>
- Date: Tue, 07 Feb 2017 00:39:23 +0000
Thanks, I downloaded your app and compared it to mine, and I can’t see any obvious differences that would affect my app. I tried running yours and got the error:
ld: file not found: /Users/xxx/Downloads/Single-Object-Prelink-Framework-Demo-master/../../../../Library/Developer/Xcode/DerivedData/SIngleObjectPrelink_Demo-bllgcoioetqcmcfvgnmxwdkseync/Build/Products/Debug/libMyLibrary.a
I changed your prelink libraries path to $(CONFIGURATION_BUILD_DIR)/libMyLibrary.a which resolved the problem with your app.
I then added the same path to my own project in the hope that it may solve mine too, but still the same error :(
Noticed a couple of differences in the build settings, changed “perform single object peeling” & “precompile prefix header" to YES
Then added -ObjC to "Other linker flags” (which I had previous added then taken out because it made no difference to the ‘bug’) and….. bingo!! It works!
Thanks so much.
> On 6 Feb 2017, at 22:48, Jonathan Mitchell <email@hidden> wrote:
>
> Its been a while since I wrapped my little noggin around this issue but perhaps this will help:
>
> https://github.com/mugginsoft/Single-Object-Prelink-Framework-Demo <https://github.com/mugginsoft/Single-Object-Prelink-Framework-Demo>
>
> There is a thread too, but the Apple list server seems to be on the beer again:
> https://lists.apple.com/archives/xcode-users/2014/Apr/msg00079.html <https://lists.apple.com/archives/xcode-users/2014/Apr/msg00079.html>
>
> Jonathan
>
>> On 6 Feb 2017, at 22:04, Mr steve davis <email@hidden <mailto:email@hidden>> wrote:
>>
>>
>> I would be so grateful if someone could help me, I have been banging my head a against a brick wall for days on this now.
>> Here’s a sample project if it helps… http://www.thingsidoatwork.co.uk/MyProject.zip <http://www.thingsidoatwork.co.uk/MyProject.zip> <http://www.thingsidoatwork.co.uk/MyProject.zip <http://www.thingsidoatwork.co.uk/MyProject.zip>>
>>
>> I'm creating a Framework wrapper round a static library. The header (MyLibrary.h) needs to be accessable from the ViewController.m file in MyProject
>>
>> MyProject
>> MyFramework
>> MyLibrary.h
>> libMyLibrary.a
>>
>>
>>
>> #import "ViewController.h"
>> @import MyFramework;
>>
>> @implementation ViewController
>>
>> - (void)viewDidLoad {
>> [super viewDidLoad];
>>
>> [[[MyLibrary alloc]init]test];
>> }
>>
>>
>> I have set MyLibrary.h to public
>> MyFramework.h contains the line #import <MyFramework/MyLibrary.h>
>> 'Embedded Binaries' is set to MyFramework
>> When I run the above code I get...
>>
>>
>> Undefined symbols for architecture x86_64:
>> "_OBJC_CLASS_$_MyLibrary", referenced from:
>> objc-class-ref in ViewController.o
>> ld: symbol(s) not found for architecture x86_64
>> clang: error: linker command failed with exit code 1 (use -v to see invocation)
>>
>>
>> The only way I have found to solve this problem is to create a private Class in MyFramework (called TestClass) and allocate MyLibrary. I assume this forces MyLibrary to be linked at runtime and accessable from ViewController.
>> But this is ugly as hell, what am I missing?
>>
>> #import "TestClass.h"
>> #import "MyLibrary.h"
>>
>> @implementation TestClass
>> - (id)init {
>> if (self = [super init]) {
>>
>> [MyLibrary alloc]; //solves the problem of MyLibrary being accessable from ViewController
>> }
>> return self;
>> }
>> @end
>>
>>
>> Is there a compiler flag I’m missing that would help? I have tried all-load -ObjC etc but no luck.
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden <mailto:email@hidden>)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com <http://lists.apple.com/>
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden