mach_star framework XCode linking problems - objective-c

I'm trying to build the DisposeWindow+Beep_Injector example project here: https://github.com/rentzsch/mach_star and am having trouble getting the framework it comes bundled with(mach_inject_bundle) linked to the application project correctly.
Here's the error I get:
Ld build/Development/DisposeWindow+Beep.bundle/Contents/MacOS/DisposeWindow+Beep normal x86_64
cd /Users/me/repos/mach_star/DisposeWindow+Beep
/Developer/usr/bin/llvm-gcc-4.2 -arch x86_64 -bundle -L/Users/me/repos/mach_star/DisposeWindow+Beep/build/Development -F/Users/me/repos/mach_star/DisposeWindow+Beep/build/Development -filelist /Users/me/repos/mach_star/DisposeWindow+Beep/build/DisposeWindow+Beep.build/Development/DisposeWindow+Beep.build/Objects-normal/x86_64/DisposeWindow+Beep.LinkFileList -framework Carbon -framework AudioToolbox -o /Users/me/repos/mach_star/DisposeWindow+Beep/build/Development/DisposeWindow+Beep.bundle/Contents/MacOS/DisposeWindow+Beep
Undefined symbols for architecture x86_64:
"_mach_override", referenced from:
_load in DisposeWindow+Beep.o
(maybe you meant: _mach_override_ptr)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
All the individual projects build fine but I can't build the parent project...
Here's a screenshot of what all the configs look like: http://i.imgur.com/vaLTu.png
Any ideas?

There is no mach_override, there is only a mach_override_ptr. You have to use that function.

Related

Can't get SMTP code to compile

I'm trying to write an iOS app that sends in an e-mail in the background without any user interaction. I've looked around the internet for days trying to find a simple solution, but everything that I find is really old and doesn't compile. Currently, the library that I am trying to use is: https://github.com/kailoa/iphone-smtp. However, I can't get it to compile.
What I have done is dragged the classes file into my project and set all of the new classes to not use ARC. However, I keep getting the following error:
Ld /Users/Andrew/Library/Developer/Xcode/DerivedData/EmailTest2-gpzibaprekjgiheqoazurfdwapxp/Build/Products/Debug-iphonesimulator/EmailTest2.app/EmailTest2 normal i386
cd /Users/Andrew/Desktop/EmailTest2
setenv IPHONEOS_DEPLOYMENT_TARGET 6.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk -L/Users/Andrew/Library/Developer/Xcode/DerivedData/EmailTest2-gpzibaprekjgiheqoazurfdwapxp/Build/Products/Debug-iphonesimulator -F/Users/Andrew/Library/Developer/Xcode/DerivedData/EmailTest2-gpzibaprekjgiheqoazurfdwapxp/Build/Products/Debug-iphonesimulator -filelist /Users/Andrew/Library/Developer/Xcode/DerivedData/EmailTest2-gpzibaprekjgiheqoazurfdwapxp/Build/Intermediates/EmailTest2.build/Debug-iphonesimulator/EmailTest2.build/Objects-normal/i386/EmailTest2.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=6.0 -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/Andrew/Library/Developer/Xcode/DerivedData/EmailTest2-gpzibaprekjgiheqoazurfdwapxp/Build/Products/Debug-iphonesimulator/EmailTest2.app/EmailTest2
Undefined symbols for architecture i386:
"_CFHostCreateWithName", referenced from:
+[NSStream(SKPSMTPExtensions) getStreamsToHostNamed:port:inputStream:outputStream:] in NSStream+SKPSMTPExtensions.o
"_CFStreamCreatePairWithSocketToCFHost", referenced from:
+[NSStream(SKPSMTPExtensions) getStreamsToHostNamed:port:inputStream:outputStream:] in NSStream+SKPSMTPExtensions.o
"_kCFStreamPropertySSLSettings", referenced from:
-[SKPSMTPMessage parseBuffer] in SKPSMTPMessage.o
"_kCFStreamSSLAllowsAnyRoot", referenced from:
-[SKPSMTPMessage parseBuffer] in SKPSMTPMessage.o
"_kCFStreamSSLAllowsExpiredCertificates", referenced from:
-[SKPSMTPMessage parseBuffer] in SKPSMTPMessage.o
"_kCFStreamSSLAllowsExpiredRoots", referenced from:
-[SKPSMTPMessage parseBuffer] in SKPSMTPMessage.o
"_kCFStreamSSLLevel", referenced from:
-[SKPSMTPMessage parseBuffer] in SKPSMTPMessage.o
"_kCFStreamSSLValidatesCertificateChain", referenced from:
-[SKPSMTPMessage parseBuffer] in SKPSMTPMessage.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
There is also a buildstaticlib.sh file; however, when I try to run it using the command ./buildstaticlib.sh or any variant of it, it gives me this error:
Usage: ./buildstaticlib.sh PATH
where PATH is the destination directory for the build package
If you know how to send an e-mail in the background using some other library I would be more than willing to switch. However, I would need help getting that library to run also. I've tried at least 6 different libraries and can't seem to make any progress with any of them. Thanks!
You probably forgot to add a framework. Make sure, all the imported frameworks are added to your project and linked to by your target.
If you open the sample project you'll see what frameworks are used:

