drogon
drogon copied to clipboard
Can't compile example/jsonstore with gcc 12
Describe the bug Compile example/jsonstore with gcc ~~12.0.1~~ 12.1.0 in MacOS shows error in lib/inc/drogon/HttpController.h
To Reproduce get the code and gcc 12.0.1 toolchain and compile!
Expected behavior successfully compilied
Screenshots
Thanks for the bug report.
I don't know how GCC deduced this problem seems like len("::”) != 2 ?
this doesn't matter, reason why error occurred matters
我其实是来催更的
I successfully build drogon on macos with gcc12 without any problems. Could you elaborate how did you trigger this bug?
My build options:
- gcc12: installed from brew
- jsoncpp: build from source by gcc12
- cmake options: -DCMAKE_CXX_FLAGS="-fcoroutines"
- result:
Darwin MacBook-Pro 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64 x86_64
debug
官方自带 build.sh
use cmake options: -DCMAKE_CXX_FLAGS="-fcoroutines"
make success!
but drogon_ctl -v
我们2 中国人 搞什么 英文
请不要滥用issue, 尝试整理一下自己的发言。
This is a gcc specific compiler bug 105545, multiple other projects are affected. Seems to be triggered when doing tree optimizations.
Official suggestions is to just disable -Werror
, as this is a warning that misfires. A better approach is to disable this warning causing an error with -Wno-error=restrict
flag. Can also disable specific line it affects with
#pragma GCC diagnostic warning "-Wrestrict"
path.replace(pos, 2, "/");
#pragma GCC diagnostic pop
``
这是一个 gcc 特定的编译器错误105545,其他多个项目受到影响。似乎在进行树优化时触发。
官方建议只是禁用
-Werror
,因为这是一个错误的警告。-Wno-error=restrict
更好的方法是禁用导致标志错误的警告。也可以禁用它影响的特定行#pragma GCC diagnostic warning "-Wrestrict" path.replace(pos, 2, "/"); #pragma GCC diagnostic pop
OK
I'm reproducing this issue with Fedora 37 (gcc 12.3.1)
Using -fcoroutines doesn't change anything or just by side effect, may disable other CXXFLAGS from environment.
Using "-Wno-error=restrict" alone solves the "fails to build from source" issue on gcc 12...