【问题标题】:Mach-O Linker Error Xcode 5Mach-O 链接器错误 Xcode 5
【发布时间】:2013-12-03 02:24:12
【问题描述】:

我刚刚将我的 Xcode 更新到版本 5.0.2 更新后,我之前运行的所有应用程序(*完美运行和存档)现在在我尝试存档它们以在我的设备(未连接的设备)上进行测试时出现以下错误。

Ld /Users/dharammalik/Library/Developer/Xcode/DerivedData/lite_test-hblolzuqyvugvdfpenjeoxvmovrk/Build/Intermediates/ArchiveIntermediates/lite_test/IntermediateBuildFilesPath/lite_test.build/Release-iphoneos/lite_test.build/Objects-normal/armv7s/lite_test normal armv7s
    cd /Users/dharammalik/Documents/PhonegapWorkspace/lite_test
    setenv IPHONEOS_DEPLOYMENT_TARGET 5.0
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -L/Users/dharammalik/Library/Developer/Xcode/DerivedData/lite_test-hblolzuqyvugvdfpenjeoxvmovrk/Build/Intermediates/ArchiveIntermediates/lite_test/BuildProductsPath/Release-iphoneos -F/Users/dharammalik/Library/Developer/Xcode/DerivedData/lite_test-hblolzuqyvugvdfpenjeoxvmovrk/Build/Intermediates/ArchiveIntermediates/lite_test/BuildProductsPath/Release-iphoneos -filelist /Users/dharammalik/Library/Developer/Xcode/DerivedData/lite_test-hblolzuqyvugvdfpenjeoxvmovrk/Build/Intermediates/ArchiveIntermediates/lite_test/IntermediateBuildFilesPath/lite_test.build/Release-iphoneos/lite_test.build/Objects-normal/armv7s/lite_test.LinkFileList -dead_strip -weak_framework CoreFoundation -weak_framework UIKit -weak_framework AVFoundation -weak_framework CoreMedia -weak-lSystem -all_load -Obj-C -fobjc-link-runtime -miphoneos-version-min=5.0 -framework CoreLocation -framework ImageIO -framework OpenAL -framework AssetsLibrary /Users/dharammalik/Library/Developer/Xcode/DerivedData/lite_test-hblolzuqyvugvdfpenjeoxvmovrk/Build/Intermediates/ArchiveIntermediates/lite_test/BuildProductsPath/Release-iphoneos/libCordova.a -framework Foundation -weak_framework UIKit -framework CoreGraphics -framework AddressBook -framework AddressBookUI -framework AudioToolbox -weak_framework AVFoundation -framework CFNetwork -framework MediaPlayer -framework QuartzCore -framework SystemConfiguration -framework MobileCoreServices -weak_framework CoreMedia -framework CoreLocation -Xlinker -dependency_info -Xlinker /Users/dharammalik/Library/Developer/Xcode/DerivedData/lite_test-hblolzuqyvugvdfpenjeoxvmovrk/Build/Intermediates/ArchiveIntermediates/lite_test/IntermediateBuildFilesPath/lite_test.build/Release-iphoneos/lite_test.build/Objects-normal/armv7s/lite_test_dependency_info.dat -o /Users/dharammalik/Library/Developer/Xcode/DerivedData/lite_test-hblolzuqyvugvdfpenjeoxvmovrk/Build/Intermediates/ArchiveIntermediates/lite_test/IntermediateBuildFilesPath/lite_test.build/Release-iphoneos/lite_test.build/Objects-normal/armv7s/lite_test

