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

example Linking Error: undefined reference to 'butil::demangle(char const*)' #6

Closed
sduzh opened this issue Sep 15, 2017 · 2 comments
Closed

Comments

@sduzh
Copy link
Contributor

sduzh commented Sep 15, 2017

libbrpc.so编译成功,cd example/echo_c++; make链接错误:

linkingerror
使用nm查看好像生成了C++11的ABI:
nm

编译环境如下:
ubuntu 16.04 x86_64
gcc 5.4.0

@chenzhangyi
Copy link
Member

目前没有这样的编译环境:(.. 方便的话在 src/butil/class_name.cpp 里面加上. #include <butil/class_name.h> (这样这个编译单端能看到函数声明)。 并尝试再次编译.

@sduzh
Copy link
Contributor Author

sduzh commented Sep 15, 2017

解决了,原因是因为在模板函数class_name_str()内部声明了std::string demangle(const char*)这个函数,这个好像是gcc 5的bug:在模板内部声明的std::string不会有[abi:cxx11] tag,这里有个相似问题描述。
解决方法就是删除class_name_str()内部的demangle()函数声明

chenzhangyi pushed a commit that referenced this issue Sep 16, 2017
PeterRK pushed a commit to PeterRK/brpc that referenced this issue Oct 18, 2018
@zgb40302 zgb40302 mentioned this issue Dec 5, 2019
@xiedeacc xiedeacc mentioned this issue Jul 11, 2023
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

No branches or pull requests

2 participants