Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

centos中使用cmake编译brpc报错 #2473

Closed
binarycopycode opened this issue Dec 19, 2023 · 3 comments · Fixed by #2474
Closed

centos中使用cmake编译brpc报错 #2473

binarycopycode opened this issue Dec 19, 2023 · 3 comments · Fixed by #2474

Comments

@binarycopycode
Copy link
Contributor

Describe the bug (描述bug)

按照centos的教程使用cmake编译报错

To Reproduce (复现方法)

git clone https://github.com/apache/brpc.git

cd brpc

mkdir build && cd build && cmake .. && cmake --build . -j6

Expected behavior (期望行为)

在ubuntu下正常编译,但是centos8.5下报错

Versions (各种版本)
OS: CentOS8.5
Compiler: gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-4)
brpc: 20231219版本
protobuf: libprotoc 3.5.0

Additional context/screenshots (更多上下文/截图)
centos

[ 66%] Building CXX object src/CMakeFiles/SOURCES_LIB.dir/brpc/details/hpack.cpp.o
[ 66%] Building CXX object src/CMakeFiles/SOURCES_LIB.dir/brpc/details/http_message.cpp.o
In file included from /home/binarycopycode/work/brpc/src/brpc/details/http_message.cpp:32:
/home/binarycopycode/work/brpc/src/brpc/details/http_message.h:125:10: error: ‘unique_ptr’ in namespace ‘std’ does not name a template type
std::unique_ptrbutil::IOBufBuilder _vmsgbuilder;
^~~~~~~~~~
/home/binarycopycode/work/brpc/src/brpc/details/http_message.h:125:5: note: ‘std::unique_ptr’ is defined in header ‘’; did you forget to ‘#include ’?
/home/binarycopycode/work/brpc/src/brpc/details/http_message.h:30:1:
+#include

/home/binarycopycode/work/brpc/src/brpc/details/http_message.h:125:5:
std::unique_ptrbutil::IOBufBuilder _vmsgbuilder;
^~~
/home/binarycopycode/work/brpc/src/brpc/details/http_message.cpp: In static member function ‘static int brpc::HttpMessage::on_header_value(brpc::http_parser*, const char*, size_t)’:
/home/binarycopycode/work/brpc/src/brpc/details/http_message.cpp:110:49: error: ‘class brpc::HttpMessage’ has no member named ‘_vmsgbuilder’
butil::IOBufBuilder* vs = http_message->_vmsgbuilder.get();
^~~~~~~~~~~~
/home/binarycopycode/work/brpc/src/brpc/details/http_message.cpp:113:27: error: ‘class brpc::HttpMessage’ has no member named ‘_vmsgbuilder’
http_message->_vmsgbuilder.reset(vs);
^~~~~~~~~~~~
/home/binarycopycode/work/brpc/src/brpc/details/http_message.cpp: In member function ‘int brpc::HttpMessage::OnBody(const char*, size_t)’:
/home/binarycopycode/work/brpc/src/brpc/details/http_message.cpp:223:9: error: ‘_vmsgbuilder’ was not declared in this scope
if (_vmsgbuilder) {
^~~~~~~~~~~~
/home/binarycopycode/work/brpc/src/brpc/details/http_message.cpp: In member function ‘int brpc::HttpMessage::OnMessageComplete()’:
/home/binarycopycode/work/brpc/src/brpc/details/http_message.cpp:292:9: error: ‘_vmsgbuilder’ was not declared in this scope
if (_vmsgbuilder) {
^~~~~~~~~~~~
[ 66%] Building CXX object src/CMakeFiles/SOURCES_LIB.dir/brpc/details/http_parser.cpp.o
gmake[2]: *** [src/CMakeFiles/SOURCES_LIB.dir/build.make:1098: src/CMakeFiles/SOURCES_LIB.dir/brpc/details/http_message.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
gmake[1]: *** [CMakeFiles/Makefile2:237: src/CMakeFiles/SOURCES_LIB.dir/all] Error 2
gmake: *** [Makefile:156: all] Error 2

@binarycopycode
Copy link
Contributor Author

binarycopycode commented Dec 20, 2023

/brpc/src/brpc/details/http_message.h 在这个头文件中加入#include <memory> 就可以编译了。

感觉是个跟不同版本编译器有关的bug,是否需要修一下?

@wwbmmm
Copy link
Contributor

wwbmmm commented Dec 20, 2023

欢迎提PR

@binarycopycode
Copy link
Contributor Author

欢迎提PR

#2474 提好了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants