JUST DO IT ~

我只想当个程序员

make libevent with openssl on windows

make libevent with openssl on windows
build: 
libevent-2.0.22-stable
openssl-1.0.2c 
1.build openssl 
  
If you want to build openssl In Windows ,  You must install nasm && perl . 
1)downs lib
   
  https://www.openssl.org/related/binaries.html  
  copy c:\openssl 
 
2)build lib
2.1)
   setup  nasm tools .
   http://nasm.sourceforge.net/
   setup perl .
   http://downloads.activestate.com/ActivePerl/releases/5.18.4.1804/ActivePerl-5.18.4.1804-MSWin32-x64-298913.msi
2.2)  
   perl Configure VC-WIN32 --prefix=c:\openssl
2.3)
   ms\do_nasm
2.4)
  nmake -f ms\ntdll.mak
  nmake -f ms\ntdll.mak test
  nmake -f ms\ntdll.mak install
You can also build a static version of the library using the Makefile
ms\nt.mak

readme:  
https://github.com/openssl/openssl/blob/master/INSTALL.W32

2.build libevent 

wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar xvf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.X-stable
set OPENSSL_DIR=c:\openssl
nmake -f makefile.nmake

but, makefile.nmake haven't support ssl.

You have 2 choose.

one :   down   makefile.nmake at  https://github.com/libevent/libevent/blob/master/Makefile.nmake
        you need add  /DWIN32 at CFLAGS 
two:
 makefile.nmake

# WATCH OUT!  This makefile is a work in progress.             -*- makefile -*-
#
# I'm not very knowledgeable about MSVC and nmake beyond their most basic
# aspects.  If anything here looks wrong to you, please let me know.
# If OPENSSL_DIR is not set, builds without OpenSSL support.  If you want
# OpenSSL support, you can set the OPENSSL_DIR variable to where you
# installed OpenSSL.  This can be done in the environment:
#   set OPENSSL_DIR=c:\openssl
# Or on the nmake command line:
#   nmake OPENSSL_DIR=C:\openssl -f Makefile.nmake
# Or by uncommenting the following line here in the makefile...
# OPENSSL_DIR=c:\openssl
!IFDEF OPENSSL_DIR
SSL_CFLAGS=/I$(OPENSSL_DIR)\include /DEVENT__HAVE_OPENSSL
!ELSE
SSL_CFLAGS=
!ENDIF
# Needed for correctness
CFLAGS=/IWIN32-Code /IWIN32-Code/nmake /Iinclude /Icompat /DHAVE_CONFIG_H  /DWIN32 /I. $(SSL_CFLAGS)
# For optimization and warnings
CFLAGS=$(CFLAGS) /Ox /W3 /wd4996 /MTd /nologo 
# XXXX have a debug mode
LIBFLAGS=/nologo
CORE_OBJS=event.obj buffer.obj bufferevent.obj bufferevent_sock.obj \
bufferevent_pair.obj listener.obj evmap.obj log.obj evutil.obj \
strlcpy.obj signal.obj bufferevent_filter.obj evthread.obj \
bufferevent_ratelim.obj evutil_rand.obj 
WIN_OBJS=win32select.obj evthread_win32.obj buffer_iocp.obj \
event_iocp.obj bufferevent_async.obj
EXTRA_OBJS=event_tagging.obj http.obj evdns.obj evrpc.obj
!IFDEF OPENSSL_DIR
SSL_OBJS=bufferevent_openssl.obj
SSL_LIBS=libevent_openssl.lib
!ELSE
SSL_OBJS=
SSL_LIBS=
!ENDIF
ALL_OBJS=$(CORE_OBJS) $(WIN_OBJS) $(EXTRA_OBJS) $(SSL_OBJS)
STATIC_LIBS=libevent_core.lib libevent_extras.lib libevent.lib $(SSL_LIBS)
all: static_libs tests
static_libs: $(STATIC_LIBS)
libevent_core.lib: $(CORE_OBJS) $(WIN_OBJS)
lib $(LIBFLAGS) $(CORE_OBJS) $(WIN_OBJS) /out:libevent_core.lib 
libevent_extras.lib: $(EXTRA_OBJS)
lib $(LIBFLAGS) $(EXTRA_OBJS) /out:libevent_extras.lib
libevent.lib: $(CORE_OBJS) $(WIN_OBJS) $(EXTRA_OBJS)
lib $(LIBFLAGS) $(CORE_OBJS) $(EXTRA_OBJS) $(WIN_OBJS) /out:libevent.lib
libevent_openssl.lib: $(SSL_OBJS)
lib $(LIBFLAGS) $(SSL_OBJS) /out:libevent_openssl.lib
clean:
del $(ALL_OBJS)
del $(STATIC_LIBS)
tests:
!IFDEF OPENSSL_DIR
 
