Undefined symbols for architecture x86_64 when trying to unit test the application - objective-c

I'm getting an error in XCode when trying to run unit tests. Any ideas?
I have tried changing the Framework search paths in Build Settings to $(SDKROOT)/Developer/Library/Frameworks
$(DEVELOPER_LIBRARY_DIR)/Frameworks
But that did not change anything.
ld: warning: directory not found for option '-F/Applications/Xcode'
ld: warning: directory not found for option '-
F4.3.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/Developer/Library/Frameworks'
ld: warning: directory not found for option '-F/Applications/Xcode'
ld: warning: directory not found for option '-F4.3.2.app/Contents/Developer/Library/Frameworks'
ld: warning: ignoring file /Applications/Xcode 4.3.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/Library/Frameworks//SenTestingKit.framework/SenTestingKit, file was built for unsupported file format which is not the architecture being linked (x86_64)
Undefined symbols for architecture x86_64:
"_STComposeString", referenced from:
-[AddressBookFrameworkSyncHelperTest testAddingAPersonToGroupsFromAVcard] in AddressBookFrameworkSyncHelperTest.o
-[SyncTesting testExample] in SyncTesting.o
"_OBJC_CLASS_$_SenTestCase", referenced from:
_OBJC_CLASS_$_AddressBookFrameworkSyncHelperTest in AddressBookFrameworkSyncHelperTest.o
_OBJC_CLASS_$_SyncTesting in SyncTesting.o
"_OBJC_CLASS_$_AddressBookFrameworkSyncHelper", referenced from:
objc-class-ref in AddressBookFrameworkSyncHelperTest.o
(maybe you meant: _OBJC_CLASS_$_AddressBookFrameworkSyncHelperTest)
"_OBJC_METACLASS_$_SenTestCase", referenced from:
_OBJC_METACLASS_$_AddressBookFrameworkSyncHelperTest in AddressBookFrameworkSyncHelperTest.o
_OBJC_METACLASS_$_SyncTesting in SyncTesting.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

These error messages show the problem:
ld: warning: directory not found for option '-F/Applications/Xcode'
ld: warning: directory not found for option '-F4.3.2.app/Contents/Developer/Library/Frameworks'
Clearly you've got "/Applications/Xcode" and "4.3.2.app/Contents/Developer/Library/Frameworks" on your frameworks paths separately, instead of "/Applications/Xcode 4.3.2.app/Contents/Developer/Library/Frameworks".
If this is something you did, you're probably missing quotes somewhere. Maybe just doing the exact same thing you tried, but with quotes around it, will work?
If it's something that Xcode is doing automatically, Apple's missing quotes somewhere, and the workaround is probably to rename your "Xcode 4.3.2.app" to something without spaces in it.
But there may be a second problem here as well:
ld: warning: ignoring file /Applications/Xcode 4.3.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/Library/Frameworks//SenTestingKit.framework/SenTestingKit, file was built for unsupported file format which is not the architecture being linked (x86_64)
In this case, the quotes are right, and it's finding the framework… but apparently you've only got the 32-bit (i386) build installed, not the 64-bit (x86_64) one that you need.
I'm also a bit curious where this came from in the first place, as when I look at the 10.6 SDK in my Xcode 4.3.2, there's no framework called SenTestingKit.framework. Which implies that you may have hacked up your Xcode install in various ways, and the right solution might be to uninstall, reinstall, and do things properly. But it's possible this is some additional install from within Xcode (or from developer.apple.com) that you've installed and I haven't.

Related

iOS manually exporting library causes issues

