Skip to content

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

Closed

Description

@sduzh

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

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

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

Activity

  1. chenzhangyi commented on Sep 15, 2017

    @chenzhangyi
    Member

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

  2. sduzh commented on Sep 15, 2017

    @sduzh
    ContributorAuthor

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

  3. added a commit that references this issue on Sep 16, 2017
  4. added a commit that references this issue on Oct 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions