是否可以在Mountain Lion上的当前Xcode 4.6.1工具链中启用_LIBCPP_DEBUG2
Is it possible to enable _LIBCPP_DEBUG2 in the current Xcode 4.6.1 toolchain on Mountain Lion?
此线程是对clang的libc++的调试模式的早期讨论,该模式将通过在编译器命令中定义_LIBCPP_DEBUG2
来启用。刚刚与分配错误的std::vector<>
进行了斗争,我很有兴趣能够在调试构建中启用它。
当我尝试简单地将_LIBCPP_DEBUG=1
添加到预处理器宏构建设置时,我会在链接阶段出错(如下所示(。我怀疑这些是由讨论线程中描述的对调试数据库的新生成引用引起的。
在早期的讨论中,有人指出,图书馆的标准版本提供了必要的支持,但今天似乎并非如此。它仍然得到支持吗?如果是,我该如何链接到必要的比特?
Ld /Users/kaelin/Library/Developer/Xcode/DerivedData/OMWorkspace-bzkzcamyqoztgyalubrmemkzmjvk/Build/Products/Debug/vMAT.dylib normal x86_64
cd /Users/Shared/Source/vMAT
setenv MACOSX_DEPLOYMENT_TARGET 10.8
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -L/Users/kaelin/Library/Developer/Xcode/DerivedData/OMWorkspace-bzkzcamyqoztgyalubrmemkzmjvk/Build/Products/Debug -F/Users/kaelin/Library/Developer/Xcode/DerivedData/OMWorkspace-bzkzcamyqoztgyalubrmemkzmjvk/Build/Products/Debug -F/Users/Shared/Source/vMAT/../../../kaelin/Library/Developer/Xcode/DerivedData/OMWorkspace-bzkzcamyqoztgyalubrmemkzmjvk/Build/Products/Debug -filelist /Users/kaelin/Library/Developer/Xcode/DerivedData/OMWorkspace-bzkzcamyqoztgyalubrmemkzmjvk/Build/Intermediates/vMAT.build/Debug/vMAT.build/Objects-normal/x86_64/vMAT.LinkFileList -install_name "@rpath/vMAT.dylib" -mmacosx-version-min=10.8 -fobjc-arc -fobjc-link-runtime -stdlib=libc++ -framework BlocksKit -framework Accelerate -framework Cocoa -single_module -compatibility_version 1 -current_version 1 -o /Users/kaelin/Library/Developer/Xcode/DerivedData/OMWorkspace-bzkzcamyqoztgyalubrmemkzmjvk/Build/Products/Debug/vMAT.dylib
Undefined symbols for architecture x86_64:
"std::__1::__libcpp_db::__comparable(void const*, void const*) const", referenced from:
NSString* (anonymous namespace)::dump<double>(NSString*, double*, int vector[4]) in vMAT_Array+UnaryOps.o
NSString* (anonymous namespace)::dump<float>(NSString*, float*, int vector[4]) in vMAT_Array+UnaryOps.o
signed char (anonymous namespace)::isEqualEpsilon<double>(double*, int vector[4], double*, int vector[4], double) in vMAT_Array+BinaryOps.o
signed char (anonymous namespace)::isEqualEpsilon<float>(float*, int vector[4], float*, int vector[4], double) in vMAT_Array+BinaryOps.o
"std::__1::__libcpp_db::__dereferenceable(void const*) const", referenced from:
NSString* (anonymous namespace)::dump<double>(NSString*, double*, int vector[4]) in vMAT_Array+UnaryOps.o
NSString* (anonymous namespace)::dump<float>(NSString*, float*, int vector[4]) in vMAT_Array+UnaryOps.o
signed char (anonymous namespace)::isEqualEpsilon<double>(double*, int vector[4], double*, int vector[4], double) in vMAT_Array+BinaryOps.o
signed char (anonymous namespace)::isEqualEpsilon<float>(float*, int vector[4], float*, int vector[4], double) in vMAT_Array+BinaryOps.o
"std::__1::__libcpp_db::__insert_c(void*)", referenced from:
std::__1::vector<float, std::__1::allocator<float> >::vector<float*>(float*, float*, std::__1::enable_if<__is_forward_iterator<float*>::value, void>::type*) in vMAT_Array+UnaryOps.o
std::__1::vector<double, std::__1::allocator<double> >::vector<double*>(double*, double*, std::__1::enable_if<__is_forward_iterator<double*>::value, void>::type*) in vMAT_Array+UnaryOps.o
std::__1::vector<float, std::__1::allocator<float> >::vector<float*>(float*, float*, std::__1::enable_if<__is_forward_iterator<float*>::value, void>::type*) in vMAT_Array+BinaryOps.o
std::__1::vector<double, std::__1::allocator<double> >::vector<double*>(double*, double*, std::__1::enable_if<__is_forward_iterator<double*>::value, void>::type*) in vMAT_Array+BinaryOps.o
std::__1::vector<int, std::__1::allocator<int> >::vector(unsigned long, int const&) in vMAT_inconsistent.o
std::__1::vector<int, std::__1::allocator<int> >::vector(std::__1::vector<int, std::__1::allocator<int> > const&) in vMAT_inconsistent.o
(anonymous namespace)::clusterOptions(NSArray*) in vMAT_cluster.o
...
"std::__1::__libcpp_db::__insert_ic(void*, void const*)", referenced from:
NSString* (anonymous namespace)::dump<double>(NSString*, double*, int vector[4]) in vMAT_Array+UnaryOps.o
NSString* (anonymous namespace)::dump<float>(NSString*, float*, int vector[4]) in vMAT_Array+UnaryOps.o
signed char (anonymous namespace)::isEqualEpsilon<double>(double*, int vector[4], double*, int vector[4], double) in vMAT_Array+BinaryOps.o
signed char (anonymous namespace)::isEqualEpsilon<float>(float*, int vector[4], float*, int vector[4], double) in vMAT_Array+BinaryOps.o
"std::__1::__libcpp_db::__erase_c(void*)", referenced from:
NSString* (anonymous namespace)::dump<double>(NSString*, double*, int vector[4]) in vMAT_Array+UnaryOps.o
NSString* (anonymous namespace)::dump<float>(NSString*, float*, int vector[4]) in vMAT_Array+UnaryOps.o
signed char (anonymous namespace)::isEqualEpsilon<double>(double*, int vector[4], double*, int vector[4], double) in vMAT_Array+BinaryOps.o
signed char (anonymous namespace)::isEqualEpsilon<float>(float*, int vector[4], float*, int vector[4], double) in vMAT_Array+BinaryOps.o
(anonymous namespace)::traceTree(vMAT::Matrix<double>, double*, int, unsigned int) in vMAT_inconsistent.o
___Block_byref_object_dispose_ in vMAT_inconsistent.o
(anonymous namespace)::Options::~Options() in vMAT_cluster.o
...
"std::__1::__libcpp_db::__erase_i(void*)", referenced from:
NSString* (anonymous namespace)::dump<double>(NSString*, double*, int vector[4]) in vMAT_Array+UnaryOps.o
NSString* (anonymous namespace)::dump<float>(NSString*, float*, int vector[4]) in vMAT_Array+UnaryOps.o
signed char (anonymous namespace)::isEqualEpsilon<double>(double*, int vector[4], double*, int vector[4], double) in vMAT_Array+BinaryOps.o
signed char (anonymous namespace)::isEqualEpsilon<float>(float*, int vector[4], float*, int vector[4], double) in vMAT_Array+BinaryOps.o
"std::__1::__get_const_db()", referenced from:
NSString* (anonymous namespace)::dump<double>(NSString*, double*, int vector[4]) in vMAT_Array+UnaryOps.o
NSString* (anonymous namespace)::dump<float>(NSString*, float*, int vector[4]) in vMAT_Array+UnaryOps.o
signed char (anonymous namespace)::isEqualEpsilon<double>(double*, int vector[4], double*, int vector[4], double) in vMAT_Array+BinaryOps.o
signed char (anonymous namespace)::isEqualEpsilon<float>(float*, int vector[4], float*, int vector[4], double) in vMAT_Array+BinaryOps.o
"std::__1::__c_node::~__c_node()", referenced from:
std::__1::_C_node<std::__1::vector<float, std::__1::allocator<float> > >::~_C_node() in vMAT_Array+UnaryOps.o
std::__1::_C_node<std::__1::vector<double, std::__1::allocator<double> > >::~_C_node() in vMAT_Array+UnaryOps.o
std::__1::_C_node<std::__1::vector<float, std::__1::allocator<float> > >::~_C_node() in vMAT_Array+BinaryOps.o
std::__1::_C_node<std::__1::vector<double, std::__1::allocator<double> > >::~_C_node() in vMAT_Array+BinaryOps.o
std::__1::_C_node<std::__1::vector<int, std::__1::allocator<int> > >::~_C_node() in vMAT_inconsistent.o
std::__1::_C_node<std::__1::vector<int, std::__1::allocator<int> > >::~_C_node() in vMAT_cluster.o
std::__1::_C_node<std::__1::vector<double, std::__1::allocator<double> > >::~_C_node() in vMAT_cluster.o
...
"std::__1::__get_db()", referenced from:
NSString* (anonymous namespace)::dump<double>(NSString*, double*, int vector[4]) in vMAT_Array+UnaryOps.o
NSString* (anonymous namespace)::dump<float>(NSString*, float*, int vector[4]) in vMAT_Array+UnaryOps.o
std::__1::vector<float, std::__1::allocator<float> >::vector<float*>(float*, float*, std::__1::enable_if<__is_forward_iterator<float*>::value, void>::type*) in vMAT_Array+UnaryOps.o
std::__1::vector<double, std::__1::allocator<double> >::vector<double*>(double*, double*, std::__1::enable_if<__is_forward_iterator<double*>::value, void>::type*) in vMAT_Array+UnaryOps.o
signed char (anonymous namespace)::isEqualEpsilon<double>(double*, int vector[4], double*, int vector[4], double) in vMAT_Array+BinaryOps.o
signed char (anonymous namespace)::isEqualEpsilon<float>(float*, int vector[4], float*, int vector[4], double) in vMAT_Array+BinaryOps.o
std::__1::vector<float, std::__1::allocator<float> >::vector<float*>(float*, float*, std::__1::enable_if<__is_forward_iterator<float*>::value, void>::type*) in vMAT_Array+BinaryOps.o
...
"typeinfo for std::__1::__c_node", referenced from:
typeinfo for std::__1::_C_node<std::__1::vector<float, std::__1::allocator<float> > > in vMAT_Array+UnaryOps.o
typeinfo for std::__1::_C_node<std::__1::vector<double, std::__1::allocator<double> > > in vMAT_Array+UnaryOps.o
typeinfo for std::__1::_C_node<std::__1::vector<float, std::__1::allocator<float> > > in vMAT_Array+BinaryOps.o
typeinfo for std::__1::_C_node<std::__1::vector<double, std::__1::allocator<double> > > in vMAT_Array+BinaryOps.o
typeinfo for std::__1::_C_node<std::__1::vector<int, std::__1::allocator<int> > > in vMAT_inconsistent.o
typeinfo for std::__1::_C_node<std::__1::vector<int, std::__1::allocator<int> > > in vMAT_cluster.o
typeinfo for std::__1::_C_node<std::__1::vector<double, std::__1::allocator<double> > > in vMAT_cluster.o
...
"vtable for std::__1::__c_node", referenced from:
std::__1::_C_node<std::__1::vector<float, std::__1::allocator<float> > >::_C_node(void*, std::__1::__c_node*) in vMAT_Array+UnaryOps.o
std::__1::_C_node<std::__1::vector<double, std::__1::allocator<double> > >::_C_node(void*, std::__1::__c_node*) in vMAT_Array+UnaryOps.o
std::__1::_C_node<std::__1::vector<float, std::__1::allocator<float> > >::_C_node(void*, std::__1::__c_node*) in vMAT_Array+BinaryOps.o
std::__1::_C_node<std::__1::vector<double, std::__1::allocator<double> > >::_C_node(void*, std::__1::__c_node*) in vMAT_Array+BinaryOps.o
std::__1::_C_node<std::__1::vector<int, std::__1::allocator<int> > >::_C_node(void*, std::__1::__c_node*) in vMAT_inconsistent.o
std::__1::_C_node<std::__1::vector<int, std::__1::allocator<int> > >::_C_node(void*, std::__1::__c_node*) in vMAT_cluster.o
std::__1::_C_node<std::__1::vector<double, std::__1::allocator<double> > >::_C_node(void*, std::__1::__c_node*) in vMAT_cluster.o
...
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
根据这次对话,
谢谢Chris。我已经检查了它的一个实验性实现。
-D_LIBCPP_DEBUG2
为您提供"标准"调试模式,其中包括检查迭代器无效。
-D_LIBCPP_DEBUG2=0
获得"调试精简版"。这只检查真正便宜的东西比如你提到的那些。
我为敞开了大门
-D_LIBCPP_DEBUG2=2
这将进行更昂贵的检查(例如,检查不变量红/黑树的(。但目前还没有做到这一点。
在这一点上,我仍然只关注向量。
霍华德
当我在Xcode 5.0.x(当前最新版本的Xcode(中尝试此标志时,_LIBCPP_DEBUG2=1
不起作用,因为它需要链接到libcpp的调试支持运行时代码,该代码是专门为调试libcpp本身而编写的。但是_LIBCPP_DEBUG2=0
在没有链接到调试支持运行时的情况下工作,并且目前为我提供了非常有用的断言,例如在空向量上调用std::vector<T>::back()
。
只是更新一下:以下似乎有效,并且至少捕获了您想在10.9上捕获的主要错误:
-D_LIBCPP_DEBUG=0
对于10.9 中的clang++来说,任何高于0级的东西似乎都是不受支持的
- 编译时未启用intel oneApi CUDA支持
- OpenGL在启用深度测试时不会丢弃我的碎片
- 使用外部SDK工具链文件在VisualStudio上生成项目编译错误
- Visual C++GC接口如何启用它以及要包含哪个库
- 在clang++预处理器中确定gcc工具链版本
- Visual Studio(或任何其他工具)能否将地址解释为调用堆栈(boost上下文)的开头
- 参数化自定义CMake工具链
- 如何在自定义类中启用'auto loops'?
- 如何在QT中的自定义视频小工具t上绘制矩形
- 根据某个函数是否存在启用模板
- 使用 C++ 和 i2c 工具从虚拟 i2c 写入和读取
- 用于C++的静态二进制检测或二进制重写工具和框架
- 在OSX上使用CMake将Adobe的XMP工具包构建为共享库的最简单方法是什么?
- 视觉工作室 2017;启用 /permissive 时,类型 "const wchar_t *" 的参数与类型 "PWSTR" 的参数不兼容
- 启用从"vector<const T>&"到"const vector&"的隐式转换<T>
- 即使Visual Studio 14 2015 Win64工具链已启用,也将32位工具链用于编译
- 启用RTTI进行叮当工具
- 为lldb启用调试工具
- 如何在ptxdist中启用cmake工具
- 是否可以在Mountain Lion上的当前Xcode 4.6.1工具链中启用_LIBCPP_DEBUG2