【问题标题】:Linking error while building an open source iOS app构建开源 iOS 应用程序时出现链接错误
【发布时间】:2018-09-05 13:12:55
【问题描述】:

我正在尝试编译一个名为 Partita 的开源 iOS 应用程序,该项目似乎已经死了两年,而且看起来某些东西的更新破坏了一两件事。

这是我到目前为止所做的(我可能忘记了一个步骤)

其中一个依赖项(音频套件)是用旧的 swift 版本编译的,所以我采用了最新的源代码并编译了一个全新的框架并替换了 pod 给我的旧框架

添加了“尝试?”在一个给我“函数抛出但没有捕获”错误的函数之前

也许一两次调整

在某些时候,我必须编译才能在我的 iPhone 上发送,通用或虚拟设备返回更多错误,说 AudioKit 不可用,找不到声明等。但如果我为真实设备编译它就很好

现在我遇到了链接错误,他们在这里

Ld /Users/pierrick/Library/Developer/Xcode/DerivedData/Partita-doeawmfadbgytvfskorsvxjyuroj/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/TuningFork.build/Objects-normal/arm64/TuningFork normal arm64
    cd "/Users/pierrick/Documents/Documents - MacBook Pro de Pierrick/Programming/Partita/Pods"
    export IPHONEOS_DEPLOYMENT_TARGET=9.0
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk -L/Users/pierrick/Library/Developer/Xcode/DerivedData/Partita-doeawmfadbgytvfskorsvxjyuroj/Build/Products/Debug-iphoneos/TuningFork -F/Users/pierrick/Library/Developer/Xcode/DerivedData/Partita-doeawmfadbgytvfskorsvxjyuroj/Build/Products/Debug-iphoneos/TuningFork -F/Users/pierrick/Library/Developer/Xcode/DerivedData/Partita-doeawmfadbgytvfskorsvxjyuroj/Build/Products/Debug-iphoneos/Chronos-Swift -F/Users/pierrick/Documents/Documents\ -\ MacBook\ Pro\ de\ Pierrick/Programming/Partita/Pods/AudioKit/iOS -filelist /Users/pierrick/Library/Developer/Xcode/DerivedData/Partita-doeawmfadbgytvfskorsvxjyuroj/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/TuningFork.build/Objects-normal/arm64/TuningFork.LinkFileList -install_name @rpath/TuningFork.framework/TuningFork -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -miphoneos-version-min=9.0 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/pierrick/Library/Developer/Xcode/DerivedData/Partita-doeawmfadbgytvfskorsvxjyuroj/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/TuningFork.build/Objects-normal/arm64/TuningFork_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fobjc-arc -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -Xlinker -add_ast_path -Xlinker /Users/pierrick/Library/Developer/Xcode/DerivedData/Partita-doeawmfadbgytvfskorsvxjyuroj/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/TuningFork.build/Objects-normal/arm64/TuningFork.swiftmodule -framework AVFoundation -framework AudioKit -framework Chronos -framework AudioKit -framework Chronos -framework Foundation -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/pierrick/Library/Developer/Xcode/DerivedData/Partita-doeawmfadbgytvfskorsvxjyuroj/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/TuningFork.build/Objects-normal/arm64/TuningFork_dependency_info.dat -o /Users/pierrick/Library/Developer/Xcode/DerivedData/Partita-doeawmfadbgytvfskorsvxjyuroj/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/TuningFork.build/Objects-normal/arm64/TuningFork

