You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2022/02/15 09:26:12 UTC

[GitHub] [incubator-brpc] hthao commented on issue #1693: compile failed with error "error: macro "__has_attribute" requires an identifier"

hthao commented on issue #1693:
URL: https://github.com/apache/incubator-brpc/issues/1693#issuecomment-1040044934


   > 谢谢反馈,该问题是因为在编译时指定了选项 -D__const__= 导致的,brpc在编译时需要添加这个宏来避免gcc对errno宏做优化从而[导致未定义行为](https://github.com/apache/incubator-brpc/blob/master/docs/cn/thread_local.md#gcc4%E4%B8%8B%E7%9A%84errno%E9%97%AE%E9%A2%98)
   > 
   > 你的系统文件(/usr/include/x86_64-linux-gnu/sys/cdefs.h) 在 #if 中测试了 `__glibc_has_attribute (__const__)`,这个宏展开之后是` __has_attribute (__const__)`, 由于brpc在编译时将 **const** 定义成了空,所以报错了。比较快的解决方案是直接删掉后边的 `__glibc_has_attribute (__const__)`
   > 
   > ps:提issue的时候可以预览一下,编译错误里的`__const__`变成了加粗的 **const** 了
   
   谢谢快速反馈,修改系统文件貌似不现实,需要再研究一下解决方案,多谢。


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