Renaming Quicklook-template GeneratePreviewForURL.m causes linker error

I'm using a slightly outdated version of Xcode (4.2.1, with Apple clang version 3.0), which might be a problem, but.. this should work regardless:
I create a new Quicklook plugin project ("File > New > New Project", then "System Plugin > Quick Look Plug-in")
Then I rename GeneratePreviewForURL.c to GeneratePreviewForURL.m (as mentioned in the Apple docs)
If I try and use any Objective-C code in the file, I get errors. For example if I add the following to the GeneratePreviewForURL method:
#include <Foundation/Foundation.h> // at start of file
NSMutableDictionary *blah;
[blah setValue:#"valuething" forKey:#"keything"];
I get the following linker error:
Undefined symbols for architecture x86_64:
"_objc_msgSend", referenced from:
_GeneratePreviewForURL in GeneratePreviewForURL.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The slightly trimmed/reformmated linker command causing the problem is:
cd ~/QuicklookExample
setenv MACOSX_DEPLOYMENT_TARGET 10.7
/Developer/usr/bin/clang
-arch x86_64 -bundle
-isysroot /Developer/SDKs/MacOSX10.7.sdk
-L/snip -F/snip -filelist /snip/QuicklookExample.LinkFileList
-mmacosx-version-min=10.7
-framework QuickLook
-framework ApplicationServices
-framework CoreServices
-framework CoreFoundation
-o /snip/QuicklookExample
You have to add at least Foundation framework to the linked libraries.
Note that what's missing here is libobjc which should be linked directly by the fact clang should understand your code is actually Objective-C.

Xcode 4.3.3 - Error Undefined Symbols

hy all,
I am building an application to create a simple tableview, with a search bar on top to search between the elements of the table.
I have followed a tutorial and no coding errors were found, but when building, it always fails showing the following message:
Ld /Users/gouyoun/Library/Developer/Xcode/DerivedData/ERCDictionnary-atjolczeormaykcscwvnhlxdcnvk/Build/Products/Debug-iphonesimulator/ERCDictionnary.app/ERCDictionnary normal i386
cd /Users/gouyoun/Desktop/ERCDictionnary/ERCDictionnary
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Volumes/Xcode/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Volumes/Xcode/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk -L/Users/gouyoun/Library/Developer/Xcode/DerivedData/ERCDictionnary-atjolczeormaykcscwvnhlxdcnvk/Build/Products/Debug-iphonesimulator -F/Users/gouyoun/Library/Developer/Xcode/DerivedData/ERCDictionnary-atjolczeormaykcscwvnhlxdcnvk/Build/Products/Debug-iphonesimulator -filelist /Users/gouyoun/Library/Developer/Xcode/DerivedData/ERCDictionnary-atjolczeormaykcscwvnhlxdcnvk/Build/Intermediates/ERCDictionnary.build/Debug-iphonesimulator/ERCDictionnary.build/Objects-normal/i386/ERCDictionnary.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=50100 -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/gouyoun/Library/Developer/Xcode/DerivedData/ERCDictionnary-atjolczeormaykcscwvnhlxdcnvk/Build/Products/Debug-iphonesimulator/ERCDictionnary.app/ERCDictionnary
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_OverlayViewController", referenced from:
objc-class-ref in tableView.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
"_OBJC_CLASS_$_OverlayViewController", referenced from:
objc-class-ref in tableView.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I'm a newb in OBjective C, any ideas?
Your tableView class refers to a class called OverlayViewController which is not in your project.
Its done, it only needed to remove the files and re-add them later, it worked like a charm
I've had the exact same error. It occured because I had 2 xCode Projects open, an Dragged & Dropped a class from one project to the other one. I checked "Copy to project" and the files where in the new projects folder. But it crashed every time.
I deleted the classes and IMPORTED them into the project and then it worked... So be careful when using Drag'n'Drop!

Compiler Error in Xcode-4 Cocoa Application For GData Api?

I am trying to Fetch Videos from YouTube Channel on Cocoa Application. For that First added GData Framework to my project, and import #import "GData/GData.h". Then their is no error . But if i am importing #import "GData/GDataServiceGoogleYouTube.h"
and write some code related to GDataServiceGoogleYouTube
GDataServiceGoogleYouTube *service=[[GDataServiceGoogleYouTube alloc]init];
getting Compiler eror:
Ld /Users/Rasheed/Library/Developer/Xcode/DerivedData/YouTube-ddawzlgkbmkdqsalghaobsospjth/Build/Products/Debug/YouTube.app/Contents/MacOS/YouTube normal x86_64
cd /Users/Rasheed/Desktop/MULTIPLESOCKET/YouTube
setenv MACOSX_DEPLOYMENT_TARGET 10.6
/Developer/usr/bin/clang -arch x86_64 -isysroot
/Developer/SDKs/MacOSX10.6.sdk -L/Users/Rasheed/Library/Developer/Xcode/DerivedData/YouTube-ddawzlgkbmkdqsalghaobsospjth/Build/Products/Debug
-F/Users/Rasheed/Library/Developer/Xcode/DerivedData/YouTube-ddawzlgkbmkdqsalghaobsospjth/Build/Products/Debug -filelist
/Users/Rasheed/Library/Developer/Xcode/DerivedData/YouTube-ddawzlgkbmkdqsalghaobsospjth
/Build/Intermediates/YouTube.build/Debug/YouTube.build/Objects-normal/x86_64/YouTube.LinkFileList -mmacosx-version-min=10.6 -ObjC
-lxml2 -all_load -framework Cocoa -o /Users/Rasheed/Library/Developer/Xcode/DerivedData/YouTube-ddawzlgkbmkdqsalghaobsospjth/Build
/Products/Debug/YouTube.app/Contents/MacOS/YouTube
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_GDataServiceGoogleYouTube", referenced from:
objc-class-ref in YouTubeAppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How can i Fix This error?
If you built a GData static library, make sure the library is listed in the “Link Binary With Libraries” section under the “Build Phases” tab for your target.
If you dragged all of the GData source files into your project, make sure they are all listed in the “Compile Sources” section under the “Build Phases” tab for your target.
You might find this blog post helpful: http://hoishing.wordpress.com/2011/08/23/gdata-objective-c-client-setup-in-xcode-4/

libmms linking error

i have downoaded the wunder radio project, i have copy the MMS project in my workspace.
if i try to use mms_connect Xcode4 give me this error:
Ld
/Users/Alex/Library/Developer/Xcode/DerivedData/test1-gevnovbiecnctxguaabsznvdybxa/Build/Products/Debug-iphonesimulator/test1.app/test1
normal i386
cd /Users/Alex/Source/test1
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH
"/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2
-arch i386 -isysroot
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk
-L/Users/Alex/Library/Developer/Xcode/DerivedData/test1-gevnovbiecnctxguaabsznvdybxa/Build/Products/Debug-iphonesimulator
-F/Users/Alex/Library/Developer/Xcode/DerivedData/test1-gevnovbiecnctxguaabsznvdybxa/Build/Products/Debug-iphonesimulator
-filelist
/Users/Alex/Library/Developer/Xcode/DerivedData/test1-gevnovbiecnctxguaabsznvdybxa/Build/Intermediates/test1.build/Debug-iphonesimulator/test1.build/Objects-normal/i386/test1.LinkFileList
-mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -lz.1
-framework UIKit -framework Foundation -framework CoreGraphics -o
/Users/Alex/Library/Developer/Xcode/DerivedData/test1-gevnovbiecnctxguaabsznvdybxa/Build/Products/Debug-iphonesimulator/test1.app/test1
Undefined symbols for architecture i386: "_mms_connect", referenced
from:
-[test1AppDelegate application:didFinishLaunchingWithOptions:]
in test1AppDelegate.o ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
have any idea to resolve it?
It looks like the linker is failing to link to libmms because it is of the wrong architecture. The project you are building appears to be for the iPhone simulator. Since the simulator runs on your computer it's architecture is i386 (or perhaps x86_64 depending upon the machine you are using). So basically you are compiling using i386 but when the linker tried to link to libmms it did not find that libmms had been compiled using the same architecture.
Since iOS devices use armv6 or armv7 architectures and the simulator uses i386, it can be quite difficult to switch back and forth between building for the actual device or building for the simulator since any external static libraries need to be built for all 3 architectures.
You'll likely need to rebuild libmms using the i386 architecture.