I just marked all of my CocoaAsyncSocket code as non-ARC code, and it's given me these 3 errors:
Undefined symbols for architecture armv7:
"_kCFStreamNetworkServiceTypeVoIP", referenced from:
-[GCDAsyncSocket enableBackgroundingOnSocketWithCaveat:] in GCDAsyncSocket.o
"_kCFStreamNetworkServiceType", referenced from:
-[GCDAsyncSocket enableBackgroundingOnSocketWithCaveat:] in GCDAsyncSocket.o
"_kCFStreamPropertySSLSettings", referenced from:
-[GCDAsyncSocket maybeStartTLS] in GCDAsyncSocket.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Does anybody know what this means and how to fix it?
I think I found the solution to this, by looking in the code comments, but I now see that it's also what Mark Adams suggested above. I had the errors until I added the CFNetwork.framework under Targets->Build Phases->Link Binary With Libraries->Select CFNetwork.framework
It means that some code you are compiling is referencing the constants "kCFStreamNetworkServiceTypeVoIP", "kCFStreamNetworkServiceType", and "kCFStreamPropertySSLSettings", but that those constants weren't found when it tried to link your code with the libraries it uses.
Unfortunately there's a bunch of reasons this could be:
You could have misspelled them
They could be #ifdef'd out for that architecture
You might not be linking the correct librar(y, ies)
They could be marked as having 'hidden' visibility so that they can only be used in the declaring library
Probably other reasons
You can use 'nm' to poke at the exported symbols from the binary of a library, and 'otool -L' to check which libraries your binary is linking.
I had this same error when integrating LineaPro API into an app.
The fix i implemented was adding ExternalAccessory.framework to General -> Linked Framework and Libraries.
I already had CFNetwork.framework included.
Related
I'm getting following error after including an external framework and building the project with it. Don't know what to do. Only headers file of the external framework are available to me. All the implementation files (.m) are in a .exe file so I can't access them.
duplicate symbol _OBJC_CLASS_$_AppDelegate in:
/Users/u311107/Library/Developer/Xcode/DerivedData/ConsumerApp-awxafvfmhvwglmdvoobikahakarp/Build/Intermediates/ConsumerApp.build/Debug-iphoneos/ConsumerApp.build/Objects-normal/armv7/AppDelegate.o
/Users/u311107/Desktop/Stash/Mall/consumer/KMCSDK.framework/KMCSDK(AppDelegate.o)
duplicate symbol _OBJC_METACLASS_$_AppDelegate in:
/Users/u311107/Library/Developer/Xcode/DerivedData/ConsumerApp-awxafvfmhvwglmdvoobikahakarp/Build/Intermediates/ConsumerApp.build/Debug-iphoneos/ConsumerApp.build/Objects-normal/armv7/AppDelegate.o
/Users/u311107/Desktop/Stash/Mall/consumer/KMCSDK.framework/KMCSDK(AppDelegate.o)
ld: 2 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Please help.
Thanks.
It seems like, KMCSDK.framework has already declared an AppDelegate class, if you can not modify the source code of KMCSDK.framework and rebuild it, you should rename AppDelegate in your project to fix this problem.
I downloaded a collection of private libraries from this link. When I click download I get all frameworks. So these are only header files not the .framework files that are available in Xcode. So I linked them by the usual method of going to build phases, in it I go to link binary with libraries click on + and choose the header files from a framework (preferences framework in my case). After these files are added to my project I try to make an object from one of the libraries and try to call their instance methods. When I try to execute this program I get this error. I get this whether I run it on the device or simulator.
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_DevicePINController", referenced from:
objc-class-ref in UAViewController.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1
(use -v to see invocation)
DevicePinController is a part of a private framework preferences.h.I am trying to make an object of it UA
EDIT: I tried using other framework headers such as bluetooth and I get this error in all.
EDIT: I tried adding the entire framework to the project instead of adding individual header files.Now the error is
d: framework not found BluetoothManager
clang: error: linker command failed with exit code 1 (use -v to see invocation)
You'll need to actually build the framework. You can't just link against a header file; that doesn't make sense.
Try adding all the .m files in the Preferences folder as Compile Sources, and remove the header file from Link Binary with Libraries.
Added: I realize now this answer is incorrect. The files OP is trying to use are not a library, but header files from Apple's private frameworks. Here's a related answer: https://stackoverflow.com/a/13388225/893113
I'm trying to run an Xcode project developed by someone else and I keep getting the following error. Googling it suggests that I'm missing some dependency but if so I don't know which one. Supposedly the project already has all "Link Binary With Libraries" configured. I've tried different versions of Xcode and target devices and I get the same error. How can I narrow the problem down further?
Undefined symbols for architecture i386:
"___gl_pqSortExtractMin", referenced from:
___gl_computeInterior in sweep.o
"___gl_pqSortMinimum", referenced from:
___gl_computeInterior in sweep.o
"___gl_pqSortNewPriorityQ", referenced from:
_InitPriorityQ in sweep.o
"___gl_pqSortInsert", referenced from:
_InitPriorityQ in sweep.o
_CheckForIntersect in sweep.o
"___gl_pqSortInit", referenced from:
_InitPriorityQ in sweep.o
"___gl_pqSortDeletePriorityQ", referenced from:
_InitPriorityQ in sweep.o
_DonePriorityQ in sweep.o
_CheckForIntersect in sweep.o
"___gl_pqSortDelete", referenced from:
_CheckForRightSplice in sweep.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
That means that even if the compiler has the header file, when it actually linked them, it didn't find the real implementation of this code. So maybe you didn't linked your static library (only included the header file), or this static library hasn't been compiled for i386 architecture. So you can't make it work on simulator. You should check with lipo -info libMylib.a on what kind of architecture it has been compiled (armv6 - armv7 - armv7s, or whatever else)
Ok here what i have found:
This is the sweep file you are using.
http://oss.sgi.com/cgi-bin/cvsweb.cgi/projects/ogl-sample/main/gfx/lib/glu/libtess/sweep.c?annotate=1.2
Inside
static int CheckForRightSplice( GLUtesselator *tess, ActiveRegion *regUp )
there is
pqDelete( tess->pq, eUp->Org->pqHandle ); /* __gl_pqSortDelete */
By the way into the include file in sweep there is:
#include "priorityq.h"
So it let you compile because you have the header definition of the function, but you don't have the binary implementation. So you get linker error.
I dunno if you need to instal openGl in your mac ( i though it was already included), by the way i'm sure you don't have the (opengl/glu/libtess) libtess library, this is where there is the "priority.h" definition.
Here is the glu lib if found:
http://svn.netlabs.org/repos/gl2/opengl/glu/libtess/
So you should ask your friend if he has compiled himself the framework or not. Maybe you forget to add some link into your Xcode project, or the binary is missing from your mac, or not compiled into the i386 (even if i doubt of this). By the way i'm really not an openGl expert, but if you ask anyone into an openGl forum, they surely can help you.
I'm getting the following error only when I try to build the unit tests of an iPhone static library:
Undefined symbols for architecture i386:
"std::terminate()", referenced from:
-[ZipArchive dealloc] in libMyProject.a(ZipArchive.o)
"___gxx_personality_v0", referenced from:
Dwarf Exception Unwind Info (__eh_frame) in libMyProject.a(ZipArchive.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Building the original project works fine.
What can I be missing?
It should be noted that ZipArchive is a .mm file that references the libz.dylib framework, which is referenced both in the original project and in the test project.
Additionally, the usual Build Settings suspects have the following values:
Framework Search Paths: "$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks"
Other Linker Flags: -all_load -lxml2 - ObjC
Header Search Paths: /usr/include/libxml2
I found the solution in this post.
For some reason that eludes me, the compiler needed the ZipArchive.mm file to be renamed to .m when the static library is used in another project (the test project, in this case).
This typically occurs for one of two reasons:
You copied a framework or system header directly to your project folder instead of adding it with a reference through XCode
You've installed multiple SDKs, and the wrong framework or header is being referenced. Most frameworks aren't "Developer" frameworks. SenTestingKit.framework is an example of a developer framework, UIKit.framework isn't. Oddly, there are two different places that Developer Frameworks exist. In the /Developers/~ folder in XCode, and also in the SDK Developers folder. The default behavior is to reference the framework in XCode's developer folder. To override this, enter "$(SDKROOT)/Developer/Library/Frameworks" in "Framework Search Paths". Or in the case of an imported header or library, go the corresponding field and add "$(SDKROOT)/..."
Make sure your search paths are the same correct for all Targets:
If you are using multiple SDKs, the wrong version of the Developer Frameworks could get added (like SenTestingKit). Manually enter the the correct one under Framework Search Paths with
$(SDKROOT)/Developer/Library/Frameworks
I have added the SystemConfiguration framework. I am deploying against targets from 3.2 and higher. Have I forgotten to add something?
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_Reachability", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Okay, the clues are all in the error report you have posted.
While linking (the message is from the linker ld) which occurs after compilation of all the symbols across your project, the message is saying
"In AppDelegate, you have referenced a class object called Reachability"
"_OBJC_CLASS_$_Reachability"
and as far as the linker is concerned Reachability is undefined.
So, check that Reachability is being compiled in your project. The are a couple of ways to do this. Perhaps the most clear way is to
1 select the project file in the navigation pane
2 select the target
3 select Build Phases
4 Expand the Compile Sources section
*Now check the list of sources that will be compiled for your missing class, in your case Reachability.m
If it is missing, use the + button to add the file to the target.
Another way is to
1 select the file you think is not being compiled
2 open the utilities panel
3 select the file inspector tab
There will be a checkbox for each target in your project and you can easily see if your .m file is being compiled for each/all targets or not.
You might have forgotten to include the Reachability classes in your project!
I had a similar problem when I upgraded to the newest version of Mixpanel. The error read:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CTTelephonyNetworkInfo", referenced from:
objc-class-ref in Mixpanel.o
You can follow Damo's solution until the last step, and then instead of expanding the Compile Sources section, you have to expand the Link Binary With Libraries section instead, and add the CoreTelephony.framework source which contains CTTelephonyNetworkInfo.
You can read more about the CTTelephonyNetworkInfo class reference on Apple's official website here: http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Reference/CTTelephonyNetworkInfo/Reference/Reference.html