!ELSE
 
!ENDIF
 
----------------------------------------------------------------
c:\openssl>tree
C:.
├─bin
├─include
│  └─openssl
├─lib
│  └─engines
└─ssl
c:\openssl>
提示找不到 unsigned long bufferevent_get_openssl_error(struct bufferevent *bev);
这方法,是要打开一个宏定义.
#define _EVENT_HAVE_OPENSSL
#include <event2/bufferevent_ssl.h>
windows下编译及使用libevent
http://www.cnblogs.com/luxiaoxun/p/3603399.html
ln -s  /usr/local/ssl/include/openssl    /usr/include/openssl  
重新make就过去了
I cannot use VC build   openssl-1.0.2c , must be nasm tools .
libeay32.lib(cryptlib.obj) : error LNK2019: 无法解析的外部符号 _OPENSSL_ia32_cpu
id,该符号在函数 _OPENSSL_cpuid_setup 中被引用
libeay32.lib(sha1dgst.obj) : error LNK2019: 无法解析的外部符号 _sha1_block_data_
order,该符号在函数 _SHA1_Update 中被引用
libeay32.lib(sha256.obj) : error LNK2019: 无法解析的外部符号 _sha256_block_data_
order,该符号在函数 _SHA256_Update 中被引用
libeay32.lib(sha512.obj) : error LNK2019: 无法解析的外部符号 _sha512_block_data_
order,该符号在函数 _SHA512_Final 中被引用
libeay32.lib(md5_dgst.obj) : error LNK2019: 无法解析的外部符号 _md5_block_asm_da
ta_order,该符号在函数 _MD5_Update 中被引用
out32\md4test.exe : fatal error LNK1120: 6 个无法解析的外部命令
NMAKE : fatal error U1077: “"c:\Program Files (x86)\Microsoft Visual Studio 10.
0\VC\BIN\link.EXE"”: 返回代码“0x460”
Stop.
bufferevent_openssl.c
Microsoft (R) 程序维护实用工具 10.00.30319.01 版
版权所有(C) Microsoft Corporation。保留所有权利。
        cl /IWIN32-Code /Iinclude /Icompat /DWIN32 /DHAVE_CONFIG_H /I. /Ox /W3 /
wd4996 /nologo /MT /c bufferevent_openssl.c
bufferevent_openssl.c
bufferevent_openssl.c(60) : fatal error C1083: 无法打开包括文件:“openssl/bio.h
”: No such file or directory
NMAKE : fatal error U1077: “"c:\Program Files (x86)\Microsoft Visual Studio 10.
0\VC\BIN\cl.EXE"”: 返回代码“0x2”
Stop.
ftp://sourceware.org/pub/pthreads-win32/dll-latest
http://www.aerospike.com/docs/client/libevent/build/windows.html
Download pthread include, lib and dll folder from : ftp://sourceware.org/pub/pthreads-win32/dll-latest
国外一个类似memcache产品 openssl+ libevent 客户端
http://www.aerospike.com/docs/client/libevent/build/windows.html

构建静态库:
http://developer.covenanteyes.com/building-openssl-for-visual-studio/

Linux 汇编器:对比 GAS 和 NASM
http://www.ibm.com/developerworks/cn/linux/l-gas-nasm.html

posted on 2015-07-01 10:36 小高 阅读(2544) 评论(0)  编辑  收藏 所属分类: CNetwork| Socket | 进程间通讯工作环境搭建


只有注册用户登录后才能发表评论。


网站导航:
 

导航

<2015年7月>
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

统计

常用链接

留言簿(3)

随笔分类(352)

收藏夹(19)

关注的blog

手册

搜索

积分与排名

最新评论

阅读排行榜

评论排行榜