jvfan opened a new issue #1469:
URL: https://github.com/apache/incubator-brpc/issues/1469
**Describe the bug (描述bug)**
WSL2-Ubuntu20.04 下编译 bRPC 不成功,总是提示找不到 BIO_fd_non_fatal_error 函数;
```
Packing libbrpc.a
Linking protoc-gen-mcpack
/usr/bin/ld: libbrpc.a(iobuf.o): in function
`butil::IOBuf::cut_multiple_into_SSL_channel(ssl_st*, butil::IOBuf* const*,
unsigned long, int*)':
/home/jerry/Public/brpc/src/butil/iobuf.cpp:1022: undefined reference to
`BIO_fd_non_fatal_error'
/usr/bin/ld: /home/jerry/Public/brpc/src/butil/iobuf.cpp:1002: undefined
reference to `BIO_fd_non_fatal_error'
/usr/bin/ld: libbrpc.a(iobuf.o): in function
`butil::IOPortal::append_from_SSL_channel(ssl_st*, int*, unsigned long)':
/home/jerry/Public/brpc/src/butil/iobuf.cpp:1695: undefined reference to
`BIO_fd_non_fatal_error'
collect2: error: ld returned 1 exit status
make: *** [Makefile:241: protoc-gen-mcpack] Error 1
```
**To Reproduce (复现方法)**
1. 安装 openssl、snappy、google-perftools、gtest
默认会安装 libxxx 到 /usr/local/lib 目录;
```
sudo apt-get install -y libssl-dev
sudo apt-get install -y libsnappy-dev
sudo apt-get install -y libgoogle-perftools-dev
sudo apt-get install -y libgtest-dev
```
2. 手动源码编译一些库 gflags、protobuf、leveldb
默认会安装 libxxx 到 /usr/local/lib 目录,已经验证 protobuf 完全正常;
3. 添加 /usr/local/bin 到环境变量
4. 执行 brpc 编译脚本如下:
```
sh config_brpc.sh --headers=/usr/include --libs=/usr/local/lib
make
```

**Expected behavior (期望行为)**
编译通过;
**Versions (各种版本)**
OS: WIN11-WSLg
Compiler: g++ 9.3.0
brpc: 0.9.7
protobuf: 3.17.3
**Additional context/screenshots (更多上下文/截图)**
```
➜ brpc sh config_brpc.sh --headers=/usr/include --libs=/usr/local/lib
➜ brpc
➜ brpc make
Linking protoc-gen-mcpack
/usr/bin/ld: libbrpc.a(iobuf.o): in function
`butil::IOBuf::cut_multiple_into_SSL_channel(ssl_st*, butil::IOBuf* const*,
unsigned long, int*)':
/home/jerry/Public/brpc/src/butil/iobuf.cpp:1022: undefined reference to
`BIO_fd_non_fatal_error'
/usr/bin/ld: /home/jerry/Public/brpc/src/butil/iobuf.cpp:1002: undefined
reference to `BIO_fd_non_fatal_error'
/usr/bin/ld: libbrpc.a(iobuf.o): in function
`butil::IOPortal::append_from_SSL_channel(ssl_st*, int*, unsigned long)':
/home/jerry/Public/brpc/src/butil/iobuf.cpp:1695: undefined reference to
`BIO_fd_non_fatal_error'
collect2: error: ld returned 1 exit status
make: *** [Makefile:241: protoc-gen-mcpack] Error 1
➜ brpc
➜ brpc grep -rn BIO_fd_non_fatal_error
Binary file src/butil/iobuf.o matches
src/butil/iobuf.cpp:1002: &&
BIO_fd_non_fatal_error(errno) == 1)) {
src/butil/iobuf.cpp:1022: if (rc <= 0 &&
BIO_fd_non_fatal_error(errno) == 0) {
src/butil/iobuf.cpp:1695: &&
BIO_fd_non_fatal_error(errno) == 1)) {
Binary file libbrpc.a matches
➜ brpc
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]