Re: libpcap in Cocoa
Re: libpcap in Cocoa
- Subject: Re: libpcap in Cocoa
- From: Ivan Myrvold <email@hidden>
- Date: Mon, 20 Aug 2001 13:16:54 +0200
Here is the complete messages from the compile:
Completed phase <DeriveAndCompileSources> for Esther.app
StandaloneExecutable
/Users/imyrvold/Documents/Cocoa/Esther/build/Esther.app/Contents/MacOS/Esther
/usr/bin/ld: warning prebinding disabled because of undefined symbols
/usr/bin/ld: Undefined symbols:
_pcap_lookupdev
/usr/bin/cc -o
"/Users/imyrvold/Documents/Cocoa/Esther/build/Esther.app/Contents/MacOS/Esther"
"-L/Users/imyrvold/Documents/Cocoa/Esther/build"
"-F/Users/imyrvold/Documents/Cocoa/Esther/build/ProjectHeaders"
"-F/Users/imyrvold/Documents/Cocoa/Esther/build" -filelist
"/Users/imyrvold/Documents/Cocoa/Esther/build/intermediates/Esther.build/Objects/
LinkFileList" "-arch" "ppc" "-prebind" "-framework" "Cocoa"
...failed StandaloneExecutable.LinkUsingFileList
/Users/imyrvold/Documents/Cocoa/Esther/build/Esther.app/Contents/MacOS/Esther
...
Ivan
On mandag, august 20, 2001, at 11:26 , Ivan Myrvold wrote:
>
I followed your advice, and compiled libpcap after your earlier message:
>
>
Building libpcap:
>
% gzip -cd libpcap-0.6.2.tar.gz | tar xf -
>
tar: Could not create: libpcap-0.6.2/. <File exists> <-- stupid
>
error
>
% cd libpcap-0.6.2
>
% ./configure --prefix=/usr/local/pcap
>
% make
>
% mv install install.stupid
>
% sudo make install
>
>
Now, pcap.h is in directory /usr/local/pcap/include,
>
>
But I got exactly the same compiler error:
>
>
Linking
>
/Users/imyrvold/Documents/Cocoa/Esther/build/Esther.app/Contents/MacOS/Esther
>
(1 error, 1 warning).
>
warning prebinding disabled because of undefined symbols
>
Undefined symbols:
>
>
I have the feeling that I am missing out on something here. What I am
>
doing is very simple. In MyWindowController, at the top, I have:
>
>
#import "MyWindowController.h"
>
#import "MySettings.h"
>
#include "pcap.h"
>
#include <sys/socket.h>
>
#include <netinet/in.h>
>
#include <arpa/inet.h>
>
#include <netinet/if_ether.h> /* includes net/ethernet.h */
>
>
@implementation MyWindowController
>
>
// Initialization
>
etc......
>
>
In an IBAction for a button, I put this (only to see that it could
>
compile OK):
>
>
- (IBAction)doCapture:(id)sender {
>
char *dev; /* name of the device to use */
>
char errbuf[PCAP_ERRBUF_SIZE];
>
>
/* ask pcap to find a valid device for use to sniff on */
>
dev = pcap_lookupdev(errbuf);
>
}
>
>
That's it. Do I need to do more, to get this to compile (I mean link).
>
>
Ivan
>
>
On mandag, august 20, 2001, at 02:14 , Todd Heberlein wrote:
>
>
>> But these are defined in pcap.h
>
>>
>
>> What am I doing wrong here?
>
>
>
> Not sure, but there may be a mismatch between the pcap package that you
>
> grabbed the pcap.h file from and the pcap library that you are linking
>
> against. Apple provides its own pcap library, but since they do not
>
> include any header files, we cannot know what APIs are supported by the
>
> library. If you are linking against it, you may have some problems.
>
>
>
> I would recommend you actually build and install a fresh copy of pcap,
>
> and then do #import <pcap.h>, set up the appropriate additional INCLUDE
>
> and LIBRARY paths in your target panes to pick up your installation
>
> paths, and include -lpcap in the target pane as well. That should pick
>
> up your own build of the package.
>
>
>
> I was able to link against it and read tcpdump files from a packet
>
> file.
>
>
>
> Todd
>
> _______________________________________________
>
> cocoa-dev mailing list
>
> email@hidden
>
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
_______________________________________________
>
cocoa-dev mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev