2010-06-23 71 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版本)。