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

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

问题描述



我在一个支持iOS 6.0的旧项目中收到这个错误:

 错误:

clang:错误:未知参数:'-fno-obj-arc'[-Wunused-命令行参数硬错误在未来]
clang:注意:这将是一个硬错误(不能降级到警告)在未来
命令/Applications/Xcode.app /Content/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang失败,退出代码为1

关于这一点在互联网上没有太多的帖子,一些建议似乎是改变你的 CFLAGS ,但我不知道如何在Xcode。



Apple通过他们的文档提出这一点:


编译器



从Apple LLVM编译器版本5.1(clang-502)及更高版本开始,
优化级别-O4不再暗示链路时间优化(LTO)。
为了使用LTO进行构建,显式地使用-flto选项和优化级别标志
。 (15633276)
中的Apple LLVM编译器Xcode 5.1将无法识别的命令行选项视为错误。在构建Python原生扩展和
Ruby Gems时已经看到了这个
问题,其中一些无效的编译器选项目前是
。使用无效编译器选项的项目将需要
更改以删除这些选项。为了帮助缓和过渡,
编译器将临时接受一个选项将错误降级为
警告:



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



注意:在将来。要解决
此问题,请设置ARCHFLAGS环境变量将
错误降级为警告。例如,您可以使用以下命令安装Python本机
扩展:



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



同样,您可以安装Ruby Gem:



$ ARCHFLAGS = -Wno-error = unused-命令行参数 - 未来的硬错误gem install GemName 16214764 updated


如何解决此问题?显然苹果已经搞砸了,因为它应该只给我一个警告,而不是根据他们的文件的错误。



任何帮助将非常感谢。我不能建立我的应用程序,直到这个问题得到纠正。

解决方案

没有这样的事情 fno-obj-arc 。这从不工作正常;你只是没有看到警告。正确的形式是 -fno-objc-arc



这不是clang错误。这是项目中的错误; ang只是报告它。项目本身错误地包含 -fno-obj-arc 参数,可能在目标的编译源构建阶段(如下所述:如何为项目中的单个文件禁用ARC?)。很容易键入设置不正确;在Xcode 5.1中发生了什么变化,只是俚语现在正在呼唤你的注意问题。因此,正如我之前所说,这从不工作正常;你可能想要关闭ARC的某些文件,但你没有这样做,因为生成参数输入不正确。


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

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

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 suggests this from their documents:

Compiler

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

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

Similarly, you can install a Ruby Gem with:

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

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.

解决方案

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.

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天全站免登陆