Download libevent:# wget http://www.monkey.org/~provos/libevent-1.2.tar.gz directly with wget instructions
then, you need to specify an installation path during configuration, that is./configure–prefix=/usr; then make; then make install;
the detailed methods are as follows:
# cd/tmp
# wget http://www.monkey.org/~provos/libevent-1.2.tar.gz
# tar zxvf libevent-1.2.tar.gz
# CD libevent-1.2
#./CONFIGURE–PREFIX=/USR
# make
# make install
(Note: There is an error when executing here:
1,no acceptable C compiler found in $PATH
because CentOS does not have GCC installed by default, use Yum to install
#yum Install gcc* make*
)
To test whether the libevent was installed successfully:
# Ls-al/usr/lib | grep libevent
lrwxrwxrwx 1 root root 21 11?? 17:38 Libevent-1.2.so.1-libevent-1.2.so.1.0.3
-rwxr-xr-x 1 root root 263546 11?? 17:38 libevent-1.2.so.1.0.3
-rw-r–r–1 root root 454156 11?? 17:38 LIBEVENT.A
-rwxr-xr-x 1 root root 811 11?? 17:38 libevent.la
lrwxrwxrwx 1 root root 21 11?? 17:38 libevent.so-libevent-1.2.so.1.0.3
Good, all installed.
The above reference http://www.cnblogs.com/yjf512/archive/2011/05/01/2033761.html everything seems very simple and very smooth, but the problem comes!!
when I write a sample program (example program as follows, program reference: http://blog.csdn.net/robertkun/article/details/7885379)
when I compile the above program, there are the following problems:
Baidu and Google are no fruit, again confirm the installation seems to have no problem, with their own only in Linux write C experience, generally speaking, may be unable to find Libevent library, or lbevent version has a problem, or installation is not complete, the code in general will not appear problems, So thinking, what is missing, or installing the wrong?
inadvertently saw an article on the Internet title: (http://www.codesky.net/article/201008/175058.html)
CentOS installation php libevent >= 1.4.11 could not be found
The article contains:
The following error occurred while installing PHP
libevent >= 1.4.11 could not being found
My installation environment is
CentOS 5
php5.2.14
The reason is that the following packages are not installed
Libevent-devel
just install the bag.
yum-y Install Libevent-devel
Although following the error message does not have anything to do with me, it is wrong to suggest some problems with my guess, OK, it's the solution is to install the missing package, then for me, should be re-install the package, anyway, a command, yum after the miracle appeared:
after reinstalling, the sample program was compiled with the
Take a look at the process and it does run correctly
at least, the problem is solved, but the cause of the problem is not clear, I hope that the next study can solve the question.
Linux under Libevent installation and example