在clang ++和libc ++上的std :: cerr会导致SIGABRT

我试图得到一个简单的程序运行在Ubuntu 12.04 x64编译与铿锵+ + 3.3的libc + + + +的libc ++阿比。

程序:

#include <iostream> int main(int argc, char **argv) { try { std::cerr << "Test cerr \n"; } catch (...) { std::cout << "catch exception"; } return 0; } 

写入std :: cerr会打印该消息,但会导致SIGABRT。

但是,写入到std :: cout工作正常。

这里的可执行文件的ldd输出:

 $ldd cerr_test linux-vdso.so.1 => (0x00007fffce5ff000) libc++abi.so.1 => /usr/local/lib/libc++abi.so.1 (0x00007fa4079fd000) libc++.so.1 => /usr/local/lib/libc++.so.1 (0x00007fa407759000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fa40745c000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fa407246000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa406e87000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa406c69000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fa406a61000) /lib64/ld-linux-x86-64.so.2 (0x00007fa407c55000) 

任何人都可以给我一个提示如何解决这个问题?

这是回溯:

 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Test cerr Program received signal SIGABRT, Aborted. 0x00007ffff704e425 in raise () from /lib/x86_64-linux-gnu/libc.so.6 (gdb) backtrace #0 0x00007ffff704e425 in raise () from /lib/x86_64-linux-gnu/libc.so.6 #1 0x00007ffff7051b8b in abort () from /lib/x86_64-linux-gnu/libc.so.6 #2 0x00007ffff792a437 in std::uncaught_exception() () from /usr/local/lib/libc++.so.1 #3 0x00007ffff79324e2 in std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry() () from /usr/local/lib/libc++.so.1 #4 0x000000000040118e in std::__1::operator<< <std::__1::char_traits<char> > (__os=..., __str=0x401784 "Test cerr \n") at /usr/local/include/c++/v1/ostream:990 #5 0x0000000000400d41 in main (argc=1, argv=0x7fffffffe728) at cerr_test.cpp:5 (gdb) 

Solutions Collecting From Web of "在clang ++和libc ++上的std :: cerr会导致SIGABRT"