alibaba / MNN

MNN is a blazing fast, lightweight deep learning framework, battle-tested by business-critical use cases in Alibaba
http://www.mnn.zone/
8.72k stars 1.67k forks source link

iOS 编译出现 Undefined symbols #2769

Closed Code89757 closed 5 months ago

Code89757 commented 8 months ago

电脑: macbook pro (intel) 使用 framework 库是:https://github.com/alibaba/MNN/releases/download/2.8.1/mnn_2.8.1_ios_armv82_cpu_metal_coreml.zip

目标是使用现成的 MNN 执行推理。

但是,在连接手机后,执行得到如下错误日志:

Ld /Users/*/Library/Developer/Xcode/DerivedData/MNN-dxroxcwpenhhdwbydkciluofcvdn/Build/Products/Debug-iphoneos/demo.app/demo normal (in target 'demo' from project 'MNN')
    cd /Users/*/Project/MNN-2.8.1/project/ios
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -Xlinker -reproducible -target arm64-apple-ios12.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.2.sdk -O0 -L/Users/*/Library/Developer/Xcode/DerivedData/MNN-dxroxcwpenhhdwbydkciluofcvdn/Build/Intermediates.noindex/EagerLinkingTBDs/Debug-iphoneos -L/Users/*/Library/Developer/Xcode/DerivedData/MNN-dxroxcwpenhhdwbydkciluofcvdn/Build/Products/Debug-iphoneos -F/Users/*/Library/Developer/Xcode/DerivedData/MNN-dxroxcwpenhhdwbydkciluofcvdn/Build/Intermediates.noindex/EagerLinkingTBDs/Debug-iphoneos -F/Users/*/Library/Developer/Xcode/DerivedData/MNN-dxroxcwpenhhdwbydkciluofcvdn/Build/Products/Debug-iphoneos -filelist /Users/*/Library/Developer/Xcode/DerivedData/MNN-dxroxcwpenhhdwbydkciluofcvdn/Build/Intermediates.noindex/MNN.build/Debug-iphoneos/demo.build/Objects-normal/arm64/demo.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/*/Library/Developer/Xcode/DerivedData/MNN-dxroxcwpenhhdwbydkciluofcvdn/Build/Intermediates.noindex/MNN.build/Debug-iphoneos/demo.build/Objects-normal/arm64/demo_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -stdlib\=libc++ -fobjc-arc -fobjc-link-runtime -all_load -framework CoreMedia -framework AVKit -framework MNN -framework AVFoundation -framework Metal -framework CoreML -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Users/*/Library/Developer/Xcode/DerivedData/MNN-dxroxcwpenhhdwbydkciluofcvdn/Build/Intermediates.noindex/MNN.build/Debug-iphoneos/demo.build/Objects-normal/arm64/demo_dependency_info.dat -o /Users/*/Library/Developer/Xcode/DerivedData/MNN-dxroxcwpenhhdwbydkciluofcvdn/Build/Products/Debug-iphoneos/demo.app/demo

ld: Undefined symbols:
  MNN::ConvolutionHybrid::ConvolutionHybrid(MNN::Convolution2DCommon const*, MNN::Backend*, float const*, unsigned long, float const*, unsigned long, std::__1::shared_ptr<MNN::ConvolutionCommon::Int8Common>), referenced from:
      MNN::_createUnit(MNN::Tensor const*, MNN::Tensor const*, MNN::Backend*, MNN::Convolution2D const*, float const*, unsigned long, float const*, unsigned long, std::__1::shared_ptr<MNN::ConvolutionCommon::Int8Common>, bool) in MNN[105](ConvolutionFloatFactory.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)

请问要如何解决这个问题

justinsongtx commented 7 months ago

demo里的文件漏了,把文件加到工程里就好了,路径在 MNN/source/backend/cpu/compute/ConvolutionHybrid.cpp MNN/source/backend/cpu/compute/ConvolutionHybrid.hpp

加到这里: image

github-actions[bot] commented 5 months ago

Marking as stale. No activity in 60 days.