quiche编译

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文件

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 8
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值