Forum Libraries, Components, and Plugins

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Xamarin.Google.iOS.GoogleCloudMessaging causes build error using ARMv7 + ARMv7s + ARM64 architecture

_albertoms_albertoms MXUniversity ✭✭

I just started to test the Google APIs Google Cloud Messaging iOS Library from NuGet and and get these errors when I finished implemented the Getting Started guide:

MTOUCH: Error MT5209: Native linking error: file is universal (4 slices) but does not contain a(n) armv7s slice: iOSApp/obj/iPhone/Debug/build-iphone5.1-9.3.2/mtouch-cache/libGTM_GTMURLBuilder_external.a file 'iOSApp/obj/iPhone/Debug/build-iphone5.1-9.3.2/mtouch-cache/libGTM_GTMURLBuilder_external.a' for architecture armv7s (MT5209) (EConduce.iOS)

iOSApp/MTOUCH: Error MT5202: Native linking failed. Please review the build log. (MT5202)

Is that an expected behaviour?

Posts

  • NickThompsonNickThompson USMember

    That error/warning is basically saying that the library is non compatible with arm7s (iPhone 4, 4s and 5) :S you can use lipo to edit the hex of the library (after splitting into slices) and modify it to state that arm7s is supported but its not an ideal method of doing things.

    Better would be for the nuget package developer to update their codebase to deal with arm7s.

    Note the following is taken from a stackoverflow post found: http://stackoverflow.com/questions/12405378/is-there-a-compiler-flag-to-indicate-lack-of-armv7s-architecture/12412222#124122

    There used to be a linker flag in GCC, allow_sub_type_mismatches, which would let you mix and match ARM architecture versions in linked libraries, but they seem to have taken that away in recent versions of Xcode.

    However, this can actually be hacked around in a different way; make a copy of the framework, view its contents, open up the actual code library file inside of it in a hex editor, and do the following replace all:

    CEFAEDFE 0C000000 09000000
    to

    CEFAEDFE 0C000000 0B000000
    What you're basically doing is changing the header inside of each code object to identify it as ARMv7s rather than an ARMv7 code - the instruction sets are backwards compatible (or seem to be, anyway), so it should run fine even with this hack, though I have to admit that we won't know that for certain until we actually get a chance to test it on an iPhone 5.

    Anyway, once you've modified the framework, simply add both versions to your project and link to the appropriate one from each architecture. You might also be able to create a new single framework by using lipo to merge the modified and original libraries.

    Thanks

    N

Sign In or Register to comment.