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

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

Open
mgorny opened this issue Dec 31, 2016 · 0 comments
Open

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

mgorny opened this issue Dec 31, 2016 · 0 comments

Comments

@mgorny
Copy link

mgorny commented Dec 31, 2016

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).

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

1 participant