Compile framework with Xcode 9 - objective-c

When I compile framework with Xcode 8 and after that import in new project it successfully build and I am able to test it. But when I compile framework with Xcode 9 and after that add builded framework in new project I got:
Undefined symbols for architecture arm64:
"___llvm_profile_runtime", referenced from:
___llvm_profile_runtime_user in xxxxxxxxx(DMCService.o)
___llvm_profile_runtime_user in xxxxxxxx(APXUserInterfacePresentor.o)
___llvm_profile_runtime_user in xxxxxxxxx(APXDevice.o)
___llvm_profile_runtime_user in xxxxxxxxx(APXInboxService.o)
___llvm_profile_runtime_user in xxxxxxxxx(AppoxeeManager.o)
___llvm_profile_runtime_user in xxxxxxxxx(APXApplicationSession.o)
___llvm_profile_runtime_user in xxxxxxxxx(APXInbox.o)
...
(maybe you meant: ___llvm_profile_runtime_user)
ld: symbol(s) not found for architecture arm64
I check builded framework with -lipo -info architecture and it has arm64.
This is happening only if I build framework for real device, if I build it for simulator it works fine. So I can not figure out why it is not working?
Thanks in advance for help.

Likely your framework build configuration has the setting "Enable Code Coverage Support" (the underlying setting name is CLANG_ENABLE_CODE_COVERAGE) set to YES, while in the application you include the framework, the same setting is set to NO.
For why this causes the Undefined symbols error: enabling the setting causes calls to instrumentation functions to be injected into in the framework code. But when building the app, the library where these functions are defined is not linked. So the linker (ld) fails.
Try again, building the framework with Enable Code Coverage Support set to NO.
Also, to avoid these kind of configuration mis-match errors, you might want to build the app and framework at the same time instead of pre-building the framework separately. You can do this by including the framework project as a subproject of the app project, or creating a Xcode workspace that includes both the app project and the framework project.

Related

.a library cannot find vision framework

I have a react-native library in my project.
The library is objective-c with added swift components requiring and importing vision.
The project and target are set for all architectures (including arm64), also they build for all architectures and not just the current one.
Vision is properly link in build rules of the app target (since there is no linking in static library) but i have a linker error during compilation :
library not found for -lswiftVision for architecture arm64
Cannot seem to find the root cause of this, never had any issue in a swift project so i have no clue.
Managing to advance a bit,
'#import Vision;'
In the main.h file of the library seems to fix the library not found, but i have another one instead :
'library not found for -lswiftSwiftOnoneSupport for architecture arm64'
It seems something fishy is going on during the linking of the project.
For anyone interested the solution was to create an empty swift file in the parent objective-c projet, xcode seems to fail to import swift frameworks properly without this.

ios9: Undefined symbols for architecture arm64

I had create framework that using chilkat library and it work fine, then I want to add iSMP.framework to my framework project, I just put .framework into project but it show error like this
is there any way to solve this problem ?
It looks as if the get_secret method might be calling a method from an external library/framework and that framework is not compiled for arm64. So you'd have to either get a copy of that framework compiled for arm64 or change the active architectures for your project to compile the app using the architectures supported by that library.

XCode won't compile due to armv7s slice error [duplicate]

I upgraded Xcode version and when using external static libraries, I get this message:
ld: file is universal (3 slices) but does not contain a(n) armv7s slice: /file/location for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Is there any way to bypass this and add support to the library if the developer of the library hasn't updated their library yet?
If you want to remove the support for any architecture, for example, ARMv7-s in your case, use menu Project -> Build Settings -> remove the architecture from "valid architectures".
You can use this as a temporary solution until the library has been updated. You have to remove the architecture from your main project, not from the library.
Alternatively, you can set the flag for your debug configuration's "Build Active Architecture Only" to Yes. Leave the release configuration's "Build Active Architecture Only" to No, just so you'll get a reminder before releasing that you ought to upgrade any third-party libraries you're using.
I've simply toggled "Build Active Architecture Only" to "Yes" in the target's build settings, and it's OK now!
Try to remove armv7s from project's "Valid architecture" to release from this issue for iOS 5.1 phone
I just posted a fix here that would also apply in this case - basically, you do a hex find-and-replace in your external library to make it think that it's ARMv7s code. You should be able to use lipo to break it into 3 static libraries, duplicate / modify the ARMv7 one, then use lipo again to assemble a new library for all 4 architectures.
Flurry Support for iPhone 5 (ARMv7s)
As I mentioned in yesterday’s post, Flurry started working on a version of the iOS SDK to support the ARMv7s processor in the new iPhone 5 immediately after the announcement on Wednesday.
I am happy to tell you that the work is done and the SDK is now available on the site.
use menu Project -> Build Settings ->
then remove armv7s from the"valid architectures".
If standard has been chosen then delete that and then add armv7.
In case this happens to someone. I built my own library to use with a third party code. While I was building it to deliver, I accidentally left my iPhone 4S plugged in, and so Xcode built my library only for the plugged architecture instead of following the project settings. Remove any plugged in devices and rebuilt the library, link it, and you should be all right.
Hope it helps.
In my case, I was linking to a third-party library that was a bit old (developed for iOS 6, on XCode 5 / iOS 7). Therefore, I had to update the third-party library, do a Clean and Build, and it now builds successfully.

Static library not working in objective c. How to make it?

ld: warning: ignoring file
/Users/srm-mac10/Downloads/ICodeBlogStaticLibrarySample/MathTest/Classes/iCodeBlogsMathLibrary/libICodeMathUtils.a,
missing required architecture i386 in file Undefined symbols for
architecture i386: "_OBJC_CLASS_$_MathFunctions", referenced from:
objc-class-ref in MathTestAppDelegate.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit
code 1 (use -v to see invocation)
Following error coming while i am trying to make a static library in objective C. Any idea ??
Please help me.
The iOS simulator runs natively on the system's CPU, which is an x86 architecture. Hence your code needs to be built for x86 (which is presumably working already) and any libraries you link to also need to be built for x86.
If this is a static library that someone else has supplied to you (perhaps you purchased it?) then you will need to request the x86 version as well and link against that.
If you are building the static library yourself, check the build settings for that project (I'm assuming it's a separate project) and make sure it's configured to be compilable for the simulator. Then explicitly build the library for the simulator.
(I've run into some weird issues with static libraries where Xcode 4.x fails to automatically build the correct library architecture, necessitating an explicit manual build.)
I think you have to set the flag "-all_load" in the "other linker flags" in your project build settings

iHasApp.a framework is not detected by compiler

How to add the framework iHasApp.a framework into my Application bundle framework or framework.I tried to add through bundle phases and add files, but still i am getting the following errors.
Undefined symbols for architecture i386:
_OBJC_CLASS_$_iHasApp, referenced from:
objc-class-ref in RootViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
And I am not able to add this framework.
Author of iHasApp here. From your description, you are using the static library from http://amitay.us/ihasapp/index.php
As Armaan asked, are you trying to run it on the Simulator? As per the warning on the website, iHasApp was not compiled to run on the Simulator. The warning you are receiving indicates that symbols are not being found for the i386 architecture, namely the iOS Simulator.
You will only be able to compile that project on an actual device.
The following is not meant as an advertisement: iHasApp is now being maintained as a new, more comprehensive software as a service at https://www.iHasApp.com. It is currently in the late stages of beta. If you would like to participate, then sign up for an account and email me at daniel#ihasapp.com. This newer framework will run on the Simulator (although it is somewhat pointless).