解决/usr/bin/ld: cannot find XXX

解决:

/usr/bin/ld: cannot find -levent
collect2: ld returned 1 exit status
make: *** [lfcserver] Error 1


查看本地 locate libevent

cd /usr/lib/
locate libevent
/soft/php-5.2.10/libevent/.deps/epoll_sub.Po
/soft/php-5.2.10/libevent/.deps/evbuffer.Po
/soft/php-5.2.10/libevent/.deps/event.Po
/soft/php-5.2.10/libevent/.deps/evport.Po
/soft/php-5.2.10/libevent/.deps/evutil.Po
/soft/php-5.2.10/libevent/.deps/http.Po
/soft/php-5.2.10/libevent/.deps/kqueue.Po
/soft/php-5.2.10/libevent/.deps/log.Po
/soft/php-5.2.10/libevent/.deps/poll.Po
/soft/php-5.2.10/libevent/.deps/select.Po
/soft/php-5.2.10/libevent/.deps/signal.Po
/soft/php-5.2.10/libevent/.deps/strlcpy.Po
/soft/php-5.2.10/libevent/compat/sys
/soft/php-5.2.10/libevent/compat/sys/_time.h
/soft/php-5.2.10/libevent/compat/sys/queue.h
/usr/lib64/libevent-1.4.so.2
/usr/lib64/libevent-1.4.so.2.1.3
/usr/lib64/libevent_core-1.4.so.2
/usr/lib64/libevent_core-1.4.so.2.1.3
/usr/lib64/libevent_extra-1.4.so.2
/usr/lib64/libevent_extra-1.4.so.2.1.3
/usr/share/doc/libevent-1.4.13
/usr/share/doc/libevent-1.4.13/README
[root@localhost lib]# ln -s /usr/lib64/libevent-1.4.so.2 libevent.so
再make 搞定


/usr/bin/ld: cannot find -lmysqlclien  解决

类似/usr/bin/ld: cannot find -xxxx的错误有很多, 首先我们可以最简单的判断一下:

这类情况一般是由于缺乏某某库文件, 又或者可能是由于已存在的库问题版本不对造成的

一般都是解决的办法就是安装缺乏的devel包就可以解决, 当然还有其他的未知因素, 我们看一个实例:

我在一台装centos5.2 x86_64的系统上配置php环境, 提示这个错误

"/usr/bin/ld: cannot find -lmysqlclient"

于是我安装了

# yum -y install mysql-devel

结果提示依旧, 


用了上面方法

locate libmysqlclient

ln -s /usr/lib64/mysql/libmysqlclient.so.15 libmysqlclient.so

搞定

你可能感兴趣的:(linux)