You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by "ketor (via GitHub)" <gi...@apache.org> on 2024/03/18 17:59:29 UTC

[PR] Fix compile with protobuf 22-25. (brpc)

ketor opened a new pull request, #2576:
URL: https://github.com/apache/brpc/pull/2576

   ### What problem does this PR solve?
   
   Issue Number:
   
   Problem Summary:  PR #2546 在Protobuf 22-24这几个版本上的编译有一些问题,在25版本上可以编译通过。同时在Rocky 8.9的GCC 13上编译发现,原有的 #define private public的方式已经不被编译器接受,也会导致编译失败。
   
   ### What is changed and the side effects?
   
   Changed:  修复在Protobuf 22-24这3个版本上编译失败的问题。对于private的问题,对于高版本增加一个特殊处理解决编译问题。
   
   Side effects:
   - Performance effects(性能影响): 无影响
   
   - Breaking backward compatibility(向后兼容性): 无影响
   
   ---
   ### Check List:
   - Please make sure your changes are compilable(请确保你的更改可以通过编译).
   - When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
   - Please follow [Contributor Covenant Code of Conduct](../../master/CODE_OF_CONDUCT.md).(请遵循贡献者准则).
   


-- 
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: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] Fix compile with protobuf 22-25. (brpc)

Posted by "wasphin (via GitHub)" <gi...@apache.org>.
wasphin commented on code in PR #2576:
URL: https://github.com/apache/brpc/pull/2576#discussion_r1537000881


##########
src/brpc/protocol.cpp:
##########
@@ -18,13 +18,21 @@
 
 // Since kDefaultTotalBytesLimit is private, we need some hacks to get the limit.
 // Works for pb 2.4, 2.6, 3.0
+#include "google/protobuf/stubs/common.h"
+#if GOOGLE_PROTOBUF_VERSION < 4022000

Review Comment:
   这个是 protobuf 版本的问题还是编译器版本的问题呢?



-- 
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: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] Fix compile with protobuf 22-25. (brpc)

Posted by "ketor (via GitHub)" <gi...@apache.org>.
ketor commented on code in PR #2576:
URL: https://github.com/apache/brpc/pull/2576#discussion_r1537060645


##########
src/brpc/protocol.cpp:
##########
@@ -18,13 +18,21 @@
 
 // Since kDefaultTotalBytesLimit is private, we need some hacks to get the limit.
 // Works for pb 2.4, 2.6, 3.0
+#include "google/protobuf/stubs/common.h"
+#if GOOGLE_PROTOBUF_VERSION < 4022000

Review Comment:
   是protobuf版本问题,新版本的protobuf的common.h里include了std的一个头文件,导致#define private public的时候会把标准库头文件里的结构给改成public,然后编译器检测到之后会报错。
   在3.21以及更老的protobuf版本上没有这个问题。
   



-- 
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: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] Fix compile with protobuf 22-25. (brpc)

Posted by "ketor (via GitHub)" <gi...@apache.org>.
ketor commented on code in PR #2576:
URL: https://github.com/apache/brpc/pull/2576#discussion_r1537060645


##########
src/brpc/protocol.cpp:
##########
@@ -18,13 +18,21 @@
 
 // Since kDefaultTotalBytesLimit is private, we need some hacks to get the limit.
 // Works for pb 2.4, 2.6, 3.0
+#include "google/protobuf/stubs/common.h"
+#if GOOGLE_PROTOBUF_VERSION < 4022000

Review Comment:
   实际上是brpc的用法的问题,但只会在新版本的protobuf里报错。新版本的protobuf的common.h里include了std的一个头文件,导致#define private public的时候会把标准库头文件里的结构给改成public,然后编译器检测到之后会报错。
   在3.21以及更老的protobuf版本上没有这个问题。
   



-- 
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: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] Fix compile with protobuf 22-25. (brpc)

Posted by "wwbmmm (via GitHub)" <gi...@apache.org>.
wwbmmm merged PR #2576:
URL: https://github.com/apache/brpc/pull/2576


-- 
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: dev-unsubscribe@brpc.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org