So, I'm creating a jailbreak app and I'm trying to use libMobileGestalt.dylib in the app. I link the file correctly and add the header and call MGCopyAnswer. The problem is, I get this error:
Undefined symbols for architectures armv7: "_MGCopyAnswer", referenced from:
This error only occurs when the app is built with armv7 architecture. It doesn't occur when arm64 architecture is used. I know that this occurs due to the dylib being built with the arm64 architecture, but I really want it to work with the armv7 architecture so that the app would be compatible with a larger range of devices.
Is there a place from which I can obtain the armv7 architecture version of the dylib, or be able to build it again with that architecture included? Is there any solution to this that anyone knows? Thank you for helping in advance.
you have to import libMobileGestalt
under target
then Build Phases
and Link Binary With Libraries
then added new Binary
when you see search field
type " libMobileGestalt.dylib "
and then Add
I found out the solution. The reason I was getting an error was that I was linking that dylib to a static library I was creating, which isn't possible, so I had to also link this dylib to all the projects I created that use the static library (which in turn uses the dynamic library). Hope this makes sense :P And thank you all for trying to help :)
Related
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.
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.
So I just recently updated Xcode to 4.5 and was able to get my hands on a iOS6 phone. I was doing testing on the simulators fine (4.3/5.1/6.0) but when i decided to build on the actual iOS 6 phone it gave me this error.
No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=armv7s, VALID_ARCHS=armv6 armv7 i386).
I did some lookup and fixed it by going into build settings to change the valid architectures to include armv7s and it did what it was suppose to do.
HOWEVER by adding that I got this error
ld: file is universal (3 slices) but does not contain a(n) armv7s slice: some static library framework for architecture armv7s
After some looking it feels to me the static library framework is causing all the problems since it doesn't support iOS 6 and I'm not too optimistic that it can be fixed easily. However since I couldn't fine my exact situation on the net I'm hoping there's someone who knows this better than me and can help me. Thanks
Note: that static library is everywhere in the code, removing it is pretty much not an option
You can try to change "Build Active Architecture Only" YES --> NO. Works well for me.
In order to build, all the static libraries an application links against must generate code for all of the application's architectures.
It looks like Xcode 4.5 has updated your project to build armv7s code, but it neglected to add armv7s to the application's active architectures.
Once you fixed that, it looks like the problem is that the static library is not producing armv7s code, but your application is trying to build for armv7s.
If that's the problem, there are two ways to fix this. Either you want your application to only generate armv7 code (removing the need for armv7s code), for which you'll need to change your application's target settings to:
... or you want your application and all linked static libraries to have build settings that look like this:
armv7 code will run on anything from the 3gs upwards. armv7s code will run on the iPhone 5 only, and will be slightly faster.
So if you have access to an iPhone 5 to test on, and you have the source code to the static library then the second option is probably best. Otherwise, assuming that your library is at least generating armv7 code, then as long as your application isn't trying to build armv7s you should also be fine.
If the library is only building armv6 code, which isn't supported by xCode 4.5, then you'll need to change its build settings to produce at least armv7 code.
Xcode 4.5 doesn't support armv6 anymore, so you need to remove this architecture.
As you already found out, the library you use doesn't seem to support armv7, which now is essential.
I think there is no alternative to compiling the library with the correct target. If you have the source code, this should be trivial; if it's third party, you depend on them to update. They will know, however, that without updating their library has reached end of life.
I has similar problem. Got it solved by changing 'Build active Architecture Only' to 'NO' in Build settings of Target Project.
Remove armv7s and add armv7 (and/or armv6)
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
When I am trying to build my application, I get this error message:
ld: Linked dylibs built for retain/release but object files built for GC-only for architecture i386
I use libssh2 library, for i386 architecture, I have no idea what the problem is!
Sorry if is a stupid question!
It's saying that some of the linked classes use retain/release patterns, but your app is being built for garbage collection only (OS X's automated retain/releases that are more efficient and easier for you). So remove your retain/releases, or turn off garbage collection for the app. Keep in mind that a third party library may be part of the problem. Let me know if you need more details!
Please check your xcode name like "xcode 5.1, Xcode 4.6" then change to "Xcode" and try to building, I have worked this
Actually the framework path is related with Xcode name. So please try this