文章目录

关于编译错误解决请查看前置文章:​​libevent 编译与安装 (WIN10 visual studio2019, ubuntu)​

准备工作

编译x64使用工具:​​x64 Native Tools Command Prompt for VS 2019​

准备安装包依旧为:

ActivePerl-5.24.3.2404-MSWin32-x64-404865.exe # 编译openssl工具
nasm-2.13.03-win64.zip # 编译openssl工具

解压至工作文件夹:​​D:\libevent_project​​​ 编译后存放文件夹:​​D:\libevent_project\build_project_vs2019_64​

编译zlib (x64)

工作文件夹下 新建​​build_zlib_vs2019_64.bat​

@echo "==========start build zlib============"
set VS="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
set OUT="D:\libevent_project\build_project_vs2019_64\zlib"
call %VS%
cd zlib-1.2.11
nmake /f win32\Makefile.msc clean
nmake /f win32\Makefile.msc AS=ml64 LOC="-DASMV -DASMINF -I." OBJA="inffasx64.obj gvmat64.obj inffas8664.obj"
md %OUT%\lib
md %OUT%\bin
md %OUT%\include
copy /Y *.lib %OUT%\lib
copy /Y *.h %OUT%\include
copy /Y *.dll %OUT%\bin
copy /Y *.exe %OUT%\bin
@echo "==========end build zlib============"

编译openssl (x64)

工作文件夹下 新建​​build_openssl_vs2019_64.bat​​,使用管理员身份执行

@echo "==========start build openssl============"
@echo "-------please use ROOT run -------"
timeout /T 3
set VS="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
set OUT="D:\libevent_project\build_project_vs2019_64\openssl"
call %VS%
D:
cd D:\libevent_project\openssl-1.1.1
perl Configure VC-WIN64A no-asm --prefix=%OUT%
nmake clean
nmake
nmake install
@echo "==========end build openssl============"

编译libevent (x64)

修改Makefile.nmake第三十行为:​​LIBFLAGS=/nologo /MACHINE:X64​

工作文件夹下 新建​​build_libevent_vs2019_64.bat​​,使用管理员身份执行

@echo "==========start build libevent============"
set VS="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
set OUT="D:\libevent_project\build_project_vs2019_64\libevent"
call %VS%
cd D:\libevent_project\libevent-2.1.8-stable
nmake /f Makefile.nmake clean
nmake /f Makefile.nmake OPENSSL_DIR=D:\libevent_project\build_project_vs2019_64\openssl
md %OUT%\lib
md %OUT%\bin
md %OUT%\include
copy /Y *.lib %OUT%\lib
xcopy /S/Y include %OUT%\include\
xcopy /S/Y WIN32-Code\nmake %OUT%\include\
copy /Y *.dll %OUT%\bin
copy /Y *.exe %OUT%\bin
@echo "==========end build libevent============"

libevent 编译与安装二 (WIN10 visual studio2019, ubuntu) x64_工作文件