![cover](https://img-blog.csdnimg.cn/f3da556c7ceb46a1aba4248766322ff6.png)
quiche编译
netty http3使用了rust语言的quiche,quiche使用了c++语言的boringssl,网上没有找到编译好的quiche,只能自己搭建rust环境编译。
·
netty http3使用了rust语言的quiche,quiche使用了c++语言的boringssl,
网上没有找到编译好的quiche,只能自己搭建rust环境编译
1、rust安装
见官网https://www.rust-lang.org/tools/install
我是用的是windows的ubuntu,所以直接使用:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
2、其他基础库
需要安装cmake、go、perl等,如果没有安装,编译过程也会提示
sudo apt install cmake
sudo apt install golang
sudo apt install perl
3、下载quiche代码和boringssl代码
将boringssl代码放到quiche/deps/boringssl/
https://github.com/cloudflare/quiche
https://github.com/google/boringssl.git
4、编译quiche
QUICHE_BSSL_PATH="/mnt/d/codeC/quiche-0.6.0/deps/boringssl" cargo build
这时会出现错误:
error: could not find native static library `crypto`, perhaps an -L flag is missing?
error: could not compile `quiche` (lib) due to previous error
修改quiche/src/build.rs:
println!(“cargo:rustc-link-search=native={}”, build_dir);
修改为:
println!("cargo:rustc-link-search=native={}/crypto", build_dir);
println!("cargo:rustc-link-search=native={}/ssl", build_dir);
5、编译boringssl
cd boringssl
mkdir build
cmake ..
make
这时有可能提示:
= note: /usr/bin/ld: /mnt/d/codeC/quiche-0.6.0/deps/boringssl/build//crypto/libcrypto.a(bcm.c.o): relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
修改boringssl下面的CMakeLists,在合适位置加上:
然后重新生成makefile并重新编译:
cd build
cmake ..
make clean
make
再按照上文重新编译quiche,如果还是报错,手动替换掉target目录下旧的libcrypto.a文件
更多推荐
所有评论(0)