When I try to run my application in the iOS 4.3 simulator (Xcode 4.2), I crash when I hit #autoreleasepool{}, with:
dyld: lazy symbol binding failed: Symbol not found: _objc_autoreleasePoolPush
I looked around, and I see the workaround is to add libarclite_iphoneos.a. There's a version of this for the simulator, too, as libarclite_iphonesimulator.a.
I need to add both libraries to my project to make it run on both the simulator and hardware. But whichever I build, it complains that the other library is for an unsupported architecture.
For example, building for simulator:
ld: warning: ignoring file /Developer-4.2/Platforms/iPhoneOS.platform/
Developer/usr/lib/arc/libarclite_iphoneos.a, missing required architecture
i386 in file
How do I fix both of these simultaneously? Or should I just stick with the old NSAutoreleasePool syntax for now?
After a trials like clean, clean folder, resetting iPhone Simulator and even a restart, I changed the IPHONE_DEPLYMENT_TARGET on the target build setting down from iOS 5.0 to iOS 4.2.
Worked.
You can use the Other Linker Flags build setting to link in the library, and specialize the value based on whether it's "Any iOS" or "Any iOS Simulator".
You can also merge the two static libraries to one universal library. Go to the Terminal and say
lipo -create -output /where/you/want/it/libarclite_universal.a /Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/arc/libarclite_iphoneos.a /Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/arc/libarclite_iphonesimulator.a
You can verify the resulting file by saying (in Terminal)
file /where/you/put/it/libarclite_universal.a
It should output:
libarclite_universal.a: Mach-O universal binary with 3 architectures
libarclite_universal.a (for architecture i386):current ar archive random library
libarclite_universal.a (for architecture armv6):current ar archive random library
libarclite_universal.a (for architecture armv7):current ar archive random library
Since this lib is linked statically, your final app wont grow because of the included sim library since only whatever is needed by your app will get linked into your final app.
Related
I m trying to add Firebase Analytic and Firebase Crashlytics using Swift package manager here is a link of git for firebase SDK
https://github.com/firebase/firebase-ios-sdk
after that I add this two line in my AppDelegate file
#import <FirebaseCore/FIRApp.h>
#import <Firebase.h>
All fine until when I add this [FIRApp configure]; getting error
Undefined symbols for architecture arm64:
"OBJC_CLASS$_FIRApp", referenced from:
objc-class-ref in HWOFAppDelegate.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I go thought every link of stack-overflow for similar problem try every solution but nothing help me like change Other Linker Flag etc...
Please help me..I really appreciate...I m using Xcode 12.1 with Objective-C
here is a screenshot of error which i m getting
And screenshot of added dependency
After so much searched I solved issue. Solution is
"$(inherited)" In Other Linker Flags
Build Active Architecture Only value to "Yes"
Add Run Script for firebase SPM is "${BUILD_DIR%Build/*}SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run"
Clean project
Build Project
I got the same issue while integrating MLKit in my recent work. The app was running fine on simulator as well as device but when I tried to archive the build it started throwing me error below-:
Undefined symbol: _OBJC_CLASS_$_MLKFaceDetector
I am using the MLKFaceDetector object in my files.
Resolution:-
Go to Build Settings -> Architectures -> Replace standard architectures with arm64. Also, make sure there is no space between arm & 64.
Reason what I understood is MLKit only supports 64 bit not 32 bit and since we are using standard architectures targeting both 32 and 64 bit, so Xcode while archiving for 32 bit is unable to find MLKit files. So we are explicitly saying Xcode to Archive only for 64 bit and not 32 bit.
Cons - It will not support some of the older iOS devices.
Finally I found the solution for this
For me changing ios deployment target to higher version than before workd.Mine was 9.0 I changed it to 13 .
Target-general- deployment info
Can try this it Will help,
Change Linking -> Mach-O Type to Dynamic Library, for the frameworks you used, then it works fine.
I am trying to add the Honeywell Captuvo iOS library to my CodenameOne project as a native library. I have been through the "Generate Native Access" process and placed the .a library in the native/ios directory. However when I send the app to be built it comes back with the error:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_EAAccessoryManager", referenced from:
objc-class-ref in libCaptuvoSDK.a(CaptuvoReal.o)
Many thanks
Rereading the error message it seems I missed a key detail. You need to add the ExternalAccessory.framework to your project. To do this you need to define the build hint: ios.add_libs=ExternalAccessory.framework
Original answer below:
Is the name of the .a library preceded with the lower case word lib and does it actually end with a .a. If not make sure to rename it so it abides by these constraints.
Assuming both are OK you will need to verify the library actually has the required architecture in this case arm64.
This is explained in this question: How to check if a static library is built for 64-bit?
I would just use the second suggestion: file libFileName.a
It should include arm64 among the list of supported architectures.
I've done hours and hours of searching and still no luck (read a lot of stackoverflow as well).
I am trying to implement FDTake via Cocoapods. When I try and run it I get the following:
undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_FDTakeController", referenced from:
objc-class-ref in VendeViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I know there is many similar questions around SO but all their solutions don't seem to work for me.
From the logs I can assume that you would be using a static library which is not build for simulator(architecture x86_64).
The library is only compiled for device and it needs to be complied and build for simulator also. Then the two static files (one abc.a for device and one abc.a for simulator) needs to be fat file i.e these files should be merged together using lipo command on terminal to create a fat file. Now when you use this fat file it will work both for simulator as well as device.
But the important thing is that you should have the source to compile and build the static libraries for simulator and device. After which you merge these to create a fat file which will work on all the defined architectures.
In case you are using third party static library (SDK) then you need to contact the respected party.
I am trying to archive an iOS 7 App that is using BBHTTP-library which includes libCurl. The built-error:
curl_rule_01 declared as an array with negative size
The code-line in curlrules.h with the error:
[CurlchkszEQ(long, CURL_SIZEOF_LONG)];
I've tried it with these changes in curlbuild.h
#define CURL_SIZEOF_LONG 4
to
#define CURL_SIZEOF_LONG 8`
due to 64 bit, but it didn't change anything.
Be careful: you must NOT change these macros inside curlbuild.h! This header is generated at configure time and it records (among other things) which architecture is targeted.
If you look at the pre-built static library provided by BBHTTP you can see that it only targets ARMv7 and ARMv7s architectures:
$ otool -fV External/libcurl.iOS/libcurl.iOS.appstore.a | grep Archive
Archive : External/libcurl.iOS/libcurl.iOS.appstore.a (architecture armv7)
Archive : External/libcurl.iOS/libcurl.iOS.appstore.a (architecture armv7s)
These are 32-bit architectures. Please refer to BBHTTP Dependencies for more details regarding how this static library has been compiled.
If you build an iOS app with iOS 7 as deployment target you certainly have the default archs configured within your build settings. And these defaults include a 32-bit slice, plus a 64-bit slice:
So in such a case you must include a libcurl fat static library that also contains a 64-bit slice (a.k.a arm64).
The curl iOS build scripts from BBHTTP's author might help you. Otherwise please refer to Nick Zitzmann libcurl pre-built.
I am trying to compile a project for iOS 6 in XCode, and I am using the following headers, which include the functionality I need:
#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */
#include "transupp.h" /* Support routines for jpegtran */
Those are straight out of jpegtran utility sources. I have installed the jpeg library before, and there is libjpeg.a in my /usr/local/lib/.
However when I try to compile, I am getting an error "Undefined symbols for architecture i386" or "Undefined symbols for architecture armv7", depending on whether target is an iPhone simulator or not.
Here are the keywords it can't find symbols for:
"_jpeg_stdio_src"
"_jpeg_finish_compress"
"_jcopy_markers_execute"
"_jpeg_copy_critical_parameters"
"_jtransform_adjust_parameters"
"_jpeg_destroy_compress"
"_jtransform_execute_transform"
"_jpeg_finish_decompress"
"_jpeg_read_header"
"_jtransform_request_workspace"
"_jpeg_write_coefficients"
"_jpeg_read_coefficients"
"_jpeg_destroy_decompress"
"_jpeg_stdio_dest"
"_jcopy_markers_setup"
I have encountered the missing symbol errors before, and always ended giving up on using 3rd party libraries, but in that particular case there's no way around.
What am I doing wrong here?
EDIT: I have added libjpeg.a to project settings and it did go further, but stopped now at:
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: i386-apple-darwin12.2.0
Thread model: posix
"lots-of-debug-paths"
ld: library not found for -ljpeg
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I recently needed libjpeg for iOS too (as a dependency of another third party library)
I ended up simply using the libjpeg-turbo, which comes with a precompiled fat binary
Architectures in the fat file: libjpeg.dylib are: i386 x86_64 armv6 armv7 armv7s arm64
I dunno how you compiled it. But you need to change the make install in order to compile it in i386 and armv7. I'm pretty sure you just run the make, so it compiled it for you mac, which is certainly a x84_64 arch, and this is certainly not what you want
You can check with
lipo -info /usr/local/lib/libjpeg.a // if libjpeg.a is at this path
or
file /usr/local/lib/libjpeg.a