ld: warning: ignoring file /Users/dharammalik/Library/Developer/Xcode/DerivedData/lite_test-hblolzuqyvugvdfpenjeoxvmovrk/Build/Intermediates/ArchiveIntermediates/lite_test/BuildProductsPath/Release-iphoneos/libCordova.a, file was built for archive which is not the architecture being linked (armv7s): /Users/dharammalik/Library/Developer/Xcode/DerivedData/lite_test-hblolzuqyvugvdfpenjeoxvmovrk/Build/Intermediates/ArchiveIntermediates/lite_test/BuildProductsPath/Release-iphoneos/libCordova.a
Undefined symbols for architecture armv7s:
  "_OBJC_METACLASS_$_CDVCommandDelegateImpl", referenced from:
      _OBJC_METACLASS_$_MainCommandDelegate in MainViewController.o
  "_CDVLocalNotification", referenced from:
      -[AppDelegate application:didReceiveLocalNotification:] in AppDelegate.o
  "_OBJC_CLASS_$_CDVCommandDelegateImpl", referenced from:
      _OBJC_CLASS_$_MainCommandDelegate in MainViewController.o
  "_OBJC_CLASS_$_CDVCommandQueue", referenced from:
      _OBJC_CLASS_$_MainCommandQueue in MainViewController.o
  "_OBJC_METACLASS_$_CDVViewController", referenced from:
      _OBJC_METACLASS_$_MainViewController in MainViewController.o
  "_OBJC_METACLASS_$_CDVCommandQueue", referenced from:
      _OBJC_METACLASS_$_MainCommandQueue in MainViewController.o
  "_CDVPluginHandleOpenURLNotification", referenced from:
      -[AppDelegate application:handleOpenURL:] in AppDelegate.o
  "_OBJC_CLASS_$_CDVViewController", referenced from:
      _OBJC_CLASS_$_MainViewController in MainViewController.o
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)

尝试更改架构,但没有任何效果。知道如何解决这些问题吗?在我以前的 Xcode 版本中,它们根本不存在。

【问题讨论】:

  • 我会尝试删除 DerivedData 目录的内容,或者从 Xcode 中进行“清理”。
  • 清理项目对我不起作用。

标签: ios cordova xcode5


【解决方案1】:

valid architectures 部分中删除armv7s,它将起作用。

构建设置 --> 架构 --> 有效架构

【讨论】:

  • 这样做有什么影响?这是否意味着该应用程序将无法在新的 iPad Airs 中运行?这会让我在 App Store 审核中被拒绝吗?
  • 我在确认后发布了这个答案。你可以参考我的问题stackoverflow.com/q/13815601/1740715
  • 我没有有效的架构选项?
  • @AbePetrillo 1)单击左侧面板中带有蓝色图标的项目名称(树状排列)。 2)选择构建设置选项卡 3)会有一个小的搜索框,您可以在其中搜索“有效”,然后会出现“有效架构”
  • @AbePetrillo 在“构建设置”面板的左上方区域,选择“全部”而不是“基本”。
【解决方案2】:

仅更改 Buid 设置 ---> Architecture ---> Build Active Architecture ---> Yes 这解决了我在新 Xcode 5 中使用旧科尔多瓦版本的问题

【讨论】:

  • 我正在使用 Cordova 3.3.0,这是解决我问题的罪魁祸首 - 谢谢
【解决方案3】:

我遇到了同样的问题,问题是我不小心在实现文件中导入了 .m 文件而不是 .h - 希望对您有所帮助

【讨论】:

    【解决方案4】:
    libCordova.a, file was built for archive which is not the architecture being linked (armv7s)
    

    您的 libCordova 框架副本似乎不包含 armv7s 二进制文件。

    【讨论】:

    • 有什么解决办法?
    • 将架构更改为仅 armv7。或者您可以重新编译(Cordova 有源代码吗?)Cordova 以包含 armv7s。由于您正在构建 armv7 和 armv7s,因此它希望所有库/框架都包含这两种架构。无论如何,您都不需要 armv7s,除非您需要 armv7s 处理器中为数不多的少数添加指令之一。
    【解决方案5】:

    您需要在 CordovaLib 项目中更改架构,而不是在您的 lite_test 项目中。我假设当您说您尝试更改架构时,您只尝试了您的项目而不是 Cordova 项目(因为更改 Cordova 对我有用)。请记住,Cordova 是一个依赖项目,每次运行时都会编译成二进制文件。

    【讨论】:

    • 您能否告诉我删除这些错误应该遵循的详细步骤
    猜你喜欢
    • 2012-12-31
    • 2017-11-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-02
    • 2013-12-30
    • 2013-02-06
    相关资源
    最近更新 更多