JUST DO IT ~

          我只想當(dāng)個(gè)程序員

          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);
          這方法,是要打開一個(gè)宏定義.
          #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: 無法解析的外部符號(hào) _OPENSSL_ia32_cpu
          id,該符號(hào)在函數(shù) _OPENSSL_cpuid_setup 中被引用
          libeay32.lib(sha1dgst.obj) : error LNK2019: 無法解析的外部符號(hào) _sha1_block_data_
          order,該符號(hào)在函數(shù) _SHA1_Update 中被引用
          libeay32.lib(sha256.obj) : error LNK2019: 無法解析的外部符號(hào) _sha256_block_data_
          order,該符號(hào)在函數(shù) _SHA256_Update 中被引用
          libeay32.lib(sha512.obj) : error LNK2019: 無法解析的外部符號(hào) _sha512_block_data_
          order,該符號(hào)在函數(shù) _SHA512_Final 中被引用
          libeay32.lib(md5_dgst.obj) : error LNK2019: 無法解析的外部符號(hào) _md5_block_asm_da
          ta_order,該符號(hào)在函數(shù) _MD5_Update 中被引用
          out32\md4test.exe : fatal error LNK1120: 6 個(gè)無法解析的外部命令
          NMAKE : fatal error U1077: “"c:\Program Files (x86)\Microsoft Visual Studio 10.
          0\VC\BIN\link.EXE"”: 返回代碼“0x460”
          Stop.
          bufferevent_openssl.c
          Microsoft (R) 程序維護(hù)實(shí)用工具 10.00.30319.01 版
          版權(quán)所有(C) Microsoft Corporation。保留所有權(quán)利。
                  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
          國外一個(gè)類似memcache產(chǎn)品 openssl+ libevent 客戶端
          http://www.aerospike.com/docs/client/libevent/build/windows.html

          構(gòu)建靜態(tài)庫:
          http://developer.covenanteyes.com/building-openssl-for-visual-studio/

          Linux 匯編器:對(duì)比 GAS 和 NASM
          http://www.ibm.com/developerworks/cn/linux/l-gas-nasm.html

          posted on 2015-07-01 10:36 小高 閱讀(2596) 評(píng)論(0)  編輯  收藏 所屬分類: CNetwork| Socket | 進(jìn)程間通訊工作環(huán)境搭建

          導(dǎo)航

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

          統(tǒng)計(jì)

          常用鏈接

          留言簿(3)

          隨筆分類(352)

          收藏夾(19)

          關(guān)注的blog

          手冊

          搜索

          積分與排名

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 沂源县| 宁化县| 固始县| 临城县| 龙川县| 上思县| 沾化县| 郁南县| 石景山区| 杭州市| 利辛县| 镇坪县| 阜南县| 新营市| 阜城县| 礼泉县| 乳山市| 曲水县| 永顺县| 永仁县| 开阳县| 威远县| 平利县| 攀枝花市| 衡阳市| 萨嘎县| 德州市| 黎城县| 临潭县| 青海省| 信丰县| 中西区| 珲春市| 黑山县| 洛扎县| 博客| 宁津县| 五寨县| 鹿邑县| 琼海市| 扶风县|