iOS Question iOS Library missing arm64 architecture

sgt

Member
Licensed User
Longtime User
Hi

I am trying to build a B4i Library to use Google MLVision Libraries. I have created a static library in Xcode and compiled it and used cocoapods to get the google dependency frameworks. If comment out all MLVision related code and recompile it and add it to my local build server I can call methods from B4i without any issues. If run the 'lipo' command against the library it prints out 'Architectures in the fat file: libGoogleVision.a are: arm7 arm64'

However once I un-comment any MLVision related lines I get the following error in B4i compiling a project referencing the library.

Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_FIRVision", referenced from:
objc-class-ref in libGoogleVision.a(GoogleVision.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It seems to be an issue with the Google Framework dependency but I have run out of ideas to resolve this. The objc line that causing the error is creating a 'FIRVision' object
Any help appreciated.
 
Last edited:

sgt

Member
Licensed User
Longtime User
I went through and double checked the library with lipo to make sure, I also checked all the google libraries that the pod file installs and builds with lipo as well and they all say armv7 arm64. It did compile for 32bit but it didn't install on my iphone 8 just seem to hang.

Should I be able to open the B4iProject.xcodeproj file the Build Server creates and compile that with xcode when the project does compile and when it doesn't. Is this a mismatch of the iOS min versions of the library/pod file dependencies and the B4i project.

Thanks for your reply
 
Upvote 0

sgt

Member
Licensed User
Longtime User
Update to this I have tried both the ML Vision and the older Mobile Vision libraries with the same results. The Xcode project for the libraries I create compile ok with either the Vision frameworks or the library files *.a. But once the libraries have code relating the Vision libraries I receive the error 'Undefined symbols for architecture arm64' when compiling a project in B4i. Lipo command shows all libraries are fat libraries with both armv7 and arm64. Please see the Xcode image to see whats being called and the B4i Compile error image.
 

Attachments

  • Xcode.png
    Xcode.png
    216.1 KB · Views: 324
  • CompileError.png
    CompileError.png
    52.8 KB · Views: 411
Upvote 0

sgt

Member
Licensed User
Longtime User
Ok Thanks

Here is the Xcode project. It is fairly simple just need run the 'pod install' to get the google libraries as they are too large to include in the zip file. The xml file I was using in B4i is in the root. Compile the Xcode project and you will see all the libraries are fat libraries and just reference the library in B4i in a empty project and then try building. I expect the error is some thing else other than architecture error being reported.
 

Attachments

  • MobileVision.zip
    71.2 KB · Views: 287
Upvote 0

sgt

Member
Licensed User
Longtime User
I have updated the files on OneDrive
https://tytechnz-my.sharepoint.com/...JPuYY2KZ2cy88BBYL3TrwSr0viaVQH8kYZIA?e=mjbZh5 to the correct version that contains libGoogleVision.a in the folder 'Libs Release Files'. All the frameworks has been copied over to the root of the Libs directory of my local build server.

I have also declared all the dependson references in the GoogleVision.h file and re did the GoogleVision.xml file. This has resolve the compile error and the B4i projects do now compile and install but they crash at startup straight away with out any log entries. I have attached the crash report from the device which is complaining about a framework not being found, but this framework is one included in the .h file. Is copying the frameworks to the Libs directory enough or is there some else I am missing.

There is a bundle file, does this just go in the B4i projects Files/Special folder along with any resource files
 

Attachments

  • Crash Dump.txt
    2.6 KB · Views: 353
Last edited:
Upvote 0

sgt

Member
Licensed User
Longtime User
Please see attached GoogleVision.h file
 

Attachments

  • GoogleVision.h.txt
    1 KB · Views: 338
Upvote 0

sgt

Member
Licensed User
Longtime User
I have been trying to see why its crash so the device logs show this which is one of the frameworks.

dependent dylib '@rpath/GoogleAPIClientForREST.framework/GoogleAPIClientForREST' not found for '/private/var/containers/Bundle/Application/3D0602D7-1EE0-4627-8B40-16220E1FACD3/B4i Example.app/B4i Example', tried but didn't find: '/private/var/containers/Bundle/Application/3D0602D7-1EE0-4627-8B40-16220E1FACD3/B4i Example.app/Frameworks/GoogleAPIClientForREST.framework/GoogleAPIClientForREST' '@rpath/GoogleAPIClientForREST.framework/GoogleAPIClientForREST' '/System/Library/Frameworks/GoogleAPIClientForREST.framework/GoogleAPIClientForREST'

If open the Xcode project the 'Frameworks, Libraries and Embedded' under Target -> General show all the frameworks but the are all saying 'Do Not Embed' how can I change this to 'Embed Without Signing'
 
Upvote 0

sgt

Member
Licensed User
Longtime User
Thanks for all your help Erel

Managed to get the library wrapper working for Google ML Vision Text Recognition. I will upload it once I have finished the project I am working on as the code is quite simple. But here are some things to look out for, for any one looking to build B4i wrappers with google ML Vision Libraries.

I used cocoapods with a pod file to get all the libraries for google vision libraries, there was a lot of dependencies and the 'pod install' command you use to integrate these libraries into your ObjC project modifies your project settings. The issue of framework not installing on the device turned out to be that not all of the google frameworks / dependencies where set as static libraries some where set as dynamic. Turns out only Apple creates dynamic libraries...
 
Upvote 0

b4x-de

Active Member
Licensed User
Longtime User
Hi sgt,

have you finish your Google ML Vision library for B4i? I would be interested in using it as a starting point and extend it for qr code recognition.

Thanks,
Thomas
 
Upvote 0

sgt

Member
Licensed User
Longtime User
Hi sgt,

have you finish your Google ML Vision library for B4i? I would be interested in using it as a starting point and extend it for qr code recognition.

Thanks,
Thomas
Hi Thomas

Yes I did finish it. It took some time to get the Xcode project settings correct. I am happy to give you the code but its a year or so old and it will have to update it as XCode and iOS has changed a few times since then. The biggest issue is getting the environment correct with all the dependencies, the Google Libraries. If you are just wanting QR Code recognition then you can do that with the iBarcode Library.

Let me know if you still want the code and update it so it complies on the latest Xcode


Stewart
 
Upvote 0
Top