No suitable image found for iPhone5's architecture - ios

I'm using Xcode6.4 and Cocoapods 0.38.2.
When I use Alamofire through Cocoapods, some strage error happens.
When I use iPhone6(iOS8.4), everything is fine. I can compile and use Alamofire.
But when I use iPhone5(iOS8.4), even if I can compile without errors, I get errors like below.
dyld: Library not loaded: #rpath/Alamofire.framework/Alamofire
Referenced from: /private/var/mobile/Containers/Bundle/Application/AA92A24D-B208-46E8-8C08-1532116C9C64/knews.app/knews
Reason: no suitable image found. Did find:
/private/var/mobile/Containers/Bundle/Application/AA92A24D-B208-46E8-8C08-1532116C9C64/knews.app/Frameworks/Alamofire.framework/Alamofire: mach-o, but wrong architecture
/private/var/mobile/Containers/Bundle/Application/AA92A24D-B208-46E8-8C08-1532116C9C64/knews.app/Frameworks/Alamofire.framework/Alamofire: mach-o, but wrong architecture
/private/var/mobile/Containers/Bundle/Application/AA92A24D-B208-46E8-8C08-1532116C9C64/knews.app/Frameworks/Alamofire.framework/Alamofire: mach-o, but wrong architecture
I don't know exactly when this problem happens, but I could use cocoapods and Amamofire with iPhone5 a while ago.
Please help.
Actually I even don't know what kind of information I should put here.
Thanks,

I created new Xcode project and copied all files.
( and made configuration files same as old one as much as possible)
And I can compile and run my app both on iPhone6 and iPhone5.
So I don't know the reason. But now my problem is solved.

As mentioned here, I Embedded all frameworks generated by Cocoapods, and I finally could run my app on iPhone5.
But when I tried to upload binary to submit to Apple, I was required 64bit binary and I could not upload my binary.

Related

Mach-O Linker error, undefined symbols for architecture after upgrading xcode to 8.0

