Follow the instructions in the README to first execute the Configure
The output information below is for the detection of the machine where the source code is compiled
[[email protected] libevent-2.0.21-stable]#./configure checking for a bsd-compatible install .../usr/bin/install-c ... configure:creating./config.statusconfig.status:creating libevent.pcconfig.status:creating Libevent_ Openssl.pcconfig.status:creating libevent_pthreads.pcconfig.status:creating Makefileconfig.status:creating Include/makefileconfig.status:creating test/makefileconfig.status:creating sample/makefileconfig.status:creating Config.hconfig.status:config.h is unchangedconfig.status:executing depfiles commandsconfig.status:executing libtool Commands[[email protected] libevent-2.0.21-stable]#
Next, execute make (only the library files we care about)
[[email protected] libevent-2.0.21-stable]# make ... "Generate libevent-2.0.so.5.1.9 file" Libtool:link:gcc-shared-fpic- Dpic. libs/event.o. LIBS/EVTHREAD.O libs/buffer.o libs/bufferevent.o. libs/bufferevent_sock.o. Libs/bufferevent_ FILTER.O. libs/bufferevent_pair.o. LIBS/LISTENER.O libs/bufferevent_ratelim.o libs/evmap.o. libs/log.o. libs/ EVUTIL.O. LIBS/EVUTIL_RAND.O libs/strlcpy.o. LIBS/POLL.O libs/epoll.o. libs/signal.o. Libs/event_ TAGGING.O. libs/http.o. libs/evdns.o. Libs/evrpc.o-lrt-o2-wl,-soname-wl,libevent-2.0.so.5-o. Libs/libevent-2.0.s o.5.1.9 "Creating soft links to libevent.so and libevent-2.0.so.5 to libevent-2.0.so.5.1.9" Libtool:link: (CD ". Libs" && rm-f "Libev Ent-2.0.so.5 "&& ln-s" libevent-2.0.so.5.1.9 "" Libevent-2.0.so.5 ") Libtool:link: (CD". Libs "&& Rm-f" Li Bevent.so "&& ln-s" libevent-2.0.so.5.1.9 "" libevent.so ")" Generate Libevent.a File "Libtool:link:ar cru. Libs/libevent. A event.o evthread.o buffer.o bufferevent.o BufferevENT_SOCK.O bufferevent_filter.o bufferevent_pair.o listener.o bufferevent_ratelim.o evmap.o log.o EVUTIL.O Evutil_ RAND.O strlcpy.o select.o poll.o epoll.o signal.o event_tagging.o http.o evdns.o evrpc.olibtool:link:ranlib. Libs/libeve Nt.alibtool:link: (CD ". Libs" && rm-f "libevent.la" && ln-s ". /libevent.la "libevent.la") "Generate libevent_core-2.0.so.5.1.9 File" Libtool:link:gcc-shared-fpic-dpic. libs/event.o. lib S/EVTHREAD.O. libs/buffer.o. LIBS/BUFFEREVENT.O libs/bufferevent_sock.o. libs/bufferevent_filter.o. libs/ BUFFEREVENT_PAIR.O. libs/listener.o. LIBS/BUFFEREVENT_RATELIM.O libs/evmap.o libs/log.o. libs/evutil.o. libs/ EVUTIL_RAND.O. libs/strlcpy.o. LIBS/SELECT.O libs/poll.o. libs/epoll.o. Libs/signal.o-lrt-o2-wl,-soname-wl,libev Ent_core-2.0.so.5-o. libs/libevent_core-2.0.so.5.1.9 "Establishing libevent_core.so and libevent_core-2.0.so.5 to Libevent_ core-2.0.so.5.1.9 Soft Link "Libtool:link: (CD". Libs "&& rm-f" libevent_core-2.0.so.5 "&& ln-s"libevent_core-2.0.so.5.1.9 "" Libevent_core-2.0.so.5 ") Libtool:link: (CD". Libs "&& rm-f" libevent_core.so " && ln-s "libevent_core-2.0.so.5.1.9" "libevent_core.so") "Generate Libevent_core.a File" Libtool:link:ar cru. libs/ Libevent_core.a event.o evthread.o buffer.o bufferevent.o bufferevent_sock.o bufferevent_filter.o bufferevent_pair.o LISTENER.O bufferevent_ratelim.o evmap.o log.o evutil.o evutil_rand.o strlcpy.o select.o poll.o epoll.o signal.olibtool: Link:ranlib. Libs/libevent_core.alibtool:link: (CD ". Libs" && rm-f "libevent_core.la" && ln-s ". /libevent_core.la "libevent_core.la") "Generate libevent_extra-2.0.so.5.1.9 File" Libtool:link:gcc-shared-fpic-dpic. libs/e VENT_TAGGING.O. libs/http.o. libs/evdns.o. Libs/evrpc.o-lrt-o2-wl,-soname-wl,libevent_extra-2.0.so.5-o. Libs/lib event_extra-2.0.so.5.1.9 "Creating soft links to libevent_extra.so and libevent_extra-2.0.so.5 to libevent_extra-2.0.so.5.1.9" Libtool: Link: (CD ". Libs" && rm-f "libevent_extra-2.0.so.5 "&& ln-s" libevent_extra-2.0.so.5.1.9 "" Libevent_extra-2.0.so.5 ") Libtool:link: (CD". Libs "& & Rm-f "libevent_extra.so" && ln-s "libevent_extra-2.0.so.5.1.9" "libevent_extra.so") "Generate LIBEVENT_EXTRA.A File "Libtool:link:ar cru. LIBS/LIBEVENT_EXTRA.A event_tagging.o http.o evdns.o evrpc.olibtool:link:ranlib. Libs/libeven T_extra.alibtool:link: (CD ". Libs" && rm-f "libevent_extra.la" && ln-s ". /libevent_extra.la "" libevent_extra.la ")" Generate libevent_pthreads-2.0.so.5.1.9 File "Libtool:link:gcc-shared-fpic-dpic. L Ibs/evthread_pthread.o-lrt-o2-wl,-soname-wl,libevent_pthreads-2.0.so.5-o. libs/libevent_pthreads-2.0.so.5.1.9 "built Libevent_pthreads.so and libevent_pthreads-2.0.so.5 to libevent_pthreads-2.0.so.5.1.9 soft link "Libtool:link: (CD". Libs "& amp;& rm-f "libevent_pthreads-2.0.so.5" && ln-s "libevent_pthreads-2.0.so.5.1.9" "Libevent_ Pthreads-2.0.so.5 ") Libtool:link: (CD". Libs "&& rm-f" LIBEVENT_PTHREADS.SO "&& ln-s" libevent_pthreads-2.0.so.5.1.9 "" libevent_pthreads.so ")" Generate Libevent_pthreads.a file "Libtool:link: Ar cru. Libs/libevent_pthreads.a evthread_pthread.olibtool:link:ranlib. Libs/libevent_pthreads.alibtool:link: (CD ". Libs "&& rm-f" libevent_pthreads.la "&& ln-s" ... /libevent_pthreads.la "" libevent_pthreads.la ")" Generate libevent_openssl-2.0.so.5.1.9 file "Libtool:link:gcc-shared-fpic- Dpic. Libs/bufferevent_openssl.o-lssl-lcrypto-lrt-o2-wl,-soname-wl,libevent_openssl-2.0.so.5-o. libs/libevent _openssl-2.0.so.5.1.9 "Build libevent_openssl.so and libevent_openssl-2.0.so.5 to libevent_openssl-2.0.so.5.1.9 soft links" Libtool:link: (CD ". Libs" && rm-f "libevent_openssl-2.0.so.5" && ln-s "libevent_openssl-2.0.so.5.1.9" " Libevent_openssl-2.0.so.5 ") Libtool:link: (CD". Libs "&& rm-f" libevent_openssl.so "&& ln-s" Libevent_o penssl-2.0.so.5.1.9 "libevent_openssl.so") "Generate Libevent_openssl.a File" Libtool:link:ar cru. Libs/libeVENT_OPENSSL.A bufferevent_openssl.olibtool:link:ranlib. Libs/libevent_openssl.alibtool:link: (CD ". Libs" & & Rm-f "libevent_openssl.la" && ln-s ". /libevent_openssl.la "" libevent_openssl.la ") ... [[email protected] libevent-2.0.21-stable]#
finally specify the Make install command
[email protected] libevent-2.0.21-stable]# make install ... (Install the library file into the system directory) ... (Change permissions and add index to. a files) [[email protected] libevent-2.0.21-stable]#
at this point, you can see that the generated file is already in the system.
[[email protected] ~]# updatedb[[email protected] ~]# Locate libevent.../usr/local/lib/libevent-2.0.so.5/ usr/local/lib/libevent-2.0.so.5.1.9/usr/local/lib/libevent.a/usr/local/lib/libevent.la/usr/local/lib/ libevent.so/usr/local/lib/libevent_core-2.0.so.5/usr/local/lib/libevent_core-2.0.so.5.1.9/usr/local/lib/ Libevent_core.a/usr/local/lib/libevent_core.la/usr/local/lib/libevent_core.so/usr/local/lib/libevent_ Extra-2.0.so.5/usr/local/lib/libevent_extra-2.0.so.5.1.9/usr/local/lib/libevent_extra.a/usr/local/lib/libevent _extra.la/usr/local/lib/libevent_extra.so/usr/local/lib/libevent_openssl-2.0.so.5/usr/local/lib/libevent_ Openssl-2.0.so.5.1.9/usr/local/lib/libevent_openssl.a/usr/local/lib/libevent_openssl.la/usr/local/lib/libevent _openssl.so/usr/local/lib/libevent_pthreads-2.0.so.5/usr/local/lib/libevent_pthreads-2.0.so.5.1.9/usr/local/ lib/libevent_pthreads.a/usr/local/lib/libevent_pthreads.la/usr/local/lib/libevent_pthreads.so/usr/local/lib/ Pkgconfig/libevent.pc/usr/local/lib/pkGconfig/libevent_openssl.pc/usr/local/lib/pkgconfig/libevent_pthreads.pc[[email protected] ~]#
By organizing the Make output above, you will know what is included in compiling each library and what options are used
"Generate libevent-2.0.so.5.1.9 file"
Libtool:link:gcc-shared-fpic-dpic
. LIBS/EVENT.O
. LIBS/EVTHREAD.O
. LIBS/BUFFER.O
. LIBS/BUFFEREVENT.O
. LIBS/BUFFEREVENT_SOCK.O
. LIBS/BUFFEREVENT_FILTER.O
. LIBS/BUFFEREVENT_PAIR.O
. LIBS/LISTENER.O
. LIBS/BUFFEREVENT_RATELIM.O
. LIBS/EVMAP.O
. LIBS/LOG.O
. LIBS/EVUTIL.O
. LIBS/EVUTIL_RAND.O
. LIBS/STRLCPY.O
. LIBS/SELECT.O
. LIBS/POLL.O
. LIBS/EPOLL.O
. LIBS/SIGNAL.O
. LIBS/EVENT_TAGGING.O
. LIBS/HTTP.O
. LIBS/EVDNS.O
. LIBS/EVRPC.O
-lrt-o2-wl,-soname-wl,libevent-2.0.so.5-o. libs/libevent-2.0.so.5.1.9
"Generate libevent_core-2.0.so.5.1.9 file"
Libtool:link:gcc-shared-fpic-dpic
. LIBS/EVENT.O
. LIBS/EVTHREAD.O
. LIBS/BUFFER.O
. LIBS/BUFFEREVENT.O
. LIBS/BUFFEREVENT_SOCK.O
. LIBS/BUFFEREVENT_FILTER.O
. LIBS/BUFFEREVENT_PAIR.O
. LIBS/LISTENER.O
. LIBS/BUFFEREVENT_RATELIM.O
. LIBS/EVMAP.O
. LIBS/LOG.O
. LIBS/EVUTIL.O
. LIBS/EVUTIL_RAND.O
. LIBS/STRLCPY.O
. LIBS/SELECT.O
. LIBS/POLL.O
. LIBS/EPOLL.O
. LIBS/SIGNAL.O
-lrt-o2-wl,-soname-wl,libevent_core-2.0.so.5-o. libs/libevent_core-2.0.so.5.1.9
"Generate libevent_extra-2.0.so.5.1.9 file"
Libtool:link:gcc-shared-fpic-dpic
. LIBS/EVENT_TAGGING.O
. LIBS/HTTP.O
. LIBS/EVDNS.O
. LIBS/EVRPC.O
-lrt-o2-wl,-soname-wl,libevent_extra-2.0.so.5-o. libs/libevent_extra-2.0.so.5.1.9
"Generate libevent_pthreads-2.0.so.5.1.9 file"
Libtool:link:gcc-shared-fpic-dpic
. LIBS/EVTHREAD_PTHREAD.O
-lrt-o2-wl,-soname-wl,libevent_pthreads-2.0.so.5-o. libs/libevent_pthreads-2.0.so.5.1.9
"Generate libevent_openssl-2.0.so.5.1.9 file"
Libtool:link:gcc-shared-fpic-dpic
. LIBS/BUFFEREVENT_OPENSSL.O
-lssl-lcrypto-lrt-o2-wl,-soname-wl,libevent_openssl-2.0.so.5-o. libs/libevent_openssl-2.0.so.5.1.9
as you can see from the content contained in the library file,
libevent = libevent_core + Libevent_extra
The libevent_pthreads and Libevent_openssl are two dedicated libraries.
people on the Web are given the following suggestions for use:
- Libevent the 2.0 release, it is recommended that you do not link the Libevent library directly, but that you should link libraries such as libevent_core and Libevent_extra as needed
- Libevent_core provides Event_base, Evbuffer, bufferevent, utility and other common methods
- Libevent_extra provides advanced features such as HTTP, DNS, and RPC
- If you use libevent in multiple threads, you also need to link the Libevent_pthreads library
- If SSL is used, you need to link the Libevent_openssl library again
"Original" source code compilation libevent-2.0.21-stable generated library file description