Far*_*ley 66 c++ macos xcode stl clang
从App Store更新到命令行工具6.3后,包含<vector>或<iterator>内部包含<__ debug>的程序将导致文件未找到错误,如下所示.cpp没有什么有趣的,但包含在其中一个包含的标题中.
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>
^
Run Code Online (Sandbox Code Playgroud)
有什么想法解决这个问题?我不希望指定任何额外的C++标志.
谢谢.
PS:OSX 10.10.3上的MacBook pro
更新:
Apple在其开发者论坛上验证了该问题.在命令行工具6.2中,包含__debug在条件上受到如下保护,但在6.3中没有.
#ifdef _LIBCPP_DEBUG
# include <__debug>
#else
# define _LIBCPP_ASSERT(x, m) ((void)0)
#endif
Run Code Online (Sandbox Code Playgroud)
libcxx的人谈到了在这里删除__debug的守卫.感觉__debug从未在OSX上存在过.
gis*_*141 60
通过Apple的开发人员下载页面将命令行工具降级到6.2.
小心为您的OS X下载正确的版本:
commandlinetoolsosx10.10forxcode6.2.dmgcommandlinetoolsosx10.9forxcode6.2.dmg这是有效的,因为__debug在命令行工具6.2中有条件保护包含如下,但在6.3中没有.
#ifdef _LIBCPP_DEBUG
# include <__debug>
#else
# define _LIBCPP_ASSERT(x, m) ((void)0)
#endif
Run Code Online (Sandbox Code Playgroud)
在我看来,这是最安全的方式,因为:
更新 - 2015年4月21日
问题由Apple 修复.安装命令行工具6.3.1后,一切都按预期工作!
小智 38
暂时创建缺少的__debug文件,_LIBCPP_ASSERT其位置在OS X的命令行工具6.2中.
echo '#define _LIBCPP_ASSERT(x, m) ((void)0)' | sudo tee -a /Library/Developer/CommandLineTools/usr/include/c++/v1/__debug > /dev/null
Run Code Online (Sandbox Code Playgroud)
构建完成后删除临时文件.
sudo rm /Library/Developer/CommandLineTools/usr/include/c++/v1/__debug
Run Code Online (Sandbox Code Playgroud)
警告!!!这是一个黑客,使用风险自负!这种解决方法仅作为临时修复,直到Apple提供命令行工具的更新.
好的,我们开始:自己创建文件并将以下内容放入其中:
#ifndef _LIBCPP_ASSERT
#define _LIBCPP_ASSERT(...) ((void)0)
#endif
Run Code Online (Sandbox Code Playgroud)
这似乎对我有用,但肯定不是正确的做法.确保文件位于/Library/Developer/CommandLineTools/usr/include/c++/v1/__debug具有正确所有者/权限的正确位置.
现在可以在https://developer.apple.com/downloads上的命令行工具6.3.1中修复此问题.更新应自动显示在App Store更新中(尽管它标记为6.3,而不是6.3.1).对此给您带来的不便表示歉意,并非常感谢您报告此问题.
早些时候:在一个简单的案例中为我工作的解决方法是设置OS X 10.8或更早版本的最小值,"-mmacosx-version-min = 10.8".