2010-06-23 72 views
0

编译dsniff我得到这个错误时自动macport试图编译错误,而在Mac 10.6

Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_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.... 

任何想法?

回答

2

第一警告:

./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 

这些意味着有类似的行:

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

还有就是“struct ether_addr”没有事​​先声明,这意味着,编译器来治疗它作为仅具有函数声明范围的新类型。正如编译器所指出的,这不是你想要的。您可以通过在声明行之前解决该问题:

struct ether_addr; 

这告诉编译器最终会定义类型。在编译器需要结构的内部细节之前,可以使用通常的C放弃指针来传递指针。

这些错误告诉你有什么东西严重误入歧途。该代码假定ETH_H将被定义,但事实并非如此。

还有其他声明与代码所配置的期望不同,这会导致文件中的警告进一步发生。有可能是'没有强制转换的指针'的问题是没有声明的函数,所以它们被认为是返回一个整数的函数,但它们实际上是返回'char *'的函数,因此应该声明。

当我试图编译dsniff时,配置阶段失败,因为它没有找到'libnet'。

所以:

  • 确保你有手头上的相关库(如果你已经有了相关的URL“的libnet”这将是有益的),以及相关的报头。
  • 查看配置输出;它可能不会分析需要分析的所有内容。
  • 查看您是否可以找到关于为MacOS X或其中一个BSD版本编译dsniff的信息(MacOS X/Darwin有点类似于Unix的BSD版本)。