編譯hping 時出現以下訊息
bytesex.h:22:3: error: #error can not find the byte order for this architecture, fix bytesex.h # error can not find the byte order for this architecture, fix bytesex.h ^ In file included from arsglue.c:7:0: ars.h:190:2: error: #error "Please, edit Makefile and add -DBYTE_ORDER_(BIG|LITTLE)_ENDIAN" #error "Please, edit Makefile and add -DBYTE_ORDER_(BIG|LITTLE)_ENDIAN" ^ ars.h:254:2: error: #error "Please, edit Makefile and add -DBYTE_ORDER_(BIG|LITTLE)_ENDIAN" #error "Please, edit Makefile and add -DBYTE_ORDER_(BIG|LITTLE)_ENDIAN" ^ ars.h:323:2: error: #error "Please, edit Makefile and add -DBYTE_ORDER_(BIG|LITTLE)_ENDIAN" #error "Please, edit Makefile and add -DBYTE_ORDER_(BIG|LITTLE)_ENDIAN" ^ make: *** [arsglue.o] Error 1
解決方式:
1. 安裝必要元件
yum -y install gcc libpcap-devel tcl-devel
2.進入編譯的目錄底下cd hping3
編輯bytesex.h這個檔案
vi bytesex.h
加入|| defined(__x86_64__) \這行
/* Original code from the Linux C library */ /* Copyright (C) 2000,2001 Salvatore Sanfilippo <[email protected]> * This code is under the original GNU C library license (GPL) */ /* $Id: bytesex.h,v 1.1.1.1 2003/08/31 17:23:48 antirez Exp $ */ #ifndef ARS_BYTESEX_H #define ARS_BYTESEX_H #if defined(__i386__) \ || defined(__x86_64__) \ || defined(__alpha__) \ || (defined(__mips__) && (defined(MIPSEL) || defined (__MIPSEL__))) #define BYTE_ORDER_LITTLE_ENDIAN #elif defined(__mc68000__) \ || defined (__sparc__) \ || defined (__sparc) \ || defined (__PPC__) \ || defined (__BIG_ENDIAN__) \ || (defined(__mips__) && (defined(MIPSEB) || defined (__MIPSEB__))) #define BYTE_ORDER_BIG_ENDIAN #else # error can not find the byte order for this architecture, fix bytesex.h #endif #endif /* ARS_BYTESEX_H */
重新執行編譯
./configure make make install
成功如下
./hping3 -v
hping version 3.0.0-alpha-1 ($Id: release.h,v 1.4 2004/04/09 23:38:56 antirez Exp $)
This binary is TCL scripting capable
use `make strip' to strip hping3 binary
use `make install' to install hping3
cp -f hping3 /usr/sbin/
chmod 755 /usr/sbin/hping3
ln -s /usr/sbin/hping3 /usr/sbin/hping
ln -s /usr/sbin/hping3 /usr/sbin/hping2
finish!