安装libevent2执行 make install时报错:

Libraries have been installed in:
   /usr/local/memcached/libevent-2.1.12-stable/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the 'LD_RUN_PATH' environment variable
     during linking
   - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to '/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
 /bin/mkdir -p '/usr/local/memcached/libevent-2.1.12-stable/include'
 /usr/bin/install -c -m 644 include/evdns.h include/event.h include/evhttp.h include/evrpc.h include/evutil.h '/usr/local/memcached/libevent-2.1.12-stable/include'
/usr/bin/install: `include/evdns.h' and `/usr/local/memcached/libevent-2.1.12-stable/include/evdns.h' are the same file
/usr/bin/install: `include/event.h' and `/usr/local/memcached/libevent-2.1.12-stable/include/event.h' are the same file
/usr/bin/install: `include/evhttp.h' and `/usr/local/memcached/libevent-2.1.12-stable/include/evhttp.h' are the same file
/usr/bin/install: `include/evrpc.h' and `/usr/local/memcached/libevent-2.1.12-stable/include/evrpc.h' are the same file
/usr/bin/install: `include/evutil.h' and `/usr/local/memcached/libevent-2.1.12-stable/include/evutil.h' are the same file
make[2]: *** [install-includeHEADERS] Error 1
make[2]: Leaving directory `/usr/local/memcached/libevent-2.1.12-stable'
make[1]: *** [install-am] Error 2
make[1]: Leaving directory `/usr/local/memcached/libevent-2.1.12-stable'
make: *** [install] Error 2
 

 

使用 sudo make install 也是同样的错误

根据错误提示信息,您安装的libevent2相关文件已经被安装到了指定的目录,但是在执行make install的过程中出现了错误,提示在安装头文件时遇到了同名文件的情况。

这种情况可以考虑手动删除已经存在的/include目录下的文件,再重新执行make install命令。

另外,建议您在执行make install命令时,使用全路径来指定libevent库文件的位置,或者使用LD_RUN_PATH/LD_LIBRARY_PATH等环境变量来指定libevent库文件的路径,以避免链接错误等问题。