title: undefined reference to `__dynamic_cast' using libc++ on ubuntu
body: <p>I'm trying to compile a test case that employs <code>dynamic_cast</code> using libc++, which was compiled according to <a href="http://libcxx.llvm.org/" rel="nofollow noreferrer">&quot;Build on Linux using CMake and libsupc++&quot;</a>.</p>
  <pre><code>#include &lt;iostream&gt;
  
  struct A
  {
      virtual void f(){ std::cout &lt;&lt; &quot;Virtual A&quot; &lt;&lt; std::endl; }
      virtual ~A(){}
  };
  
  struct B : public A
  {
      void f() { std::cout &lt;&lt; &quot;Virtual B&quot; &lt;&lt; std::endl; }
      virtual ~B(){}
  };
  
  int main()
  {
      A *a = new B;
      B *b = dynamic_cast&lt;B *&gt;(a);
      delete a;
  }
  </code></pre>
  <p>I'm on ubuntu 13.04 and compiling with <code>clang++ -std=c++11 -stdlib=libc++</code>.</p>
  <p>Why I'm getting <code>undefined reference to '__dynamic_cast'</code>? How to solve it?</p>
  <h3>EDIT</h3>
  <p>Looks like it has something to do with libc++abi <a href="http://libcxxabi.llvm.org/spec.html" rel="nofollow noreferrer">since I'm seeing <code>__dynamic_cast</code> prototype in the spec</a>. I expected the <code>libsupc++</code> first build option to work without such issues... and trying to compile libc++abi on linux <a href="http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-February/019907.html" rel="nofollow noreferrer">is another issue itself</a>.</p>
  <p>This seems related to <a href="https://stackoverflow.com/q/7016730">Compiling with Clang using Libc++ undefined references</a>.</p>
  <p>If this is indeed the problem, is there a straightforward process to use libc++ on linux that can compile that short snippet, or is it just not yet supported?</p>