ELK系列--justniffer0.5.12安装报错解决方法
现象:
justniffer的0.5.12(安装后显示0.5.13版本)安装过程中需要升级boost至1.46以上版本,同时在make时会出现如下报错:
/opt/Python-2.6.6/Python/dynload_shlib.c:94: undefined reference to `dlsym'
/opt/Python-2.6.6/Python/dynload_shlib.c:130: undefined reference to `dlopen'
/opt/Python-2.6.6/Python/dynload_shlib.c:141: undefined reference to `dlsym'
/opt/Python-2.6.6/Python/dynload_shlib.c:133: undefined reference to `dlerror'
/usr/local/lib/libpython2.6.a(thread.o): In function `PyThread_acquire_lock':
/opt/Python-2.6.6/Python/thread_pthread.h:349: undefined reference to `sem_wait'
/usr/local/lib/libpython2.6.a(thread.o): In function `PyThread_release_lock':
/opt/Python-2.6.6/Python/thread_pthread.h:374: undefined reference to `sem_post'
/usr/local/lib/libpython2.6.a(thread.o): In function `PyThread_start_new_thread':
/opt/Python-2.6.6/Python/thread_pthread.h:181: undefined reference to `pthread_create'
/opt/Python-2.6.6/Python/thread_pthread.h:197: undefined reference to `pthread_detach'
/opt/Python-2.6.6/Python/thread_pthread.h:171: undefined reference to `pthread_attr_setstacksize'
/usr/local/lib/libpython2.6.a(thread.o): In function `PyThread_allocate_lock':
/opt/Python-2.6.6/Python/thread_pthread.h:296: undefined reference to `sem_init'
/usr/local/lib/libpython2.6.a(thread.o): In function `PyThread_free_lock':
/opt/Python-2.6.6/Python/thread_pthread.h:320: undefined reference to `sem_destroy'
/usr/local/lib/libpython2.6.a(thread.o): In function `PyThread_acquire_lock':
/opt/Python-2.6.6/Python/thread_pthread.h:351: undefined reference to `sem_trywait'
/opt/Python-2.6.6/Python/thread_pthread.h:349: undefined reference to `sem_wait'
/usr/local/lib/libpython2.6.a(thread.o): In function `PyThread_release_lock':
/opt/Python-2.6.6/Python/thread_pthread.h:374: undefined reference to `sem_post'
/usr/local/lib/libpython2.6.a(thread.o): In function `_pythread_pthread_set_stacksize':
/opt/Python-2.6.6/Python/thread_pthread.h:519: undefined reference to `pthread_attr_setstacksize'
/usr/local/lib/libpython2.6.a(thread.o): In function `PyThread_allocate_lock':
/opt/Python-2.6.6/Python/thread_pthread.h:296: undefined reference to `sem_init'
/usr/local/lib/libpython2.6.a(thread.o): In function `PyThread_acquire_lock':
/opt/Python-2.6.6/Python/thread_pthread.h:349: undefined reference to `sem_wait'
/usr/local/lib/libpython2.6.a(thread.o): In function `PyThread_release_lock':
/opt/Python-2.6.6/Python/thread_pthread.h:374: undefined reference to `sem_post'
/usr/local/lib/libpython2.6.a(thread.o): In function `PyThread_acquire_lock':
/opt/Python-2.6.6/Python/thread_pthread.h:349: undefined reference to `sem_wait'
/usr/local/lib/libpython2.6.a(thread.o): In function `PyThread_release_lock':
/opt/Python-2.6.6/Python/thread_pthread.h:374: undefined reference to `sem_post'
/usr/local/lib/libpython2.6.a(thread.o): In function `PyThread_allocate_lock':
/opt/Python-2.6.6/Python/thread_pthread.h:296: undefined reference to `sem_init'
/usr/local/lib/libpython2.6.a(posixmodule.o): In function `posix_openpty':
posixmodule.c:(.text+0x1074): undefined reference to `openpty'
/usr/local/lib/libpython2.6.a(posixmodule.o): In function `posix_forkpty':
posixmodule.c:(.text+0x261c): undefined reference to `forkpty'
collect2: error: ld returned 1 exit status
make[1]: *** [justniffer] Error 1
make[1]: Leaving directory `/opt/justniffer-penuel-leo/justniffer-penuel-leo/src'
make: *** [all-recursive] Error 1
谷歌N久:collect2: error: ld returned 1 exit status,也没有发现太多类似问题。
最后谷歌:posixmodule.c:(.text+0x261c): undefined reference to `forkpty'和/opt/Python-2.6.6/Python/thread_pthread.h:296: undefined reference to `sem_init'发现原因和解决方案:
解决方案:
vi Makefile 和vi src/MakefileLIBS = -pthread -lm -lz -ldl -lutil
-ldl -lutil是解决c的问题
-pthread是解决python的问题
如果还不行,可以再增加: -lm -lz