I'am finalising an Open Source C coded CometD library, I thought it would be a good idea to open it to OSX/iOS users, like myself.
In order to ease up the work for OSX/iOS developers I wanted to switch from a static C library to a Xcode iOS Static Libary. So I have followed advices found on the net, and generated a static iOS compatible library.
The problem is that, each time when I am trying to use it, I get an error of type :
Undefined symbols for architecture x86_64: ******, referenced from: -********** in *******.a(*******.o)
This error get repeated for almost every C function that I have in my library.
First I thought maybe the library is not x86_64 compatible
, empty, or really doesn't have any x86_64 symbol in it.
So I have checked with a "lipo -info" on the library and here is the answer :
To really be sure i also used "nm -arch x86_64" on the library, and went fetching for several undefined functions reported by Xcode as errors. I thought i will be wrong and find nothing but guess what ?
I found the symbols :
So my question is :
If the symbols are present in a x86_64 compatible library, why Xcode prompting this error ? Even if I compiling the library for all arm*/s types I am still getting this x86_64 error.
Am I unaware of something or am I just doing it wrong ?
Your answers are always appreciated.
Update (This is the link to the Xcode Project) : https://github.com/GhostGumm/CometD-x86_64-issue
Update 2 : Mr Trojanfoe attracted my attention on a linking Warning I had when compiling. Indeed the linker seemed to miss load the library looking for a directory that doesn't existed. After moving the library to the right directory, linking it manually, the x86_64 error disappeared.
Sadly the problem is still present. Just after a successful compilation, i tried to use the lib , but, when I "alloc" and "init" my main class like so :
ZetaFactory *Client = [[ZetaFactory alloc] init];
The x86_64 error comes back roaring with the genuine fierce of a billion suns. I posted the link to the Xcode project, please feel free to test it as i don't have any more ideas on how to fix it, but more importantly why and where this gets buggy.
None the less I will continue to investigate.
The error Undefined symbols for architecture arm64: "_OBJC_CLASS_$_SKAdImpression" during the iOS build usually happens if XCode or CocoaPods version is lower than required. To fix it update XCode to 12.5 or higher and CocoaPods to 1.10. 0 or higher.
Why Is the Undefined Symbols for Architecture x86_64: Error Happening? This error is happening due to the lack of included values inside the declared statements in your code. The browser is going to render the information incorrectly and show this error, especially if you are working with Main and Similarity tools.
Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_xxx", referenced from: objc-class-ref in yyy.o. This generally means, you are calling "xxx" (it may be a framework or class) from the class "yyy". The compiler can not locate the "xxx" so this error occurs.
A symbol remains undefined when a symbol reference in a relocatable object is never matched to a symbol definition. Similarly, if a shared object is used to create a dynamic executable and leaves an unresolved symbol definition, an undefined symbol error results.
I downloaded and tried to build your project. Looking at the link errors - init_stack_remove_data not found, for example - they're correct. There is no definition of init_stack_remove_data anywhere in your project source.
In the "nm -arch x86_64" output that you cite above, please note that the "U" before a function definition indicates a use of that function, not a definition of it. The nm output is showing that the linker is correct - those functions are called by your code, but are never defined. When they're defined, you'll see a "T" before the function in the nm output.
You need to update your project with the rest of the necessary source before it'll link without errors.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With