brpc icon indicating copy to clipboard operation
brpc copied to clipboard

Duplicate function definition EVP_PKEY_base_id

Open wangguibao opened this issue 7 years ago • 2 comments

I'm having trouble building brpc with GCC 5.2.0

The error compiler reported is:

In file included from /home/xxx/code/git/Serving/build/third_party/brpc/src/extern_brpc/src/brpc/policy/dh.cpp:20:0:
./butil/ssl_compat.h: In function ‘int EVP_PKEY_base_id(const EVP_PKEY*)’:
./butil/ssl_compat.h:520:17: error: redefinition of ‘int EVP_PKEY_base_id(const EVP_PKEY*)’
 BRPC_INLINE int EVP_PKEY_base_id(const EVP_PKEY *pkey) {
                 ^
./butil/ssl_compat.h:516:17: note: ‘int EVP_PKEY_base_id(const EVP_PKEY*)’ previously defined here
 BRPC_INLINE int EVP_PKEY_base_id(const EVP_PKEY *pkey) {

Looking into src/butil/ssl_compat.h, there's definitely duplicate function definition of EVP_PKEY_base_id:

https://github.com/apache/incubator-brpc/blob/master/src/butil/ssl_compat.h#L515

Not sure why building brpc with other toolchain not complain about this.

wangguibao avatar Jul 04 '19 09:07 wangguibao

According to C++ standard, inline functions would not be applied by One Definition Rule. The complier is not required to report the error. But In this case, these two functions are exactly same. It's ok to remove one of them.

zyearn avatar Jul 05 '19 03:07 zyearn

Fixed in https://github.com/apache/incubator-brpc/pull/841

zyearn avatar Jul 13 '19 14:07 zyearn