安装libreswan时遇到如下的错误:
/data/l2tp/l2tp/libreswan-3.17/programs/pluto/state.c:800: undefined reference to event_free'
init_event_base':
server.o: In function
/data/l2tp/l2tp/libreswan-3.17/programs/pluto/server.c:582: undefined reference to evthread_make_base_notifiable'
pluto_event_new':
server.o: In function
/data/l2tp/l2tp/libreswan-3.17/programs/pluto/server.c:442: undefined reference to event_new'
pluto_event_free':
server.o: In function
/data/l2tp/l2tp/libreswan-3.17/programs/pluto/server.c:588: undefined reference to event_free'
event_free'
/data/l2tp/l2tp/libreswan-3.17/programs/pluto/server.c:589: undefined reference to
/data/l2tp/l2tp/libreswan-3.17/programs/pluto/server.c:590: undefined reference to event_free'
event_free'
/data/l2tp/l2tp/libreswan-3.17/programs/pluto/server.c:591: undefined reference to
timer.o: In function delete_pluto_event':
event_free'
/data/l2tp/l2tp/libreswan-3.17/programs/pluto/timer.c:814: undefined reference to
ikev2_parent.o:/data/l2tp/l2tp/libreswan-3.17/programs/pluto/ikev2_parent.c:2704: more undefined references to event_free' follow
evthread_set_condition_callbacks'
/usr/local/lib/libevent_pthreads.so: undefined reference to
/usr/local/lib/libevent_pthreads.so: undefined reference to event_mm_malloc_'
event_mm_free_'
/usr/local/lib/libevent_pthreads.so: undefined reference to
/usr/local/lib/libevent_pthreads.so: undefined reference to evthread_set_id_callback'
evthread_set_lock_callbacks'
/usr/local/lib/libevent_pthreads.so: undefined reference to
collect2: ld returned 1 exit status
make[3]: *** [pluto] Error 1
make[3]: Leaving directory /data/l2tp/l2tp/libreswan-3.17/OBJ.linux.x86_64/programs/pluto'
/data/l2tp/l2tp/libreswan-3.17/programs/pluto'
make[2]: *** [local-base] Error 2
make[2]: Leaving directory
make[1]: *** [all] Error 2
make[1]: Leaving directory `/data/l2tp/l2tp/libreswan-3.17/programs'
make: *** [all] Error 2
libreswan-3.17 install failed.
问题分析:
1. 检查libreswan的版本和代码包的正确性,去官网下载比对,确认下载是最新的代码。
2. 查看日志,根据event_free关键词,判断出问题的应该是libevent库,所以确认libevent,发现已经按照说明成功下载了libevent2了。
3. 继续查找日志细节:
---> Package libevent2.x86_64 0:2.0.21-2.el6 will be installed
--> Processing Conflict: libevent2-devel-2.0.21-2.el6.x86_64 conflicts libevent-devel
--> Finished Dependency Resolution
Error: libevent2-devel conflicts with libevent-devel-1.4.13-4.el6.x8664
从上面的提示看到是libevent2跟系统默认自带的libevent冲突了
解决:
yum remove libevent-devel-1.4.13-4.el6.x86_64
yum install libevent2-devel