Anatoli P
Anatoli P

Reputation: 4891

Missing symbols when using Clang with libc++ on CentOS 7 (no C++ ABI lib?)

The following packages were installed from repositories on CentOS 7.6:

Trying to build a simple C++ program:

clang++ -std=c++11 -stdlib=libc++ junk.cpp

This results in a bunch of linker errors, an example is:

/bin/../lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libc++.so: undefined reference to `__cxa_throw'

AFAIK, this seems to be a problem of missing C++ ABI library, but I can't figure out how to install one that would provide the needed symbols. I could probably build one from source, but would like to stick with what's available from trustworthy repositories.

Any ideas on how to fix this?

I can build the program just fine if -stdlib=libc++ is omitted, in which case libstdc++ is used.

Upvotes: 1

Views: 989

Answers (1)

EricWF
EricWF

Reputation: 1061

Try passing -lc++abi manually. This problem is fixed in modern installations, but the Linux packages aren't modern. Consider using apt.llvm.org

Upvotes: 1

Related Questions