Skip to content

Explicit linking against -lstdc++ disqualifies clang w/ libc++ #7

Description

@mgorny

vtable-dumper is explicitly linking to -lstdc++ used to provide __cxa_demangle(). However, libstdc++ is only valid for gcc (and clang with gcc libstdc++). The other compilers provide __cxa_demangle() in other libraries. For example, clang in GNU-free environment uses -lc++ (well, the needed symbol is actually often provided by -lc++abi or -lcxxrt sub-library), in which case -lstdc++ is either going to be wrong (i.e. force dependency on wrong C++ library on system using purely clang suite) or fail (when there is no gcc).

To be honest, I really don't see a point in building vtable-dumper as C if it requires the C++ library anyway. Therefore, the simplest solution to the problem would be to build it using a C++ compiler which in turn will use the correct C++ library for the ecosystem used (and also guarantee correct ABI for __cxa_demangle() calls — it would also be more correct to #include <cxxabi.h> instead of redeclaring the function).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions