<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - can't include cxxabi.h using libstdc++ ABI with libc++"
   href="https://bugs.llvm.org/show_bug.cgi?id=51254">51254</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>can't include cxxabi.h using libstdc++ ABI with libc++
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>john@jmdtech.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=25085" name="attach_25085" title="fix for missing abi header">attachment 25085</a> <a href="attachment.cgi?id=25085&action=edit" title="fix for missing abi header">[details]</a></span>
fix for missing abi header

This might be partially a dup of <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED WORKSFORME - libc++ does not build when using libstdc++/libsupc++ from GCC 5.0 as the ABI library"
   href="show_bug.cgi?id=22445">https://bugs.llvm.org/show_bug.cgi?id=22445</a>,
but that was already resolved. Based on that bug,
<a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61728">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61728</a> 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?</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>