zengkui opened a new issue, #1824:
URL: https://github.com/apache/incubator-brpc/issues/1824
**Describe the bug (描述bug)**
在Makefile中指定了 -D_GLIBCXX_USE_CXX11_ABI=0 发现整个brpc的库都正常生成了,编译命令中显示
-D_GLIBCXX_USE_CXX11_ABI=0 这参数也是正常,但是最后在编译生成 protoc-gen-mcpack
这个目标的时候发现这个参数没有带上。 如下:
```shell
g++ -o protoc-gen-mcpack -I./src -Ithirdparty/gflags/gflags-2.2.2/include/
-Ithirdparty/leveldb/leveldb-1.12.0-12.alios7.x86_64/include/
-Ithirdparty/openssl/openssl_1.0.1_el7_4.9.2/include/
-Ithirdparty/protobuf-3.6.1/include/ -Ithirdparty/glog/glog-0.6.0/include/
-Lthirdparty/gflags/gflags-2.2.2/lib64
-Lthirdparty/leveldb/leveldb-1.12.0-12.alios7.x86_64/lib64
-Lthirdparty/openssl/openssl_1.0.1_el7_4.9.2/lib64
-Lthirdparty/protobuf-3.6.1/lib64 -Lthirdparty/glog/glog-0.6.0/lib64 -std=c++0x
-Xlinker "-(" src/idl_options.pb.cc src/mcpack2pb/generator.o libbrpc.a
-Wl,-Bstatic -lgflags -lprotobuf -lleveldb -lprotoc -lglog -Wl,-Bdynamic
-Xlinker "-)" -lpthread -lssl -lcrypto -ldl -lz -lrt
```
报错信息如下:
```shell
/tmp/ccWAA0uM.o: In function
`protobuf_idl_5foptions_2eproto::protobuf_AssignDescriptors()':
idl_options.pb.cc:(.text+0x6b): undefined reference to
`google::protobuf::internal::AssignDescriptors(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&,
google::protobuf::internal::MigrationSchema const*, google::protobuf::Message
const* const*, unsigned int const*, google::protobuf::Metadata*,
google::protobuf::EnumDescriptor const**, google::protobuf::ServiceDescriptor
const**)'
/tmp/ccWAA0uM.o: In function
`protobuf_idl_5foptions_2eproto::AddDescriptorsImpl()':
idl_options.pb.cc:(.text+0x10e): undefined reference to
`google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*,
void (*)(std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&))'
```
手工添加上-D_GLIBCXX_USE_CXX11_ABI=0 在命令行单独执行这个命令是ok的,如下:
```shell
g++ -o protoc-gen-mcpack -D_GLIBCXX_USE_CXX11_ABI=0 -I./src
-Ithirdparty/gflags/gflags-2.2.2/include/
-Ithirdparty/leveldb/leveldb-1.12.0-12.alios7.x86_64/include/
-Ithirdparty/openssl/openssl_1.0.1_el7_4.9.2/include/
-Ithirdparty/protobuf-3.6.1/include/ -Ithirdparty/glog/glog-0.6.0/include/
-Lthirdparty/gflags/gflags-2.2.2/lib64
-Lthirdparty/leveldb/leveldb-1.12.0-12.alios7.x86_64/lib64
-Lthirdparty/openssl/openssl_1.0.1_el7_4.9.2/lib64
-Lthirdparty/protobuf-3.6.1/lib64 -Lthirdparty/glog/glog-0.6.0/lib64 -std=c++0x
-Xlinker "-(" src/idl_options.pb.cc src/mcpack2pb/generator.o libbrpc.a
-Wl,-Bstatic -lgflags -lprotobuf -lleveldb -lprotoc -lglog -Wl,-Bdynamic
-Xlinker "-)" -lpthread -lssl -lcrypto -ldl -lz -lrt
```
**To Reproduce (复现方法)**
**Expected behavior (期望行为)**
**Versions (各种版本)**
OS:
Compiler: gcc 8.3.1
brpc: master
protobuf: 3.6.1
**Additional context/screenshots (更多上下文/截图)**
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]