开发者

error while compiling dsniff on mac 10.6

I got this error when macport automatically attempted to compile it

Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_开发者_Go百科net_dsniff/work/dsniff-2.3" && /usr/bin/make -j2 all " returned error 2
Command output: /usr/bin/gcc-4.2 -O2 -DBIND_8_COMPAT -arch x86_64 -D_BSD_SOURCE -   DHAVE_SOCKADDR_SA_LEN -DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP - DDSNIFF_LIBDIR=\"/opt/local/lib/\" -I. -I/opt/local/include -I/opt/local/include -   I/opt/local/include  -I/opt/local/include  -I./missing -c ./missing/dummy.c
/usr/bin/gcc-4.2 -O2 -DBIND_8_COMPAT -arch x86_64 -D_BSD_SOURCE -DHAVE_SOCKADDR_SA_LEN -DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP -DDSNIFF_LIBDIR=\"/opt/local/lib/\" -I. -I/opt/local/include -I/opt/local/include -I/opt/local/include  -I/opt/local/include  -I./missing -c ./missing/md5.c
/usr/bin/gcc-4.2 -O2 -DBIND_8_COMPAT -arch x86_64 -D_BSD_SOURCE -DHAVE_SOCKADDR_SA_LEN -DLIBNET_BSDISH_OS -DLIBNET_BSD_BYTE_SWAP -DDSNIFF_LIBDIR=\"/opt/local/lib/\" -I. -I/opt/local/include -I/opt/local/include -I/opt/local/include  -I/opt/local/include  -I./missing -c ./arpspoof.c
./arpspoof.c:25: warning: 'struct ether_addr' declared inside parameter list
./arpspoof.c:25: warning: its scope is only this definition or declaration, which is probably not what you want
./arpspoof.c:26: warning: 'struct ether_addr' declared inside parameter list
./arpspoof.c: In function 'arp_send':
./arpspoof.c:49: warning: passing argument 1 of 'libnet_get_hwaddr' from incompatible pointer type
./arpspoof.c:49: error: too many arguments to function 'libnet_get_hwaddr'
./arpspoof.c:60: warning: passing argument 6 of 'libnet_build_ethernet' from incompatible pointer type
./arpspoof.c:60: error: too few arguments to function 'libnet_build_ethernet'
./arpspoof.c:64: error: 'ETH_H' undeclared (first use in this function)
./arpspoof.c:64: error: (Each undeclared identifier is reported only once
./arpspoof.c:64: error: for each function it appears in.)
./arpspoof.c:64: error: too few arguments to function 'libnet_build_arp'
./arpspoof.c:67: warning: passing argument 1 of 'ether_ntoa' from incompatible pointer type
./arpspoof.c:71: warning: passing argument 1 of 'ether_ntoa' from incompatible pointer type
./arpspoof.c:73: warning: format '%s' expects type 'char *', but argument 4 has type 'int'
./arpspoof.c:73: warning: format '%s' expects type 'char *', but argument 5 has type 'int'
./arpspoof.c:77: warning: passing argument 1 of 'ether_ntoa' from incompatible pointer type
./arpspoof.c:78: warning: format '%s' expects type 'char *', but argument 4 has type 'int'
./arpspoof.c:80: warning: passing argument 1 of 'ether_ntoa' from incompatible pointer type
./arpspoof.c: In function 'arp_find':
./arpspoof.c:114: warning: passing argument 2 of 'arp_cache_lookup' from incompatible     pointer type
./arpspoof.c: In function 'main':
./arpspoof.c:181: warning: assignment makes pointer from integer without a cast
make: *** [arpspoof.o] Error 1
make: *** Waiting for unfinished jobs....

Any idea?


The first warnings:

./arpspoof.c:25: warning: 'struct ether_addr' declared inside parameter list
./arpspoof.c:25: warning: its scope is only this definition or declaration,
                          which is probably not what you want
./arpspoof.c:26: warning: 'struct ether_addr' declared inside parameter list

These mean that there is a line similar to:

extern somefunc(struct ether_addr *arg1, ...);

There is no prior declaration of 'struct ether_addr', which means that the compiler has to treat it as a new type that has a scope of the function declaration - only. And, as the compiler notes, this is not what you want. You can work around that by preceding the declaration line with:

struct ether_addr;

This tells the compiler that the type will be defined eventually. Until the compiler needs the details of the insides of the structure, you can pass pointers around with the usual C abandon.

The errors tell you that something is seriously astray. The code assumes that ETH_H will be defined but it isn't.

There are other declarations which differ from what the code is configured to expect, which lead to the warnings further through the file. The chances are that 'pointer from integer without a cast' issues are functions that are not declared, so they're assumed to be functions that return an integer but they are actually functions that return a 'char *' and should therefore be declared.

When I tried to compile dsniff, the configuration phase failed because it didn't find 'libnet'.

So:

  • Make sure you've got the relevant libraries on hand (if you've got a URL for the relevant 'libnet' it would be helpful), and the relevant headers.
  • Have a look at the configuration output; it may not be analyzing everything that needs analyzing.
  • See whether you can find any information on compiling dsniff for MacOS X or one of the BSD releases (MacOS X / Darwin is somewhat similar to the BSD releases of Unix).
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