xcode LLVM 5.1 clang 错误 [英] xcode LLVM 5.1 clang error

查看:34
本文介绍了xcode LLVM 5.1 clang 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Xcode 5.1 发布后的最后几天我运气不佳.

I am having no luck the last few days since Xcode 5.1 came out.

我在支持 iOS 6.0 的旧项目上不断收到此错误:

I keep getting this error on an old project that supports iOS 6.0:

ERROR:

clang: error: unknown argument: '-fno-obj-arc' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

互联网上关于此的帖子并不多,一些建议似乎是更改您的 CFLAGS 但我不知道如何在 Xcode 中执行此操作.

There are not many posts about this on the internet and some suggestions seem to be to change your CFLAGS but I have no idea how to do that in Xcode.

Apple 从他们的文档中建议:

Apple suggests this from their documents:

编译器

从 Apple LLVM 编译器版本 5.1 (clang-502) 及更高版本开始,优化级别 -O4 不再意味着链接时间优化 (LTO).为了使用 LTO 进行构建,另外显式使用 -flto 选项到优化级别标志.(15633276) Apple LLVM 编译器Xcode 5.1 将无法识别的命令行选项视为错误.这在构建 Python 本机扩展和Ruby Gems,目前存在一些无效的编译器选项指定的.使用无效编译器选项的项目将需要更改为删除这些选项.为了帮助缓解这种过渡,编译器将暂时接受将错误降级为警告:

As of Apple LLVM compiler version 5.1 (clang-502) and later, the optimization level -O4 no longer implies link time optimization (LTO). In order to build with LTO explicitly use the -flto option in addition to the optimization level flag. (15633276) The Apple LLVM compiler in Xcode 5.1 treats unrecognized command-line options as errors. This issue has been seen when building both Python native extensions and Ruby Gems, where some invalid compiler options are currently specified. Projects using invalid compiler options will need to be changed to remove those options. To help ease that transition, the compiler will temporarily accept an option to downgrade the error to a warning:

-Wno-error=unused-command-line-argument-hard-error-in-future

注意:以后将不再支持此选项.解决方法这个问题,设置ARCHFLAGS环境变量降级错误到警告.例如,您可以安装 Python 本机扩展名:

Note: This option will not be supported in the future. To workaround this issue, set the ARCHFLAGS environment variable to downgrade the error to a warning. For example, you can install a Python native extension with:

$ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future easy_install ExtensionName

同样,您可以通过以下方式安装 Ruby Gem:

Similarly, you can install a Ruby Gem with:

$ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install GemName 16214764 更新

如何获得此解决方法?显然,Apple 搞砸了,因为根据他们的文档,它应该只向我显示警告而不是错误.

How do I get this workaround? Obviously Apple has messed up because it should only be presenting me with a warning and not an error according to their documents.

任何帮助将不胜感激.在此问题得到纠正之前,我无法构建我的应用程序.

Any help would be greatly appreciated. I can not build my app until this issue is rectified.

推荐答案

没有-fno-obj-arc这样的东西.这从来没有正常工作;你只是没有看到警告.正确的形式是-fno-objc-arc.

There is no such thing as -fno-obj-arc. This never was working correctly; you just weren't seeing the warnings. The correct form is -fno-objc-arc.

编辑(从我下面的评论中提取的附加信息):这不是一个铿锵的错误.这是项目中的错误;clang 只是在报告它.项目本身错误地包含 -fno-obj-arc 参数,可能在目标的编译源构建阶段(如此处所述:如何为项目中的单个文件禁用 ARC?).很容易打错设置;Xcode 5.1 中发生的变化仅仅是 clang 现在提醒你注意这个问题.因此,正如我之前所说,这个 never 工作正常;您可能打算为某些文件关闭 ARC,但您没有这样做,因为错误输入了 build 参数.

EDIT (appended info drawn from my comments below): This is not a clang error. It is an error in the project; clang is merely reporting it. The project itself wrongly contains the -fno-obj-arc argument, probably in the Compile Sources build phase of the target (as described here: How can I disable ARC for a single file in a project?). It is easy to type the setting incorrectly; what has changed in Xcode 5.1 is merely that clang is now calling the problem to your attention. Thus, as I said before, this never was working correctly; you presumably intended to turn off ARC for certain files, but you were failing to do so, as the build argument was incorrectly entered.

这篇关于xcode LLVM 5.1 clang 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