目标是要安装lsquic的依赖库boringssl
参考 BUILD-WINDOWS.md
boringssl构建方式有几种,ndk,cmake,反正都不要在win7上折腾,ndk环境不好配置,各种报错。cmake到最后nasm安装了,但是汇编还是出问题了,放弃了,还是BUILD-WINDOWS.md指示的用vcpkg装
看下依赖:
一定要在win10上进行安装,win7坑太多。我就卡在powershell6.21版本死活要netframework4,明明已经安装了4或者4.5甚至更高版本,但是检测不到,就是不行。。。
虚拟机安装win10又iso太大,通过U盘安装还没开始安装启动直接自动暂停,不继续执行了。。。不想折腾就主机重装了win10
另外因为我装的是阉割版本vs2017。编译vcpkg用到VS找不到。。。只好重新安装了vs2017,记住 语言包勾上 英语, 不然后后面vcpkg安装又会报问题。。。
vcpkg安装依赖的部分开源库下载自己找吧,默认很多资源在官网和github,速度很感人,能卡半天。最好csdn有币。。。下载后丢到vcpkg-master\installed里面重新运行vcpkg.exe就好。
主要是从安装./vcpkg.exe install zlib:x64-windows-static 开始一路报错。
1.vcpkg安装
vcpkg安装指南
2.安装powershell6.2.1版本,win10上基本没啥问题,
PowerShell-6.2.1-win-x86.zip
3.VS安装就不说了,强调下勾选上 英语 的语言包
vs2017安装英文语言包
4.安装7zip
7-zip.commandline.18.1.0.nupkg
5.安装zlib,中间还有nuget.exe和PortableGit-2.26.2-32-bit.7z.exe会自动安装,划算快
6.cmake自己下载安装吧,最新版没啥问题
7.然后安装Libevent
PS C:\vcpkg-master> .\vcpkg.exe install zlib:x64-windows-static
Computing installation plan...
The following packages will be built and installed:
zlib[core]:x64-windows-static
A suitable version of powershell-core was not found (required v6.2.1). Downloading portable powershell-core v6.2.1...
Extracting powershell-core...
A suitable version of 7zip was not found (required v18.1.0). Downloading portable 7zip v18.1.0...
Downloading 7zip...
https://www.nuget.org/api/v2/package/7-Zip.CommandLine/18.1.0 -> C:\vcpkg-master\downloads\7-zip.commandline.18.1.0.nupkg
PS C:\vcpkg-master> .\vcpkg.exe install zlib:x64-windows-static
Computing installation plan...
The following packages will be built and installed:
zlib[core]:x64-windows-static
A suitable version of powershell-core was not found (required v6.2.1). Downloading portable powershell-core v6.2.1...
Extracting powershell-core...
A suitable version of 7zip was not found (required v18.1.0). Downloading portable 7zip v18.1.0...
Downloading 7zip...
https://www.nuget.org/api/v2/package/7-Zip.CommandLine/18.1.0 -> C:\vcpkg-master\downloads**7-zip.commandline.18.1.0.nupkg**
Could not download https://www.nuget.org/api/v2/package/7-Zip.CommandLine/18.1.0. Failed to open file C:\vcpkg-master\downloads\7-zip.commandline.18.1.0.nupkg.part. Error code was 13
PS C:\vcpkg-master> .\vcpkg.exe install zlib:x64-windows-static
Computing installation plan...
The following packages will be built and installed:
zlib[core]:x64-windows-static
A suitable version of powershell-core was not found (required v6.2.1). Downloading portable powershell-core v6.2.1...
Extracting powershell-core...
A suitable version of 7zip was not found (required v18.1.0). Downloading portable 7zip v18.1.0...
Downloading 7zip...
https://www.nuget.org/api/v2/package/7-Zip.CommandLine/18.1.0 -> C:\vcpkg-master\downloads\7-zip.commandline.18.1.0.nupkg
WinHttpQueryDataAvailable() failed: 12002
PS C:\vcpkg-master> .\vcpkg.exe install zlib:x64-windows-static
Computing installation plan...
The following packages will be built and installed:
zlib[core]:x64-windows-static
A suitable version of powershell-core was not found (required v6.2.1). Downloading portable powershell-core v6.2.1...
Extracting powershell-core...
A suitable version of 7zip was not found (required v18.1.0). Downloading portable 7zip v18.1.0...
Extracting 7zip...
A suitable version of nuget was not found (required v4.8.1). Downloading portable nuget v4.8.1...
Downloading nuget...
https://dist.nuget.org/win-x86-commandline/v4.8.1/nuget.exe -> C:\vcpkg-master\downloads\nuget.exe
PS C:\vcpkg-master> .\vcpkg.exe install zlib:x64-windows-static
Computing installation plan...
The following packages will be built and installed:
zlib[core]:x64-windows-static
A suitable version of powershell-core was not found (required v6.2.1). Downloading portable powershell-core v6.2.1...
Extracting powershell-core...
A suitable version of 7zip was not found (required v18.1.0). Downloading portable 7zip v18.1.0...
Extracting 7zip...
A suitable version of nuget was not found (required v4.8.1). Downloading portable nuget v4.8.1...
Starting package 1/1: zlib:x64-windows-static
Building package zlib[core]:x64-windows-static...
Warning: The following VS instances are excluded because the English language pack is unavailable.
d:\Program Files (x86)\Microsoft Visual Studio\2017\Community
Please install the English language pack.
Could not locate a complete toolset.
The following paths were examined:
d:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat
d:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\dumpbin.exe
PS C:\vcpkg-master> .\vcpkg.exe install zlib:x64-windows-static
Computing installation plan...
The following packages will be built and installed:
zlib[core]:x64-windows-static
Starting package 1/1: zlib:x64-windows-static
Building package zlib[core]:x64-windows-static...
Warning: The following VS instances are excluded because the English language pack is unavailable.
d:\Program Files (x86)\Microsoft Visual Studio\2017\Community
Please install the English language pack.
Could not locate a complete toolset.
The following paths were examined:
d:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat
d:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\dumpbin.exe
PS C:\vcpkg-master> .\vcpkg.exe install zlib:x64-windows-static
Computing installation plan...
The following packages will be built and installed:
zlib[core]:x64-windows-static
Starting package 1/1: zlib:x64-windows-static
Building package zlib[core]:x64-windows-static...
A suitable version of git was not found (required v2.26.2). Downloading portable git v2.26.2...
Downloading git...
https://github.com/git-for-windows/git/releases/download/v2.26.2.windows.1/PortableGit-2.26.2-32-bit.7z.exe -> C:\vcpkg-master\downloads\PortableGit-2.26.2-32-bit.7z.exe
PS C:\vcpkg-master> .\vcpkg.exe install zlib:x64-windows-static
Computing installation plan...
The following packages will be built and installed:
zlib[core]:x64-windows-static
Starting package 1/1: zlib:x64-windows-static
Building package zlib[core]:x64-windows-static...
A suitable version of git was not found (required v2.26.2). Downloading portable git v2.26.2...
Extracting git...
-- Downloading http://www.zlib.net/zlib-1.2.11.tar.gz...
PS C:\vcpkg-master> .\vcpkg.exe install zlib:x64-windows-static
Computing installation plan...
The following packages will be built and installed:
zlib[core]:x64-windows-static
Starting package 1/1: zlib:x64-windows-static
Building package zlib[core]:x64-windows-static...
-- Downloading http://www.zlib.net/zlib-1.2.11.tar.gz...
PS C:\vcpkg-master> .\vcpkg.exe install zlib:x64-windows-static
Computing installation plan...
The following packages will be built and installed:
zlib[core]:x64-windows-static
Starting package 1/1: zlib:x64-windows-static
Building package zlib[core]:x64-windows-static...
-- Downloading http://www.zlib.net/zlib-1.2.11.tar.gz...
-- Extracting source C:/vcpkg-master/downloads/zlib1211.tar.gz
-- Applying patch cmake_dont_build_more_than_needed.patch
-- Using source at C:/vcpkg-master/buildtrees/zlib/src/1.2.11-deec42f53b
-- Configuring x64-windows-static
-- Building x64-windows-static-dbg
-- Building x64-windows-static-rel
-- Installing: C:/vcpkg-master/packages/zlib_x64-windows-static/share/zlib/copyright
-- Performing post-build validation
-- Performing post-build validation done
Building package zlib[core]:x64-windows-static... done
Installing package zlib[core]:x64-windows-static...
Installing package zlib[core]:x64-windows-static... done
Elapsed time for package zlib:x64-windows-static: 2.704 min
Total elapsed time: 2.704 min
The package zlib is compatible with built-in CMake targets:
find_package(ZLIB REQUIRED)
target_link_libraries(main PRIVATE ZLIB::ZLIB)
PS C:\vcpkg-master> .\vcpkg.exe install libevent:x64-windows-static
Computing installation plan...
The following packages will be built and installed:
libevent[core,thread]:x64-windows-static
Starting package 1/1: libevent:x64-windows-static
Building package libevent[core,thread]:x64-windows-static...
-- Downloading https://github.com/libevent/libevent/archive/release-2.1.11-stable.tar.gz...
-- Extracting source C:/vcpkg-master/downloads/libevent-libevent-release-2.1.11-stable.tar.gz
-- Applying patch fix-file_path.patch
-- Applying patch fix-crt_linkage.patch
-- Applying patch fix-LibeventConfig_cmake_in_path.patch
-- Using source at C:/vcpkg-master/buildtrees/libevent/src/.11-stable-734e533482
-- Configuring x64-windows-static
-- Building x64-windows-static-dbg
-- Building x64-windows-static-rel
-- Installing: C:/vcpkg-master/packages/libevent_x64-windows-static/share/libevent/copyright
-- Performing post-build validation
-- Performing post-build validation done
Building package libevent[core,thread]:x64-windows-static... done
Installing package libevent[core,thread]:x64-windows-static...
Installing package libevent[core,thread]:x64-windows-static... done
Elapsed time for package libevent:x64-windows-static: 2.505 min
Total elapsed time: 2.505 min
The package libevent:x64-windows-static provides CMake targets:
find_package(Libevent CONFIG REQUIRED)
target_link_libraries(main PRIVATE event_static event_core_static event_extra_static)
PS C:\vcpkg-master>
最终算是把zlib和libevent装上了。
8.自己装go和perl后面要用
9.自己下载安装nasm-2.14.02-installer-x64.exe汇编器
然后就可以编译了,but,将cmake加到path后调不了,全路径怎么调用懒得查了,直接cmake-gui用起来
PS E:\win\lsquic\boringssl-master\build> C:\Program\ Files\CMake\bin\cmake.exe -DCMAKE_GENERATOR_PLATFORM=x64 --config Debug -DBUILD_SHARED_LIBS=OFF -DOPENSSL_NO_ASM=1 ..
C:\Program\ : The term ‘C:\Program‘ is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
- C:\Program\ Files\CMake\bin\cmake.exe -DCMAKE_GENERATOR_PLATFORM=x64 ...
-
- CategoryInfo : ObjectNotFound: (C:\Program:String) [], CommandNotFoundException
- FullyQualifiedErrorId : CommandNotFoundException
10.用cmake-gui编
反正这些依赖项都要找到,框里的是根据lsquic中描述的boringssl的编译方式,加的,我也不知道对不对。。。
反正生成了boringssl的sln项目,vs可以打开,并且全部编译正常。。
后来确认是环境变量重启才生效。。。怀疑cmake-gui的add entry可能配置无效,重新编译了
以上就是lsquic的boringssl的编译。
就绪编译lsquic
1.先要将之前编译的boring的库放到一个目录便于lsquic使用
我是把build\crypto\Debug和build\ssl\Debug和build\decrepit\Debug下的几个库都放到了build\libs下
另外,lsquic的cmakefile会检查boringssl的头文件和库路径
cmake -DCMAKE_GENERATOR_PLATFORM=x64 -DBUILD_SHARED_LIBS=OFF -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg-master/scripts/buildsystems/vcpkg.cmake -DBORINGSSL_DIR=%boringssl% -DBORINGSSL_INCLUDE=E:/win/lsquic/boringssl-master/include -DBORINGSSL_LIB=E:/win/lsquic/boringssl-master/build/libs ..
另外为了编译不将部分部分警告视为错误,在cmakefile找到-WX改成-WX-,这样在生成sln时各项目都不会报找不到obj的警告当成错误导致编译不通过。
编译完成,有60个demo。。。