关于编译错误解决请查看前置文章: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工具 libevent-2.1.8-stable.tar.gz openssl-1.1.1.tar.gz zlib-1.2.11.tar.gz
解压至工作文件夹:D:\libevent_project
编译后存放文件夹:D:\libevent_project\build_project_vs2019_64
工作文件夹下 新建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============" pause
工作文件夹下 新建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============" pause
修改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============" pause