缺少 C++ 头文件 <__debug>更新 OSX 命令行工具 6.3 后
从 App Store 更新到命令行工具 6.3 后,包括
或
在内的程序将导致文件未发现错误如下.cpp 没有什么有趣的,但包含在包含的标题之一中.
After updating to Command Line Tools 6.3 from the App Store, programs including <vector>
or <iterator>
which internally include <__debug> will cause file not found error as follows. The cpp is nothing interesting but includes in one of the included headers.
c++ -O3 -I/Users/farleylai/Documents/dev/git/ESMS/Optimizer/../StreamIt/src/cluster/headers -L/Users/farleylai/Documents/dev/git/ESMS/Optimizer/../StreamIt/build/binaries/clusterStaticLibrary /Users/farleylai/Documents/dev/git/ESMS/Optimizer/build/StreamIt/FIR/511/512/combined_threads.cpp -o streamit -lcluster -lpthread -lstdc++
In file included from /Users/farleylai/Documents/dev/git/ESMS/Optimizer/build/StreamIt/FIR/511/512/combined_threads.cpp:9:
In file included from /Users/farleylai/Documents/dev/git/ESMS/Optimizer/../StreamIt/src/cluster/headers/node_server.h:22:
In file included from /Users/farleylai/Documents/dev/git/ESMS/Optimizer/../StreamIt/src/cluster/headers/thread_info.h:20:
In file included from /Users/farleylai/Documents/dev/git/ESMS/Optimizer/../StreamIt/src/cluster/headers/connection_info.h:19:
/Users/farleylai/Documents/dev/git/ESMS/Optimizer/../StreamIt/src/cluster/headers/socket_holder.h:43:25: warning: delete called on 'mysocket' that is abstract but has non-virtual destructor
[-Wdelete-non-virtual-dtor]
if (!is_mem_socket) delete sock;
^
In file included from /Users/farleylai/Documents/dev/git/ESMS/Optimizer/build/StreamIt/FIR/511/512/combined_threads.cpp:9:
In file included from /Users/farleylai/Documents/dev/git/ESMS/Optimizer/../StreamIt/src/cluster/headers/node_server.h:22:
In file included from /Users/farleylai/Documents/dev/git/ESMS/Optimizer/../StreamIt/src/cluster/headers/thread_info.h:26:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/vector:265:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__bit_reference:15:
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/algorithm:641:10: fatal error: '__debug' file not found
#include <__debug>
^
有什么办法可以解决这个问题吗?我不希望指定任何额外的 C++ 标志.
Any ideas to fix this? I don't expect to specify any additional C++ flags.
谢谢.
PS:OSX 10.10.3 上的 MacBook pro
PS: MacBook pro on OSX 10.10.3
更新:
该问题已由 Apple 在其开发者论坛上验证.在命令行工具 6.2 中,__debug 的包含有条件地保护如下,但在 6.3 中没有.
The issue is verified by Apple on their developer's forum. In Command Line Tools 6.2, the inclusion of __debug is conditionally guarded as follows but not in 6.3.
#ifdef _LIBCPP_DEBUG
# include <__debug>
#else
# define _LIBCPP_ASSERT(x, m) ((void)0)
#endif
和 libcxx 人讨论了移除 __debug 的守卫 这里.感觉 __debug 在 OSX 上从来不存在.
And libcxx people talked about removing the guards of __debug here. It feels like __debug never exists on OSX.
推荐答案
通过 6.2.action#">Apple 的开发者下载页面.
Downgrade the Command Line Tools to 6.2 via Apple's Developer Download Page.
请注意为您的 OS X 下载正确的版本:
Be careful to download the correct version for your OS X:
- OS X 10.10
commandlinetoolsosx10.10forxcode6.2.dmg
- OS X 10.9
commandlinetoolsosx10.9forxcode6.2.dmg
这是可行的,因为 __debug
的包含在命令行工具 6.2 中有条件地受到保护,如下所示,但在 6.3 中则不然.
This works because the inclusion of __debug
is conditionally guarded as follows in Command Line Tools 6.2 but not in 6.3.
#ifdef _LIBCPP_DEBUG
# include <__debug>
#else
# define _LIBCPP_ASSERT(x, m) ((void)0)
#endif
我认为这是最安全的方法,因为:
In my opinion this is the safest way, because:
- 您不会损害您的工具链
- Apple 修复问题后,您可以通过 App Store 轻松升级
- 如果您手动添加文件,则必须稍后将其删除,否则可能会出现更多问题
更新 - 21.04.2015
问题已修复,由 Apple 解决.安装命令行工具 6.3.1 后,一切正常!
Problem fixed by Apple. After installing Command Line Tools 6.3.1 everything works as expected!
相关文章