I made a library and I want to test it in a dummy project I made. Both projects are made in Objective-C. When I build my library I get a Successful Build message and three files under the Product directory:
FooIOS.bundle
libFooIOS.a
include
I place these three files at the root level of my dummy project and when I open my myDummyProject.xcworkspace file I see them in my project hierarchy. However, when I build my project I get the following error:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_FooSelectedPageViewController", referenced from:
objc-class-ref in libFooIOS.a(FooViewController.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I did away with some of the obvious checks:
Made sure to reference my external library
I also made sure that both my library and project architectures are set as armv7 arm64
I don't know what else to do. I may be missing another configuration step or it may even be the way I declared something in my library that doesn't conform with my dummy project. Or a discrepancy between projects, perhaps? Any hints or leads would be a great help. Thanks.

"_OBJC_CLASS_$_",referenced from:

Hello i am getting the following errors and warnings if i build the program on simulator,but if i run it on the real device these things disappears?why do i get this?any idea?
ld: warning: ignoring file /Users/interaxisnetworks/Desktop/Test/TestProg/audiocall/PortSIPLib.framework/PortSIPLib, missing required architecture x86_64 in file /Users/interaxisnetworks/Desktop/Test/TestProg/audiocall/PortSIPLib.framework/PortSIPLib (3 slices)
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_PortSIPSDK", referenced from:
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Once i run the app on phone,i am not getting these warnings at all.But sometimes when i open the program and do build on simulator i get these errors and warnings.
i have gone through answers for similar problems,added app delegate.m in build settings,still these errors are coming.
The PortSIPLib.framework you tried to link your app with seems to be iOS only. You should ask the provider of the framework for a binary that is suitable for the simulator. If he can't or won't provide one, then there is nothing much you can do, I'm afraid.

HLA (Higher Level Assembly) Installation and Linker

I am trying to install the executalbles to compile programs in HLA on a Mac OS 10.8. Although the tools seem to be in the right place and working I am getting the following error when trying to compile the first program
ld: warning: -macosx_version_min not specified, assuming 10.8
Undefined symbols for architecture i386:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture i386
Error returned by ld = 256
The hla executalbe seems to output the object file but something in the linker seems to not be working. I have previously managed to install it on other machines but in most cases I get this error.
Any ideas?
You can tell HLA to use "_main" as the entry point by using "-main:_main". You may also need to link with libSystem.dylib and get rid of some linker warnings, so that the whole command would be
hla -main:_main -l"macosx_version_min 10.9" -l"lSystem" -l"no_pie" source.hla

AWS IOS SDK 1.7.0 -> Undefined symbols for architecture armv7s:

I'm trying to use the amazon AWS for iOS SDK but I keep getting several Apple Mach-O Linker errors in Xcode 5.0.1
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_S3CreateBucketRequest", referenced from:
objc-class-ref in CreationViewController.o
"_OBJC_CLASS_$_S3Region", referenced from:
objc-class-ref in CreationViewController.o
"_OBJC_CLASS_$_AmazonEndpoints", referenced from:
objc-class-ref in CreationViewController.o
"_OBJC_CLASS_$_AmazonS3Client", referenced from:
objc-class-ref in CreationViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I went into the build phases and made sure the AWSES.framework is included in link binary with libraries. In the compile sources CreationViewController.m is also included.
Target Memberships also seem to be correct. What else can I do?
I had the same problem. My solution was to delete the AWSRuntime.framework and the AWSS3.framework from the project. I then went back to the Amazon site to re-download the aws-ios-sdk-1.6.1. Using the Build Phase -> Link Binary Libraries (+) button I added the fresh frameworks back to the Xcode project and it ran with no problems. I had moved the project from Dropbox to a loaner and back again via Dropbox after my hard drive died. My guess is that this corrupted the files or Amazon has something in the code that frowns on copping the it from one place to another rather than getting it straight from them.

TouchJSON Fails on Compile (link error)

Undefined symbols for architecture x86_64:
"_objc_unretainedPointer", referenced from:
-[CJSONScanner scanJSONStringConstant:error:] in CJSONScanner.o
-[CJSONSerializer serializeNumber:error:] in CJSONSerializer.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Hey all. Trying to use TouchJSON to do some JSON-y stuff. I followed the read me for the library to the meter I think, but every time I try to compile I get this error. I don't know much about Xcode (I've only been learning Obj-C recently) so I'm clueless about this. Any ideas?
Try to remove "Experimental" folder (and files inside, of course).
README
Be aware that the code in the Experimental subdirectory of Source is
just that and may not have been extensively tested and/or have extra
dependencies
So it could be a problem about extra dependencies (but always make sure if your project already have linked all dependency libraries/framework)