(0)环境
操作系统:WIN7 SP1 x64
mingw:gcc version 4.9.2 (i686-posix-dwarf-rev1, Built by MinGW-W64 project)
libevent:libevent-2.0.22-stable
(1)修改配置文件
修改libevent源码目录下的WIN32-Code/event2/event-config.h文件,添加#define _EVENT_HAVE_STRTOK_R 1
(2)创建Makefile文件
在libevent源码目录下新建文件Makefile.mingw,内容如下(注意需要按照Makefile的格式自己处理一下空格和Tab缩进):
- SRCS = $(wildcard *.c)
- OBJS = $(patsubst %.c, %.o, $(SRCS))
- CFLAGS = -Wall -c
- INCLUDES = -I. -I./include -I./WIN32-Code -I./compat
- CC = gcc
- AR = ar
- CORE_OBJS=event.o buffer.o bufferevent.o bufferevent_sock.o \
- bufferevent_pair.o listener.o evmap.o log.o evutil.o \
- strlcpy.o signal.o bufferevent_filter.o evthread.o \
- bufferevent_ratelim.o evutil_rand.o
- WIN_OBJS=win32select.o evthread_win32.o buffer_iocp.o \
- event_iocp.o bufferevent_asyn