arpd编译错误
问题1:
编译 arpd.c
arpd.c: In function ‘arpd_send’:
arpd.c:269: 错误:expected ‘)’ before string constant
arpd.c: In function ‘arpd_lookup’:
arpd.c:286: 错误:expected ‘)’ before string constant
arpd.c:295: 错误:expected ‘)’ before string constant
arpd.c:298: 错误:expected ‘)’ before string constant
arpd.c: In function ‘arpd_recv_cb’:
arpd.c:427: 错误:expected ‘)’ before string constant
gmake: *** [arpd.o] 错误 1
*** 退出状态:2 ***
解决方法:
在arpd.c文件首部加上#define __FUNCTION__ “”语句
原因分析:
syslog(LOG_DEBUG, __FUNCTION__ ": no entry for %s",addr_ntoa(addr));函数中常量__FUNCTION__为预定义,该函数是操作系统中的库函数,你可以在/usr/include/sys/中找到syslog.h头文件中有它的定义,具体定义如下:
extern void syslog (int __pri, __const char *__fmt, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
问题2:
arpd.o: In function `terminate_handler':
arpd.c:(.text+0x1556): undefined reference to `event_gotsig'
arpd.o: In function `main':
arpd.c:(.text+0x17bf): undefined reference to `event_sigcb'
collect2: ld returned 1 exit status
make: *** [arpd] Error 1
解决方法:
删除或注释掉arpd.c文件的448、450、467、468、527行,即下列行:
448:// extern int event_gotsig;
450:// event_gotsig = 1;
468://extern int (*event_sigcb)(void);
527://event_sigcb = arpd_signal;
问题3:
[root@ lib]# ./arpd/arpd
./arpd/arpd: error while loading shared libraries: libevent-.so.2: cannot open shared object file: No such file or directory
解决方法:
方法一:直接把libevent-so.2文件拷贝到系统指定的/usr/lib库文件目录中。
方法二:设置/etc/ld.so.conf文件,编辑该文件,在文件中加入libevent-so.2所在的目录,保存后退出。需要注意的是,每次改动ld.so.conf之后需要运行ldconfing来确认刷新。