Hi,
I’ve been experimenting on and off with building projects against libc++ on Linux, a self-built install made following the official guidelines so using the libstdc++ ABI instead of libcxxabi.
Today I discovered that this install lacks the cxxabi.h headerfile, and a simple test application like below doesn’t build with clang++ -stdlib=libc++ demangle.cpp:
#include <stdio.h>
#include <stdlib.h>
#include <cxxabi.h>
const char *demangle(const char *name, int *status)
{
char buf[1024];
size_t size = sizeof(buf) / sizeof(char);
return abi::__cxa_demangle( name, buf, &size, status );
}
int main( int argc, char *argv[] )
{ int status;
for( int i = 1 ; i < argc ; ++i ){
status = 0;
fprintf( stdout, "%s -> \"%s\" (%d)\n", argv[i], demangle(argv[i], &status), status );
}
exit(0);
}
When using the libstdc++ ABI it would seem to stand to reason to use the corresponding cxxabi.h header, but that turns out to be impossible.
What does work, at least for that code snippet above, is to build the libcxxabi LLVM runtime too, but only install its headerfiles.
Is this an oversight in the documentation, an oversight in the build system, or some kind of unicorn?