Trying to compile a basic program which uses pcap.h. I've set up the environment on my Mac OSX box which uses the iPhone 3.1.3 SDK for an iPhone 3GS. I've also installed libpcap to ~/libpcap so I can tell gcc where to look for the headers using the -I flag. However, it fails with an ld warning saying the file is not of the required architecture.
I'm compiling with the following line:
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -I /Users/abnev/libpcap/include -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk -o pcap pcap.c -lpcap
Error's being generated are:
ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk/usr/lib/libpcap.dylib, file is not of required architecture
Undefined symbols:
"_pcap_geterr", referenced from:
_main in ccOL3e0B.o
_main in ccOL3e0B.o
"_pcap_open_live", referenced from:
_main in ccOL3e0B.o
"_pcap_next", referenced from:
_main in ccOL3e0B.o
"_pcap_lookupdev", referenced from:
_main in ccOL3e0B.o
"_pcap_setfilter", referenced from:
_main in ccOL3e0B.o
"_pcap_lookupnet", referenced from:
_main in ccOL3e0B.o
"_pcap_close", referenced from:
_main in ccOL3e0B.o
"_pcap_compile", referenced from:
_main in ccOL3e0B.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
I assume now that I need to recompile libpcap for the armv6 architecture (iPhone) but checking the ./configure options doesn't help. I've attempted to Google around for this but there is very little out there.
pcap.c isn't the source to libpcap, it's one of the source files to libpcap. You'd have to compile all the source files and build them into a library.
Doing
CFLAGS="-I /Users/abnev/libpcap/include -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk" ./configure
might produce a Makefile that would cross-compile libpcap for iOS.
I presume you will be installing libpcap, or the application built using it, on a jailbroken iPhone, at least if you're going to be capturing packets, because you would need root access in order for libpcap to be able to open a BPF device in order to be able to capture.
Related
I am using z bar SDK in x code 5 when i am archiving its getting following errors
Undefined symbols for architecture armv7:
"_CMSampleBufferGetImageBuffer", referenced from:
-[ZBarCaptureReader captureOutput:didOutputSampleBuffer:fromConnection:] in libzbar.a(ZBarCaptureReader.o)
"_CMSampleBufferIsValid", referenced from:
-[ZBarCaptureReader captureOutput:didOutputSampleBuffer:fromConnection:] in libzbar.a(ZBarCaptureReader.o)
"_CMSampleBufferDataIsReady", referenced from:
-[ZBarCaptureReader captureOutput:didOutputSampleBuffer:fromConnection:] in libzbar.a(ZBarCaptureReader.o)
"_CMSampleBufferGetNumSamples", referenced from:
-[ZBarCaptureReader captureOutput:didOutputSampleBuffer:fromConnection:] in libzbar.a(ZBarCaptureReader.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
It seems you missed the one of the frameworks - Core Media.
Check the following integration link for ZBar sdk.
http://zbar.sourceforge.net/iphone/sdkdoc/install.html#integration
Remove armv7s arm64 Architectures only use the armv7 and solve your problem.
Project -> Build Settings -> Architectures -> Delete armv7s arm64
Importing a header and do not linking against the correct library will cause that error. Check you have imported the correct libraries. A more complete answer can be found here
Undefined symbols for architecture armv7
I have a running cocos2d project and a running ios storyboard project that both run without errors , when i try to embed cocos2d project into the main project i have the following errors (After disabling ARC and adding required frameworks ):
Undefined symbols for architecture i386:
"_gzclose", referenced from:
_ccInflateGZipFile in ZipUtils.o
"_gzopen", referenced from:
_ccInflateGZipFile in ZipUtils.o
"_gzread", referenced from:
_ccInflateGZipFile in ZipUtils.o
"_inflate", referenced from:
_inflateMemoryWithHint in ZipUtils.o
"_inflateEnd", referenced from:
_inflateMemoryWithHint in ZipUtils.o
"inflateInit2", referenced from:
_inflateMemoryWithHint in ZipUtils.o
"_uncompress", referenced from:
_ccInflateCCZFile in ZipUtils.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Add the libz.dylib library to the Link Binaries build phase or add -lz as other linker flag in Build Settings. Both will ensure the app is linked with the zip library needed by cocos2d.
I tried running a basic opengl program from this link. I can run it successfully. Now I need some functionalities of opencv to be added in this.
So I added opencv framework from this link.
After adding the framework I changed the files to .mm and its compiling good. The problem comes when I add "cv::Mat Variable". I get the below error. What would be the reason for this?
The below is the error I get When I add "cv::Mat Variable".
Undefined symbols for architecture i386:
"_gzclose", referenced from:
_cvReleaseFileStorage in OpenCV(persistence.o)
_cvOpenFileStorage in OpenCV(persistence.o)
"_gzeof", referenced from:
icvEof(CvFileStorage*) in OpenCV(persistence.o)
"_gzgets", referenced from:
icvGets(CvFileStorage*, char*, int)in OpenCV(persistence.o)
"_gzopen", referenced from:
_cvOpenFileStorage in OpenCV(persistence.o)
"_gzputs", referenced from:
icvPuts(CvFileStorage*, char const*)in OpenCV(persistence.o)
"_gzrewind", referenced from:
_cvOpenFileStorage in OpenCV(persistence.o)
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
This Solves my problem. To add add opencv library file
AVFoundation.framework
ImageIO.framework
libz.dylib
should be added. And this link explains clearly about this. http://aptogo.co.uk/2011/09/opencv-framework-for-ios/
I'm trying to create application that sends email
I used classes like
SKPSMTPMessage , NSStream+SKPSMTPExtensions, NSData+Base64Additions, HSK_CFUtilities, Base64Transcoder
but it gives me the following errors
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_SKPSMTPMessage", referenced from:
objc-class-ref in MFViewController.o
"_kSKPSMTPPartContentTransferEncodingKey", referenced from:
-[MFViewController sendMail:] in MFViewController.o
"_kSKPSMTPPartContentTypeKey", referenced from:
-[MFViewController sendMail:] in MFViewController.o
"_kSKPSMTPPartMessageKey", referenced from:
-[MFViewController sendMail:] in MFViewController.o
"_CFHostCreateWithName", referenced from:
+[NSStream(SKPSMTPExtensions) getStreamsToHostNamed:port:inputStream:outputStream:] in NSStream+SKPSMTPExtensions.o
+[NSStream(SKPSMTPExtensions) getStreamsToHostNamed:port:inputStream:outputStream:] in SKPSMTPMessage.o
"_CFStreamCreatePairWithSocketToCFHost", referenced from:
+[NSStream(SKPSMTPExtensions) getStreamsToHostNamed:port:inputStream:outputStream:] in NSStream+SKPSMTPExtensions.o
+[NSStream(SKPSMTPExtensions) getStreamsToHostNamed:port:inputStream:outputStream:] 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)
keep in mind that I'm using Xcode 4.3 ,
what shall I do to solve this??
After adding the CFNetwork framework and SystemConfiguration framework ,
the number of errors decreased from 6 to 4 and it is now
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_SKPSMTPMessage", referenced from:
objc-class-ref in MFViewController.o
"_kSKPSMTPPartContentTransferEncodingKey", referenced from:
-[MFViewController sendMail:] in MFViewController.o
"_kSKPSMTPPartContentTypeKey", referenced from:
-[MFViewController sendMail:] in MFViewController.o
"_kSKPSMTPPartMessageKey", referenced from:
-[MFViewController sendMail:] in MFViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This error message means that those classes search some objects in a framework that you haven't linked to your project. Here you can found what framework do you need: the CFNetwork framework.
I hope it helps!
EDIT
The other 4 errors might be caused by the incorrect importation of the SKPSMT classes. If that classes are downloaded as a library, you'll also need to link your app with that library.
Try adding the following linker flags:
OTHER_LDFLAGS = -lz -lxml2 -ltidy -ObjC
ld: warning: directory not found for option '-L/Users/photon/Desktop/Walg-19-aug/WalgreensIPAD_1.0.3/iPad/Walgreens/../ZXingWidget/build/Debug-iphonesimulator'
ld: warning: directory not found for option '-L/Users/photon/Desktop/Walg-19-aug/WalgreensIPAD_1.0.3/iPad/Walgreens/../ZXingWidget/build/Debug-iphoneos'
ld: warning: directory not found for option '-L/Users/photon/Desktop/Walg-19-aug/WalgreensIPAD_1.0.3/iPad/Walgreens/../ZXingWidget/build/Release-iphoneos'
ld: warning: ignoring file /Users/photon/Desktop/Walg-19-aug/WalgreensIPAD_1.0.3/iPad/Walgreens/libOmnitureAppMeasurement-iPhoneDevice.a, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: ignoring file /Users/photon/Desktop/Walg-19-aug/WalgreensIPAD_1.0.3/iPad/Walgreens/libOmnitureAppMeasurement-iPhoneSimulator_4_0_GM.a, file was built for unsupported file format which is not the architecture being linked (i386)
Undefined symbols for architecture i386:
"_deflateInit2_", referenced from:
-[ASIDataCompressor setupStream] in ASIDataCompressor.o
"_deflateEnd", referenced from:
-[ASIDataCompressor closeStream] in ASIDataCompressor.o
"_deflate", referenced from:
-[ASIDataCompressor compressBytes:length:error:shouldFinish:] in ASIDataCompressor.o
"_inflateInit2_", referenced from:
-[ASIDataDecompressor setupStream] in ASIDataDecompressor.o
"_inflateEnd", referenced from:
-[ASIDataDecompressor closeStream] in ASIDataDecompressor.o
"_inflate", referenced from:
-[ASIDataDecompressor uncompressBytes:length:error:] in ASIDataDecompressor.o
"_OBJC_CLASS_$_OMAppMeasurement", referenced from:
objc-class-ref in OmnitureService.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 failed with exit code 1
i got this error Even i Included the libz1.2.5.dylib into my project.
I am working in X-Code 4.2 for IOS Beta Version
# All
Any one please tell problem solving.
EDIT : As of Xcode 7 libz.dylib has been renamed to libz.tbd
I fix this problem by add libz.dylib to Link Library.
following this guide:
http://allseeing-i.com/ASIHTTPRequest/Setup-instructions
you need to follow this set of instruction to use this API http://allseeing-i.com/ASIHTTPRequest/Setup-instructions, I am sure you didn't added libz.dylib in your project
Make sure that ALL relevant targets have libz linked. You could be adding it to Target A and trying to compile Target B which is missing it.
Please make sure that you link against libz correctly, eg. check that its included in the "Link Binary With Libraries" build phase of your target.
I'm not a 100% sure, but it says "for architecture i386" ... should be armv6 or armv7...
So i would check your build steps...
In Xcode 8 libz.dylib has been renamed to libz.tbd