谷歌目前要求所有库都必须支持arm64架构所以32位libevent不允许上架了。 编译版本 libevent-2.0.22-stable ndk14b ?
解压libevent-2.0.22-stable 执行 ./configure
make 编写 Android.mk
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_ARM_MODE := arm LOCAL_MODULE := libevent LIB_SRC := event.c \ ?????????? evthread.c \ ?????????? buffer.c \ ?????????? bufferevent.c \ ?????????? bufferevent_filter.c \ ?????????? bufferevent_pair.c \ ?????????? listener.c \ ?????????? bufferevent_ratelim.c \ ?????????? evmap.c \ ?????????? log.c \ ?????????? evutil.c \ ?????????? evutil_rand.c \ ?????????? select.c \ ?????????? poll.c \ ?????????? epoll.c \ ?????????? signal.c \ ?????????? event_tagging.c \ ?????????? http.c \ ?????????? evdns.c \ ?????????? evrpc.c \ ?????????? bufferevent_sock.c
LOCAL_SRC_FILES? := $(LIB_SRC) LOCAL_C_INCLUDES := $(LOCAL_PATH)/include \ ??????????????????? $(LOCAL_PATH)/compat LOCAL_CFLAGS += -pie -fPIE -static -fPIC include $(BUILD_STATIC_LIBRARY)
3. 编译 Application.mk
APP_STL????? := c++_static APP_CPPFLAGS := -frtti -std=c++11 APP_ABI????? := armeabi-v7a arm64-v8a x86 #APP_ABI???? := armeabi-v7a
在include/event2/event-config.h 注释以下定义 ?
1. error: 'sys/sysctl.h' file not found
?? 注释定义? #define EVENT__HAVE_SYS_SYSCTL_H 1
2. error: use of undeclared identifier 'fd_mask'
?? 注释定义? #define EVENT__HAVE_FD_MASK 1
还有其他得只要报错哪个注释哪个就编译完成了。
如果报stderr之类的 标准库的错误,是因为ndk15开始,不在进行标准库同时打包,需将NDK对应API设定为固定版本号如21
编译好的 .a静态库文件 ?
链接: https://pan.baidu.com/s/1KfbpEijZbJIzd9OSRUGv3g?pwd=srh5 提取码: srh5 复制这段内容后打开百度网盘手机App,操作更方便哦? --来自百度网盘超级会员v7的分享
|