恢复NVCC的Apple Clang版本

我试图运行NVCC来编译我的Mac上的CUDA程序。

当我尝试运行NVCC时,出现以下错误:“nvcc致命错误:不支持主机编译器('Apple clang')的版本('70300')。

我最近更新了我的XCode版本到7.3,我的Mac到10.11.4。

有没有办法恢复我的Clang版本?

  1. 转到https://developer.apple.com/downloads/ ,login,然后下载http://adcdownload.apple.com/Developer_Tools/Command_Line_Tools_OS_X_10.11_for_Xcode_7.2/Command_Line_Tools_OS_X_10.11_for_Xcode_7.2.dmg ,然后安装由fabregaszybuild议。
  2. 运行以下命令切换到旧版本: sudo xcode-select --switch /Library/Developer/CommandLineTools
  3. 运行以下命令快速检查clang版本: clang --version

在10.11版升级到XCode 7.3之后,我遇到了同样的问题。 重新安装以前的(7.2)命令行工具不会降级默认的clang编译器。 为了解决这个问题,我使用了以前的XCode.app包来重命名并将XcodeDefault.xctoolchain目录复制到当前/Applications/Xcode.app中的Toolchains导向器中。 您必须右键单击Xco​​de.app以“显示包内容”,然后浏览到工具链目录。

在这里输入图像说明

然后(重新)启动Xcode,点击命令,进入首选项,然后转到位置。 您将看到命令行工具的下拉菜单。 将其更改为您复制的工具链的版本。

在这里输入图像说明

您可以在terminal中检查叮当声的默认版本:

 clang -v OR llvm-gcc -v 

现在nvcc应该工作

我遇到了同样的问题。

我认为可以从https://developer.apple.com/downloads/下载的旧命令行工具

可以解决这个问题。

更新:

我从下面的链接下载并安装,铛版本成功地还原到苹果LLVM版本7.0.2铛700。 但请留意你的OS X版本。

http://adcdownload.apple.com/Developer_Tools/Command_Line_Tools_OS_X_10.11_for_Xcode_7.2/Command_Line_Tools_OS_X_10.11_for_Xcode_7.2.dmg

接受的答案是要下载下一个最新的命令行工具并安装它们,然后通过在控制台中input来select它们

 sudo xcode-select --switch /Library/Developer/CommandLineTools 

它被问及如何恢复到原始版本的工具。 这是通过

 sudo xcode-select --switch /Applications/Xcode.app 

不幸的是,从X代码版本7.2安装命令行工具。 目前还没有解决这个问题。

试图编译结果在:

nvcc fatal : GNU C/C++ compiler is no longer supported as a host compiler on Mac OS X.

对我来说,诀窍是卸载Xcode 7.3并从Apple开发者网站安装Xcode 6.2。

在/ Applications文件夹中将Xcode重命名为Xcode-7.app。 然后从https://developer.apple.com/download/more/下载Xcode6.4并安装。

80100可以使用一些nvcc程序

我用“80100”和nvcc为我的一些其他程序工作。

…但不是样品

`

 ... nvcc fatal : The version ('80100') of the host compiler ('Apple clang') is not supported ... 

`

安装CLT 8.2(苹果公司的命令行工具),可以使用“命令行工具实例”

我谷歌,看到关于这个( https://github.com/arrayfire/arrayfire/issues/1384 ) 有关arrays火灾nvcc问题的讨论,并感谢提示切换到CLT 8.2,最后一个版本不是最新的版本。 有关“命令行工具实例”的警告消息,

需要使用“sudo make”来编译示例代码:

`… $ sudo make Password:

 xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance expr: syntax error /Developer/NVIDIA/CUDA-8.0/bin/nvcc -ccbin g++ -I../../common/inc -m64 -Xcompiler -arch -Xcompiler x86_64 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_60,code=compute_60 -o deviceQuery.o -c deviceQuery.cpp nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning). /Developer/NVIDIA/CUDA-8.0/bin/nvcc -ccbin g++ -m64 -Xcompiler -arch -Xcompiler x86_64 -Xlinker -rpath -Xlinker /Developer/NVIDIA/CUDA-8.0/lib -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_60,code=compute_60 -o deviceQuery deviceQuery.o nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning). mkdir -p ../../bin/x86_64/darwin/release cp deviceQuery ../../bin/x86_64/darwin/release $ ./deviceQuery ./deviceQuery Starting... CUDA Device Query (Runtime API) version (CUDART static linking) Detected 1 CUDA Capable device(s) ... 

`

我有同样的问题! 看我的时间机器备份,并复制Xcode.app(7.2.1)在我的/应用程序文件夹。 您也可以从Apple开发者页面下载并将其移动到您的/ Application文件夹中。 完成之后,可以将Xcode的首选项命令行版本更改为7.2.1,然后nvcc将再次运行(即使使用pycuda-2016.1)。

clang --version

给我:

Apple LLVM version 7.0.2 (clang-700.1.81)

我会尝试自制的llvm版本,它适用于我。 brew install llvm37

然后,将你的编译器设置为自制的叮当声:/usr/local/bin/ which clang++-3.7或其他响应的which clang++-3.7

这样你可以保持你的OS X开发环境的默认设置。