I have upgraded to XCode 8.0 and it is giving me grief. The first issue was to do with code signing. Which I fixed by selecting a provisioning profile for debug and release from the General project settings. Weird not sure why it couldn't just work as it was compiling perfectly with the previous XCode. Previously XCode would say there is not provisional profile and prompt to fix it and would fix it. Seems a step back here. Anyways, went passed that issue.
The issue I have been facing all day is this error when I compile
Undefined symbols for architecture arm64:
"_write_ret", referenced from:
_dwsl in libtestlib.a(testlib.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I searched for write_ret and it is only a prototype in a header file, this function isn't called anywhere at all!! (Background the static library is part of a bigger project I brought only the files/code I needed to compile the static library for iOS). This was compiling perfectly before for years. I went back to the static libary source code and to humour myself I deleted the write_ret prototype and compiled it and updated the library in the my project and rebuilt. Same error again!. What is going on here?? I confirmed it was definitely using the correct built library.
I then decided I'll just built for armv7 only as this is an enterprise app. I went back to the static library project file and got rid of armv7s and arm64 from "valid architectures". I change "architectures" to armv7. I rebuilt the library and updated the project with the new library.
I also went into the main project and change the valid architectures to build for only armv7.
This time when I built my project I get this error
ld: warning: ignoring file /Users/rrr/Library/Developer/Xcode/DerivedData/P-eaxegvaceikvgqgllfiardmoorbv/Build/Products/Debug-iphoneos/libtestlib.a,
file was built for archive which is not the architecture being linked (armv7):
/Users/rrr/Library/Developer/Xcode/DerivedData/P-eaxegvaceikvgqgllfiardmoorbv/Build/Products/Debug-iphoneos/libtestlib.a
In the terminal I ran lipo libtestlib.a -info I get this:
input file libtestlib.a is not a fat file
Non-fat file: libtestlib.a is architecture: armv7
So it is built for armv7, so what is XCode complaining about really?
I am out of ideas now. Can anyone shed some light here?
I would like to get it to work with all the architectures as it was doing before the XCode upgrade I did on Friday. But worst case atleast compile to work only for armv7. My understanding is that it will still run on anything iPhone 5s and newer anyway.
At first, As you already know, you should support arm64 in order to support 64 bit architecture following Apple's rule.
At second, let's talk about undefined symbol issue, your first question.
I am not sure exactly from your situation description but, one thing to my mind reading the question is that your static library may depend on some dylib(dynamic or shared library) which is deprecated from Xcode 7.The possible scenario is your dylib library was red-marked in the project from Xcode 8 update version because this was replaced with tbd instead of dylib. So, this library is now missing status, and you did remove it in the library list and you forgot it. That's why your _write_ret symbol in libtestlib.a cannot be linked for architecture arm64 anymore.(dylib is missing status.)
if this scenario is true, import tbd instead of dylib.(text-based stub libraries).
let's talk about your second question related to error log.
ld: warning: ignoring file /Users/rrr/Library/Developer/Xcode/DerivedData/P- eaxegvaceikvgqgllfiardmoorbv/Build/Products/Debug-iphoneos/libtestlib.a,
file was built for archive which is not the architecture being linked (armv7):
/Users/rrr/Library/Developer/Xcode/DerivedData/P- eaxegvaceikvgqgllfiardmoorbv/Build/Products/Debug-iphoneos/libtestlib.a
This log can be about Build Active Architecture Only in Xcode build setting.
check 'Build Active Architecture Only' from Yes to No.
It error log could be generated when Build Active Architecture Only is set to YES in your build setting situation.
and, if it does not work, Have you ever clean your DerivedData directory and project?
If you already tried, it could be possible that your static library is actually not in the /Users/rrr/Library/Developer/Xcode/DerivedData/P-eaxegvaceikvgqgllfiardmoorbv/Build/Products/Debug-iphoneos/libtestlib.a.
so, you can move your static library output into this project and try it again.
These are just scenario for your situation as I got your question.
I wish it became a little help.
Thanks.

Using pre compiled dylib in iOS8+ or building dynamic framework out of dylibs?

I'm trying to use a fat dylib I've made that contains the latest version of tbb with code for all architectures I may be targetting (armv7, arm64, i386 and x86_x64)
Since iOS8 using dylib(s) is meant to be possible, in fact one of the error messages I found googling was the following one:
ld: embedded dylibs/frameworks are only supported on iOS 8.0 and later
Which seems to suggest that embedding dylibs is actually possible and we aren't only restricted to the new so called dynamic frameworks, yet, when I try to run my project I get the following:
dyld: Library not loaded: #rpath/libtbb.dylib
Referenced from: /Users/user/Library/Developer/CoreSimulator/Devices/B4DCFF3E-10B2-4C01-953F-BD26D14300E7/data/Containers/Bundle/Application/8C84A844-97FC-4993-A37E-A456C4E2240F/TestTBB.app/TestTBB
Reason: image not found
I thought it would be due to the dylib not being automagically copied into the app being built so I added it to the "Copy Bundle Resources" section in the projects "Build Phases" and I've since made sure that the libtbb.dylib is in fact being copied into the app and yet I keep getting the message saying that it can't be loaded.
I've tried using the "Embedded Binaries" section under "General" but it seems to be restricted to using only the new framework types.
Is there anything I might be missing?
As you may have noticed I'm trying to use TBB which comes with its own build makefiles that generates dylibs, I'm assuming that if it does it's because dylibs can be used, legally since the iOS8+ update.
I have seen ways of getting dylibs to load, but these aren't the ones that Apple would accept in their AppStore, I'm trying to do this for an app that is currently on the AppStore and I have no plans of getting it removed or not accepted after an update so I'd like to go with whatever the new "legal" way is to get dylibs loaded. My app is targetting iOS9.2+ since the latest update so this shouldn't be an issue.
All I can find are ways to get dynamic frameworks loaded but no info about actual dylibs even though the error message clearly states that they could be used.
Alternatively, is there a way to build a dynamic framework out of existing dylib files?
Thanks in advance.

xcode simultor - library not found for

I'm trying to run my ios project on the simulator but I'm told that:
ld: library not found for -lPods-.....
This is not happening if I run it on my device.
I tried looking into the search paths in my Pods project, but I didn't see anything suspicious... Maybe i'm not looking for the right thing.
Can anyone help me by telling me what should I look for?
Thanks
Ok,
I went to the Pods project file and saw that "Build Active Architecture Only" is set to Yes on debug but set to No on release... I just set it to No on both and it works...
That means that there is no libPods-....dylib in the library search path that you passed to the linker. I can't be more specific because you omitted the rest of the library name in your question. You should make sure that your library search paths are correctly pointing to where you have the iOS Simulator version of your library.

dyld issues library not loaded

When I have tried to build my target I get this error with dynamic linker:
dyld: Library not loaded: #rpath/iPhoneSimulatorRemoteClient.framework/Versions/A/iPhoneSimulatorRemoteClient
I use this iphonesim library link that referenced on path as above.
I use Xcode 4.3 and in this case I think the path wrong.
How to change this path to correct path?
I have download this library again and recompile it.
I think this is related due XCode 4.3 have another path for framework.
Please check this link link

ignoring file ../Test/build/Debug-iphoneos/libTest.a, missing required architecture i386 in file

I have created static library and it's working fine for device but giving warning
"ignoring file ../Test/build/Debug-iphoneos/libTest.a, missing required architecture i386 in file" if I try to deploy it on simulator and hence gives error for all references of that library.
I have read about this error on SOF but not got any workaround for this. I have followed this link to create and use static library.
http://blog.carbonfive.com/2011/04/04/using-open-source-static-libraries-in-xcode-4/
So please give solution for this.
Thanks in adv.
These can be quite the pain in the ass. The long and the short of it is that you need to add i386 to your architecture for your static library and rebuild it. If you are using Xcode 4, your problems get compounded even further because your library doesn't build into one nice neat little libMy.a file. You end up with 4 different files depending on your setup.
You can read this answer on Build fat static library for Simulator and Device. This helped me out more than you can imagine.
If you get that far, don't forget about your headers and linker flags. Using static libraries can be great, but they can also be a pain. Hope this helps a little.

Resources