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 07:27:39 UTC
[GitHub] [incubator-brpc] hthao opened a new issue #1693: compile failed with error "error: macro "__has_attribute" requires an identifier"
hthao opened a new issue #1693:
URL: https://github.com/apache/incubator-brpc/issues/1693
**Describe the bug (描述bug)**
compile failed with error "error: macro "__has_attribute" requires an identifier".
**To Reproduce (复现方法)**
follow the steps:
https://github.com/apache/incubator-brpc/blob/master/docs/cn/getting_started.md#ubuntulinuxmintwsl
**Expected behavior (期望行为)**
compile successful.
**Versions (各种版本)**
OS: ubuntu
Compiler: gcc
brpc: 1.0.0
protobuf: libprotoc 3.12.4
**Additional context/screenshots (更多上下文/截图)**
test@NUC11PAHi7:~/github/brpc$ cd incubator-brpc-1.0.0/
test@NUC11PAHi7:~/github/brpc/incubator-brpc-1.0.0$ ls
bazel CHANGES.md CODE_OF_CONDUCT.md config.h.in DISCLAIMER example leveldb.BUILD NOTICE python RELEASE_VERSION tools
BUILD.bazel cmake community config.mk Dockerfile glog.BUILD LICENSE openssl.BUILD README_cn.md src WORKSPACE
build_in_travis_ci.sh CMakeLists.txt config_brpc.sh CONTRIBUTING.md docs java Makefile package README.md test zlib.BUILD
test@NUC11PAHi7:~/github/brpc/incubator-brpc-1.0.0$ sh config_brpc.sh --headers=/usr/include --libs=/usr/lib
test@NUC11PAHi7:~/github/brpc/incubator-brpc-1.0.0$ make
> Compiling src/mcpack2pb/generator.o
g++ -c -I./src -I/usr/include/ -DBRPC_WITH_GLOG=0 -DGFLAGS_NS=google -g -DBTHREAD_USE_FAST_PTHREAD_MUTEX -D__const__= -D_GNU_SOURCE -DUSE_SYMBOLIZE -DNO_TCMALLOC -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DNDEBUG -DBRPC_REVISION=\"1.0.0\" -O2 -pipe -Wall -W -fPIC -fstrict-aliasing -Wno-invalid-offsetof -Wno-unused-parameter -fno-omit-frame-pointer -std=c++0x -msse4 -msse4.2 -Wno-aligned-new src/mcpack2pb/generator.cpp -o src/mcpack2pb/generator.o
In file included from /usr/include/features.h:484,
from /usr/include/x86_64-linux-gnu/c++/11/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/11/bits/c++config.h:586,
from /usr/include/c++/11/bits/stl_algobase.h:59,
from /usr/include/c++/11/bits/stl_tree.h:63,
from /usr/include/c++/11/set:60,
from src/mcpack2pb/generator.cpp:22:
/usr/include/x86_64-linux-gnu/sys/cdefs.h:256:60: error: macro "__has_attribute" requires an identifier
256 | #if __GNUC_PREREQ (2,5) || __glibc_has_attribute (__const__)
| ^
make: *** [Makefile:297: src/mcpack2pb/generator.o] Error 1
test@NUC11PAHi7:~/github/brpc/incubator-brpc-1.0.0$ uname -a
Linux NUC11PAHi7 5.13.0-28-generic #31-Ubuntu SMP Thu Jan 13 17:41:06 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
test@NUC11PAHi7:~/github/brpc/incubator-brpc-1.0.0$ gcc --version
gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--
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
[GitHub] [incubator-brpc] wwbmmm commented on issue #1693: compile failed with error "error: macro "__has_attribute" requires an identifier"
Posted by GitBox <gi...@apache.org>.
wwbmmm commented on issue #1693:
URL: https://github.com/apache/incubator-brpc/issues/1693#issuecomment-1072323714
类似的问题,用gcc 12.0.1中,使用了c++11风格的attribute,编译失败
<img width="808" alt="image" src="https://user-images.githubusercontent.com/3894631/158995416-fd8266a3-90a5-4caf-85de-5ce04309cf4c.png">
--
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
[GitHub] [incubator-brpc] TousakaRin commented on issue #1693: compile failed with error "error: macro "__has_attribute" requires an identifier"
Posted by GitBox <gi...@apache.org>.
TousakaRin commented on issue #1693:
URL: https://github.com/apache/incubator-brpc/issues/1693#issuecomment-1040001492
谢谢反馈,该问题是因为在编译时指定了选项 -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
[GitHub] [incubator-brpc] wwbmmm removed a comment on issue #1693: compile failed with error "error: macro "__has_attribute" requires an identifier"
Posted by GitBox <gi...@apache.org>.
wwbmmm removed a comment on issue #1693:
URL: https://github.com/apache/incubator-brpc/issues/1693#issuecomment-1072320069
类似的问题:在gcc 12.0.1中,用到了c++11风格的attribute写法,编译失败
![a3e2191724d4983ec3ba2a6213285423](https://user-images.githubusercontent.com/3894631/158994701-bec7ba92-6b19-4349-8fe2-78c22e9592e9.png)
--
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
[GitHub] [incubator-brpc] hthao edited a comment on issue #1693: compile failed with error "error: macro "__has_attribute" requires an identifier"
Posted by GitBox <gi...@apache.org>.
hthao edited a comment 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** 了
谢谢快速反馈,issue格式已修正。
修改系统文件貌似不现实,可能还需要再研究一下解决方案,多谢。
--
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
[GitHub] [incubator-brpc] wwbmmm commented on issue #1693: compile failed with error "error: macro "__has_attribute" requires an identifier"
Posted by GitBox <gi...@apache.org>.
wwbmmm commented on issue #1693:
URL: https://github.com/apache/incubator-brpc/issues/1693#issuecomment-1072320069
--
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
[GitHub] [incubator-brpc] hthao edited a comment on issue #1693: compile failed with error "error: macro "__has_attribute" requires an identifier"
Posted by GitBox <gi...@apache.org>.
hthao edited a comment 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** 了
谢谢快速反馈,issue格式已修正。
修改系统文件貌似不现实,可能还需要再研究一下解决方案,多谢。
--
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
[GitHub] [incubator-brpc] hthao commented on issue #1693: compile failed with error "error: macro "__has_attribute" requires an identifier"
Posted by GitBox <gi...@apache.org>.
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
[GitHub] [incubator-brpc] TousakaRin commented on issue #1693: compile failed with error "error: macro "__has_attribute" requires an identifier"
Posted by GitBox <gi...@apache.org>.
TousakaRin commented on issue #1693:
URL: https://github.com/apache/incubator-brpc/issues/1693#issuecomment-1040001492
谢谢反馈,该问题是因为在编译时指定了选项 -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
[GitHub] [incubator-brpc] wwbmmm commented on issue #1693: compile failed with error "error: macro "__has_attribute" requires an identifier"
Posted by GitBox <gi...@apache.org>.
wwbmmm commented on issue #1693:
URL: https://github.com/apache/incubator-brpc/issues/1693#issuecomment-1072320069
类似的问题:在gcc 12.0.1中,用到了c++11风格的attribute写法,编译失败
![a3e2191724d4983ec3ba2a6213285423](https://user-images.githubusercontent.com/3894631/158994701-bec7ba92-6b19-4349-8fe2-78c22e9592e9.png)
--
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
[GitHub] [incubator-brpc] hthao commented on issue #1693: compile failed with error "error: macro "__has_attribute" requires an identifier"
Posted by GitBox <gi...@apache.org>.
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
[GitHub] [incubator-brpc] wwbmmm removed a comment on issue #1693: compile failed with error "error: macro "__has_attribute" requires an identifier"
Posted by GitBox <gi...@apache.org>.
wwbmmm removed a comment on issue #1693:
URL: https://github.com/apache/incubator-brpc/issues/1693#issuecomment-1072320069
类似的问题:在gcc 12.0.1中,用到了c++11风格的attribute写法,编译失败
![a3e2191724d4983ec3ba2a6213285423](https://user-images.githubusercontent.com/3894631/158994701-bec7ba92-6b19-4349-8fe2-78c22e9592e9.png)
--
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