[llvm-bugs] [Bug 51254] New: can't include cxxabi.h using libstdc++ ABI with libc++
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jul 28 12:59:51 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51254
Bug ID: 51254
Summary: can't include cxxabi.h using libstdc++ ABI with libc++
Product: libc++
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: john at jmdtech.org
CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
Created attachment 25085
--> https://bugs.llvm.org/attachment.cgi?id=25085&action=edit
fix for missing abi header
This might be partially a dup of https://bugs.llvm.org/show_bug.cgi?id=22445,
but that was already resolved. Based on that bug,
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61728 looks related as well.
I'm trying to build a toolchain with clang and libc++ where libc++ uses the
libstdc++ ABI. Two issues arose:
1. CMake configuration is missing an ABI header that was added in gcc 8
(cxxabi_init_exception.h)
2. libstdc++'s cxxabi.h uses implementation details from libstdc++'s typeinfo
header, which is incompatible with libc++'s typeinfo header.
More details following--
I built the toolchain using:
cmake -G Ninja -DLLVM_ENABLE_PROJECTS='clang;libcxx;clang-tools-extra;lld'
-DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/clang-install
-DLIBCXX_CXX_ABI=libstdc++ -DLLVM_TARGETS_TO_BUILD="X86" ../llvm
Building and installing the toolchain itself works fine. Attempting to use
clang with libc++ to compile a source file that simply includes the <cxxabi.h>
header fails, however:
```
#include <cxxabi.h>
```
$ clang++ -stdlib=libc++ -c -o abi /tmp/abi.cpp
results in:
In file included from /tmp/abi.cpp:1:
/tmp/clang-install/bin/../include/c++/v1/cxxabi.h:52:10: fatal error:
'bits/cxxabi_init_exception.h' file not found
#include <bits/cxxabi_init_exception.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
----------------------------------------
I've attached a diff that copies the appropriate header. Using the fix,
however, still results in the following:
In file included from /tmp/abi.cpp:1:
/tmp/clang-install/bin/../include/c++/v1/cxxabi.h:308:23: error: no member
named '__do_catch' in 'std::type_info'
return __pointee->__do_catch (thrown_type->__pointee, thr_obj, outer + 2);
~~~~~~~~~ ^
1 error generated.
----------------------------------------
If you'd rather me submit a PR with the diff to fix the missing header, I can
do that. As for the cxxabi.h file from gcc, it seems to be using implementation
details from their <typeinfo> header which is related to the gcc bug I linked
above. Is this something that should be worked around in libc++, or should I
file a gcc bug so they can fix their cxxabi.h header to not depend on their own
<typeinfo> implementation?
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210728/f227908a/attachment.html>
More information about the llvm-bugs
mailing list