铿锵声:不能使用带有多项-arch选项的'precompiled-header'输出 [英] clang: cannot use 'precompiled-header' output with multiple -arch options

查看:251
本文介绍了铿锵声:不能使用带有多项-arch选项的'precompiled-header'输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编译我的项目时,突然从Xcode 4.5切换到Xcode 5时出现此错误消息。

 铿锵:不能使用'precompiled-header'输出和多元选项

我的GNU Makefile 包含以下片段:

  define build 
CC - $(platform) - $(2)?= $(CC - $(platform))
$ b $(bindir)/ $(platformdir) - $(2)$($(3)-dirsuffix)/ $ 1)_%:$(srcdir)/ $(1)/%。c $(common)
mkdir -p $$(@ D)
$$(CC - $(platform) - $ (2))$(cflags)$($(3)-cflags)$(CFLAGS)-o $$ @ $$ ^ $($(3)-ldflags)$(LDFLAGS)
endef

$(foreach library,$(libraries),$(foreach arch,$(archs),$(foreach configuration,$(configurations),$(eval $(call build,$(library),$(


$ $ $($ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ CC)
的计算结果为 cc ,它符号链接到clang。

解决方案

解决方案是从
文件列表中过滤掉头文件使用GNU 制作 $(滤除图案...,文本) 函数过滤掉所有符合%。h

  define build 
CC - $(platform) - $(2)?= $(CC - $(platform))

$(bindir)/ $(platformdir) - $(2)$( $(3)-dirsuffix)/ $(1)_%:$(srcdir)/ $(1)/%。c $(common)
mkdir -p $$(@ D)
$ $(CC - $(platform) - $(2))$(cflags)$($(3)-cflags)$(CFLAGS)-o $$ @ $$(过滤掉%.h,$$ ^) $($(3)-ldflags)$(LDFLAGS)
endef

然后 clang 不再混淆。


When compiling on of my projects, I suddenly got this error message when switching from Xcode 4.5 to Xcode 5.

clang: cannot use 'precompiled-header' output with multiple -arch options    

My GNU Makefile contains the following fragment:

define build
CC-$(platform)-$(2)?=$(CC-$(platform))

$(bindir)/$(platformdir)-$(2)$($(3)-dirsuffix)/$(1)_%: $(srcdir)/$(1)/%.c $(common)
  mkdir -p $$(@D)
  $$(CC-$(platform)-$(2)) $(cflags) $($(3)-cflags) $(CFLAGS) -o $$@ $$^ $($(3)-ldflags) $(LDFLAGS)
endef

$(foreach library,$(libraries),$(foreach arch,$(archs),$(foreach configuration,$(configurations),$(eval $(call build,$(library),$(arch),$(configuration))))))

And $(CC) evaluates to cc which is symlinked to clang.

解决方案

The solution is to filter out header files from the list of files being compiled by using GNU Make's $(filter-out pattern...,text) function to filter out everything that matches %.h:

define build
CC-$(platform)-$(2)?=$(CC-$(platform))

$(bindir)/$(platformdir)-$(2)$($(3)-dirsuffix)/$(1)_%: $(srcdir)/$(1)/%.c $(common)
  mkdir -p $$(@D)
  $$(CC-$(platform)-$(2)) $(cflags) $($(3)-cflags) $(CFLAGS) -o $$@ $$(filter-out %.h,$$^) $($(3)-ldflags) $(LDFLAGS)
endef

And then clang isn't confused anymore.

这篇关于铿锵声:不能使用带有多项-arch选项的'precompiled-header'输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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