我在用:
SLES 11 x86_64
Boost 1.51.0使用以下内容编译:./b2 toolset=clang cxxflags="-stdlib=libc++ -std=c++11" linkflags="-stdlib=libc++"
来自svn的clang (大约两个弱者)
来自 svn 的libc++ (几乎是最新的)
测试在最后被中止(SIGABORT):
./unitTest
Running 3 test cases...
ModelTest.cpp(28): error in "GameField_added_correctly": check objects.size() == std::size_t{1} failed [0 != 1]
ModelTest.cpp(37): error in "Spaceship_added_correctly": check objects.size() == std::size_t{1} failed [0 != 1]
ModelTest.cpp(52): error in "Spaceship_out_of_GameField_is_demolished_after_tick": check objects.size() == std::size_t{2} failed [0 != 2]
ModelTest.cpp(59): error in "Spaceship_out_of_GameField_is_demolished_after_tick": check objects.size() == std::size_t{1} failed [0 != 1]
Aborted
这是一个非常有趣的回溯:
Program received signal SIGABRT, Aborted.
0x00007ffff7183945 in *__GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
in ../nptl/sysdeps/unix/sysv/linux/raise.c
(gdb) bt
#0 0x00007ffff7183945 in *__GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1 0x00007ffff7184f21 in *__GI_abort () at abort.c:92
#2 0x00007ffff796020f in std::uncaught_exception () at ../src/exception.cpp:110
#3 0x00007ffff7968784 in std::__1::basic_ostream<char>::sentry::~sentry (this=0x7fffffffcd18) at ../include/ostream:243
#4 0x000000000042a348 in std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char) ()
#5 0x000000000042b85f in boost::unit_test::results_reporter::make_report(boost::unit_test::report_level, unsigned long) ()
#6 0x0000000000431e22 in boost::unit_test::unit_test_main(boost::unit_test::test_suite* (*)(int, char**), int, char**) ()
#7 0x00007ffff716fbc6 in __libc_start_main (main=0x432110 <main>, argc=1, ubp_av=0x7fffffffced8, init=0x45d380 <__libc_csu_init>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffcec8) at libc-start.c:226
#8 0x0000000000405ec9 in _start () at ../sysdeps/x86_64/elf/start.S:113
(gdb)
当它想打印出测试结果时它失败了。当所有测试用例都通过时,也会发生同样的情况。可以看出,在 std::ostream 的销毁过程中不知何故出现了异常。奇怪的是,std::uncaught_exception 不是来自 libc++ 内联命名空间 (__1)。
你们有没有遇到过类似的问题?有什么问题?
更新:libcxx 中可能存在的错误:http://llvm.org/bugs/show_bug.cgi?id= 13669