Undefined symbols for architecture arm64:
  "std::__1::__vector_base_common<true>::__throw_length_error() const", referenced from:
      -[AKOperationGeneratorAudioUnit addCustomUgen:] in AudioKit(AKOperationGeneratorAudioUnit.o)
  "operator new(unsigned long)", referenced from:
      _createBoosterDSP in AudioKit(AKBooster-7854F601498F0658.o)
      -[AKOperationGeneratorAudioUnit addCustomUgen:] in AudioKit(AKOperationGeneratorAudioUnit.o)
  "vtable for __cxxabiv1::__vmi_class_type_info", referenced from:
      typeinfo for AKFrequencyTrackerDSPKernel in AudioKit(AKFrequencyTrackerAudioUnit.o)
      typeinfo for AKTesterDSPKernel in AudioKit(AKTesterAudioUnit.o)
      typeinfo for AKOperationGeneratorDSPKernel in AudioKit(AKOperationGeneratorAudioUnit.o)
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "vtable for __cxxabiv1::__class_type_info", referenced from:
      typeinfo for DSPKernel in AudioKit(AKFrequencyTrackerAudioUnit.o)
      typeinfo for AKOutputBuffered in AudioKit(AKFrequencyTrackerAudioUnit.o)
      typeinfo for AKDSPBase in AudioKit(AKBooster-7854F601498F0658.o)
      typeinfo for AKParameterRampBase in AudioKit(AKBooster-7854F601498F0658.o)
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "___cxa_begin_catch", referenced from:
      ___clang_call_terminate in AudioKit(AKFrequencyTrackerAudioUnit.o)
  "vtable for __cxxabiv1::__si_class_type_info", referenced from:
      typeinfo for AKDSPKernel in AudioKit(AKFrequencyTrackerAudioUnit.o)
      typeinfo for AKSoundpipeKernel in AudioKit(AKFrequencyTrackerAudioUnit.o)
      typeinfo for AKBuffered in AudioKit(AKFrequencyTrackerAudioUnit.o)
      typeinfo for AKBoosterDSP in AudioKit(AKBooster-7854F601498F0658.o)
      typeinfo for AKExponentialParameterRamp in AudioKit(AKBooster-7854F601498F0658.o)
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  "___cxa_pure_virtual", referenced from:
      vtable for AKSoundpipeKernel in AudioKit(AKFrequencyTrackerAudioUnit.o)
      vtable for AKDSPKernel in AudioKit(AKDSPKernel.o)
      vtable for AKSoundpipeKernel in AudioKit(AKOperationGeneratorAudioUnit.o)
  "operator delete(void*)", referenced from:
      AKFrequencyTrackerDSPKernel::~AKFrequencyTrackerDSPKernel() in AudioKit(AKFrequencyTrackerAudioUnit.o)
      AKTesterDSPKernel::~AKTesterDSPKernel() in AudioKit(AKTesterAudioUnit.o)
      -[AKOperationGeneratorAudioUnit addCustomUgen:] in AudioKit(AKOperationGeneratorAudioUnit.o)
      -[AKOperationGeneratorAudioUnit .cxx_destruct] in AudioKit(AKOperationGeneratorAudioUnit.o)
      AKOperationGeneratorDSPKernel::~AKOperationGeneratorDSPKernel() in AudioKit(AKOperationGeneratorAudioUnit.o)
      AKOperationGeneratorDSPKernel::~AKOperationGeneratorDSPKernel() in AudioKit(AKOperationGeneratorAudioUnit.o)
  "std::terminate()", referenced from:
      ___clang_call_terminate in AudioKit(AKFrequencyTrackerAudioUnit.o)
  "___gxx_personality_v0", referenced from:
      -[AKFrequencyTrackerAudioUnit createParameters] in AudioKit(AKFrequencyTrackerAudioUnit.o)
      BufferedAudioBus::init(AVAudioFormat*, unsigned int) in AudioKit(AKFrequencyTrackerAudioUnit.o)
      -[AKFrequencyTrackerAudioUnit allocateRenderResourcesAndReturnError:] in AudioKit(AKFrequencyTrackerAudioUnit.o)
      BufferedAudioBus::allocateRenderResources(unsigned int) in AudioKit(AKFrequencyTrackerAudioUnit.o)
      ___50-[AKFrequencyTrackerAudioUnit internalRenderBlock]_block_invoke in AudioKit(AKFrequencyTrackerAudioUnit.o)
      -[AKFrequencyTrackerAudioUnit .cxx_destruct] in AudioKit(AKFrequencyTrackerAudioUnit.o)
      AKFrequencyTrackerDSPKernel::~AKFrequencyTrackerDSPKernel() in AudioKit(AKFrequencyTrackerAudioUnit.o)
      ...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

错误似乎完全来自 AudioKit(我必须重新编译的框架),所以也许我必须更改一两个设置才能使其正常工作,老实说,我在这里迷路了!我刚刚迁移到 Mac 生态系统,我对项目结构和 Xcode 整体了解不多

https://github.com/comyar/Partita 这是我正在尝试编译的代码,以防它有用

提前感谢您的帮助

【问题讨论】:

  • 删除并添加您的第三方库可能会解决您的问题
  • 你是在正确的方式。使用 CocoaPods 下载 AudioKit 时会出现一些问题。从 Pods 项目中删除 AudioKit.framework 并下载最新版本:github.com/AudioKit/AudioKit/releases。然后在 Partita 应用程序中导入 AudioKit.framework 并尝试运行该应用程序。
  • @teja_D 第三方库是 AudioKit 吗?或所有豆荚。我手动更新了 AudioKit,也许我在更改框架文件时错过了一步,也许我不得不更改项目中的一些设置,我将它添加到“链接库和框架”中,但就是这样
  • @SDW 这实际上是我已经做过的,我重新编译了 AudioKit 4.1,虽然我成功编译了它,但也许我省略了在编译之前应该完成的某些设置,因此框架正在使用 Partita 我也是由于 swift 版本不匹配,没有使用预编译的框架,我想如果我自己编译所有东西,我会再遇到这个问题,它有效,但可能是我造成了当前的问题,因为我不知道如何正确编译框架跨度>

标签: ios swift xcode open-source


【解决方案1】:

这是 AudioKit.framework 的问题。

下载最新版本:https://github.com/AudioKit/AudioKit/releases

并按照说明操作:https://github.com/audiokit/AudioKit/blob/master/Frameworks/README.md#using-the-compiled-frameworks-in-your-projects

您需要做的是在Other Linker Flags 中添加-lstdc++,应用程序将正常运行!

【讨论】:

  • 我只是通过使用我自己编译的 3.7.1 设法让它工作(没有 -lstdc++)(作为预编译版本不匹配的抱怨),但如果我使用最新的 AudioKit 并执行您提供的说明,我仍然有链接器错误:(我很高兴我可以开始根据自己的喜好修改应用程序(这就是所有这一切的重点),但是拥有最新版本的 AudioKit 会很棒。稍后我会再次尝试一个新项目,因为我在所有尝试使其工作的过程中更改了许多设置非常感谢您的帮助并确认您可以使其工作!
  • 嗯,奇怪。好吧,我刚刚在这里上传了我的项目:files.fm/u/tc37uywd,如果你愿意的话,也许你可以看看它。只需打开 Partita.xcworkspace 并运行应用程序。 :)
  • 非常感谢,您的项目可以在我的设备和 iPhone 模拟上编译和运行(与我使用旧 AudioKit 的版本不同)虽然,当我在我的设备上尝试它时,应用程序运行,但没有没有按预期工作,我的旧 AudioKit 版本运行良好,所以我可能会坚持使用它,尽管你的项目也在模拟器上编译。但这无论如何都超出了我的问题范围。非常感谢您的帮助!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-12-05
  • 1970-01-01
  • 2013-07-17
  • 2021-04-10
相关资源
最近更新 更多