I'm trying to build a Cocoa Touch Framework for iOS8 which will eventually be embedded in apps and submitted to the App store so it's important that the release build contains ONLY armv7 but the debug build must run in the simulator too. As such, I've been following this tutorial and I'm hitting upon a runtime error when trying to run an application in the simulator with the framework embedded:
dyld: Library not loaded: #rpath/TestFramework.framework/TestFramework
Referenced from: /Users/jay/Library/Developer/CoreSimulator/Devices/97715157-EABB-4F38-8CA0-62768358DDD6/data/Containers/Bundle/Application/4856FC75-6C5B-4F7E-91A9-70CA1863D130/Test.app/TestFramework
Reason: no suitable image found. Did find: /Users/jay/Library/Developer/CoreSimulator/Devices/97715157-EABB-4F38-8CA0-62768358DDD6/data/Containers/Bundle/Application/4856FC75-6C5B-4F7E-91A9-70CA1863D130/Test.app/Frameworks/TestFramework.framework/TestFramework: mach-o, but wrong architecture
However, when I browse to the framework binary it's complaining about
(/Users/jay/Library/Developer/CoreSimulator/Devices/97715157-EABB-4F38-8CA0-62768358DDD6/data/Containers/Bundle/Application/4856FC75-6C5B-4F7E-91A9-70CA1863D130/Test.app/)
and run xcrun lipo -info TestFramework I get the output Non-fat file: TestFramework is architecture: i386 so I'm kinda lost at where to go now. It runs fine on an actual iOS device.
Based on the question and your comments, the most likely cause of this is that you are building your framework for 32bit and linking it into a 64bit application. If that's not the case, please provide the entire text of your crash log.
You should build your framework 4way-fat:
i386/iphonesimulator
x86_64/iphonesimulator
armv7/iphoneos
arm64/iphoneos
In order to make it 4-way fat, you'll need to manually lipo-together your i386/x86_64 sim build with your armv7/arm64 device build. Building 4-way fat with two different (from Xcode's perspective) platforms is not supported by Xcode.
New in Xcode 11: You can use an xcframework to support these kinds of scenarios! No more lipo hacks required. You can find the details in WWDC 2019 Session 416
In my case, I was using a custom framework containing views that I use in the Interface Builder and I got this error on the Interface Builder build phase.
Running pod install fixed it.
Related
Having trouble building HERE SDK for iOS (Premium 3.19) for an ios-arm64-simulator. The error produced by Xcode 13 on an M1 pro processor is:
ld: building for iOS Simulator, but linking in dylib built for iOS, file 'Pods/HEREMaps/framework/NMAKit.xcframework/ios-arm64/NMAKit.framework/NMAKit'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
After some research and testing it looks like HERE SDK's XCFramework folder as well as the Cocoapod configuration only include ios-arm64 and ios-x86_64-simulator. It looks like the podspec is attempting to fix this by overriding the target app's iOS simulator excluded architectures (adding excluded architecture "arm64"). This likely works fine in cases where only Cocoapod sourced libraries that include x86_64 are used in the target app. However, it's a problem when using libraries from other sources where there is no roll back option to x86_64 simulators (e.g. Swift Package Manager).
Is there a way to use lipo to generate ios-arm64-simulator from the two existing framework builds? Or is this something where ios-arm64-simulator needs to be built as another configuration from the HERE SDK source?
Let me tell you that we have already located this situation in the SDK and our team in charge of the SDK is working very hard to provide a solution to this problem in the next release of HERE SDK Premium.
I'm having trouble to build an external pre built dependency. It throws the following error:
In /Users/me/Projects/app/ThirdParty/GoodFiles/GD.framework/GD(nondga_helper.o), building for iOS, but linking in object file built for free standing, file '/Users/me/Projects/app/ThirdParty/GoodFiles/GD.framework/GD' for architecture arm64
One of the questions that really bothers me is that I don't have a real idea what "free standing" really means. I thought it had to do with being a fat binary, but after running lipo -thin arm64 GD -o GD (and verifying with -info that it really worked) in one of my build scripts I'm still seeing the same problem.
I also tried to exclude arm64 from the simulator and x86_64 from iOS builds in Excluded Architectures as mentioned elsewhere, but that didn't work either.
Removed the Xcode 12 reason. This already doesn't compile anymore in Xcode 11.
Hi there are new BB certification files you have to add along with the usual GD.Framework files. These are documented on Blackberry website
New Xcode build system
GD.framework
BlackBerryCerticom.xcframework
BlackBerryCerticomSBGSE.xcframework
Legacy Xcode build system
GD.framework
BlackBerryCerticom.framework
BlackBerryCerticomSBGSE.framework
https://docs.blackberry.com/en/development-tools/blackberry-dynamics-sdk-ios/8_1/blackberry-dynamics-sdk-ios-devguide/Steps-to-get-started-And-iOS/rqx1490022241984/Prepare-an-app-to-use-the-static-framework
Check:
Xcode > Preferences > Locations > Command Line Tools
In my case it was set to Xcode 12 after installing Xcode 12. There is NO Xcode 12 proof solution until mid December.
I have a Unity project which I have successfully built for Android without issue. When trying to build for iOS I am encountering an issue once the project is in Xcode.
Unity compiles without any errors and creates an Xcode project.
Upon opening the Xcode project I have NO simulators available. I can get these simulators by selecting ios in the Supported Platforms section, at which point simulators become available - originally Supported Platforms is set to iphoneos. This seems extremely odd behaviour to me, and suggests something larger going wrong.
After getting a simulator to select I get the following error when trying to compile/run/build:
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The full error is available on Pastebin (too large to post directly on here):
https://pastebin.com/3fYR8fE3
I'm really at a loss on what I can do. I have tried a number of things, including:
Building from Unity as Debug and Release
Building from Unity with 'Symlink Unity Libraries' on and off
Building from Unity with .Net 3.5 and .Net 4.* flavours
Manually adding the libiconv.2.dylib file in the linked frameworks tab as the .tbd equivalent
Setting the target minimum version of iOS to 9.0 (negates the need for libiconv.2.dylib entirely)
I am using latest versions of everything:
Unity 2018.2.17f1
Xcode 10.1
It seems like you have the library il2cpp built for another architecture, have you tried to change your target's "Build Settings > Build Active Architectures Only" to "No"?
However I made some researches and it seems that Unity for iPhone doesn't deploy on simulator. It only works on device or in the Unity editor. Check this link out
I have 3 projects:
my custom developed framework 'XXX.framework' (that have dependency on 3rd party 'YYY.framework'). Both frameworks have different versions for real devices and for simulator, thus they differ by arch they build for
2 demo apps in Objc-C 'DemoObjC.app' and Swift 'DemoSw.app' that use my 'XXX.framework'.
I linked my custom 'XXX.framework' to those 2 demo apps which separately build and run normally.
But when I embed 3 projects into workspace to work on all of the projects at same time in one window, I face with strange behaviour. Sometimes I can't run apps on device or simulator. By that I mean sometimes it builds and runs normally, but then without any changes it fails. Or it can run normally for simulator but not for real device, but after XCode relaunch it might happen that it already can run for device but not for Simulator.
I tried to clean project, delete DerivedData, relaunch XCode, and reboot, but it helps only for several successful runs, after that I still get unexpected behavior.
For example, in workspace I try to run 'DemoObjC.app' on device and I get
ld: warning: ignoring file /Path_Here/SIMULATOR/YYY.framework/YYY,
missing required architecture arm64 in file /Path_Here/SIMULATOR/YYY.framework/YYY, (2 slices)
Undefined symbols for architecture arm64:
<List of files that can't be find>
I can't understand why it fails on SIMULATOR when I run it on device? Project and target are seems to be configured fine because separate projects build and run normally.
Or here is error when I try to run on simulator:
ignoring file /Path_Here/NOT_A_SIMULATOR/YYY.framework/YYY,
missing required architecture x86_64 in file /Path_Here/NOT_A_SIMULATOR/YYY.framework/YYY (2 slices)
Undefined symbols for architecture x86_64:
Same issues in XCode 8.2 and 8.2.1
Any glues what is wrong? I lean toward that it is XCode related issue.
I have created a custom Objective-C framework. I would like to import it into any given iOS project and use its provided functionality on both the iOS Simulator and an actual device. To import the framework, I link it using the Build Phases > Link Binary With Libraries setting in the app's target. I'm then able to import it into one of my classes with this statement:
#import <CustomFramework/CustomFramework.h>
I can instantiate my framework's classes just fine, but when I try to run my project on a device, I get the following error message:
dyld: Library not loaded: #rpath/CustomFramework.framework/CustomFramework
Referenced from: /var/mobile/Applications/A61E882D-481A-4C0B-B4FD-69F5D24968BF/TestApp.app/TestApp
Reason: image not found
And if I try to run it on the simulator, I get a different error message:
ld: warning: ignoring file /Users/user/Desktop/CustomFramework.framework/CustomFramework, missing required architecture i386 in file /Users/user/Desktop/CustomFramework.framework/CustomFramework (2 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CustomFramework", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This occurs when I instantiate a class from the framework. If I import the framework but don't actually use it, my app builds successfully. It just errors whenever I instantiate a class from the framework for some reason.
To get the app to build on a device, I followed this SO answer. Instead of linking the framework, I added a new Copy Files phase in the target's Build Phases setting, set the Destination to Framework, and added my framework.
That works great; however, I'd like to test my app on the iOS Simulator as well. When I try to run my app on the simulator, I still get the "missing required architecture i386" error. I've tried the solutions proposed at just about every related SO topic I could find, and nothing has helped me resolve this issue.
Please note that I am trying to use my custom framework in a new Xcode project, so none of the app/build settings have been changed from their defaults.
How can I fix this error so that I can run my app on both the iOS Simulator and a device with my framework included in the project? Any insight would be greatly appreciated!
The issue was that the framework was not compiled for the iOS Simulator's architecture, which is i386. Xcode only compiles a framework for the target architecture, so if I built the framework for the iOS Simulator, it wouldn't work on a device, and if I built the framework for a device, it wouldn't work on the iOS Simulator.
I created my framework from scratch with help from this tutorial: http://www.raywenderlich.com/65964/create-a-framework-for-ios
The multi-architecture build script is what allowed my framework to run on both the iOS Simulator and a device.
I encountered this same problem with Xcode 7.1 when trying to build for the simulator.
Someone else said it worked for them under Xcode 8.2.1, so I tried building/running there and it worked. I didn't have to change targets or anything in my project.
So try upgrading your Xcode if you can, you will presumably get additional bug fixes as well.