今天在新开的Ubuntu虚拟机上安装libevent,本来感觉没啥需要特别注意的,因为他自带的README.md 文件就已经说清楚了如何安装"安装说明",无非就是简单的几步:
$ ./configure
$ make
$ make verify # (optional)
$ sudo make install
但是按照这个安装完后,写了一个测试程序去运行,发现他提示这类错误
error while loading shared libraries: libevent-2.xxxx ......
然后我注意到一个细节,就是我make install 成功后,libevent给出的说明信息:
Libraries have been installed in:
/usr/local/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,