简体   繁体   中英

Integrating OpenCV with XCode - Excluded Architecture

Tried to use OpenCV library in swift.

The library forces me to implement changes below: 排除架构

Otherwise, without those changes i get an error:

OpenCV 错误 Also in this App i want the user to pick an image from phone's gallery. To handle it, I'm using PHPicker. However, with Excluded Architectures set, I'm not able to pick any image from the gallery , there's buch of errors/warnings in Terminal. Without Excluded Architectures app will crash with Error as at second screen. Any ideas or tips?

Error from screen

Ld /Users/Kacper/Library/Developer/Xcode/DerivedData/OpenCVTest-agzhkmtplgmvfohcejwaizkysxoy/Build/Products/Debug-iphonesimulator/OpenCVTest.app/OpenCVTest normal (in target 'OpenCVTest' from project 'OpenCVTest')
    cd /Users/Kacper/Downloads/OpenCVTest
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -target arm64-apple-ios12.0-simulator -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk -L/Users/Kacper/Library/Developer/Xcode/DerivedData/OpenCVTest-agzhkmtplgmvfohcejwaizkysxoy/Build/Products/Debug-iphonesimulator -F/Users/Kacper/Library/Developer/Xcode/DerivedData/OpenCVTest-agzhkmtplgmvfohcejwaizkysxoy/Build/Products/Debug-iphonesimulator -F/Users/Kacper/Downloads/OpenCVTest -filelist /Users/Kacper/Library/Developer/Xcode/DerivedData/OpenCVTest-agzhkmtplgmvfohcejwaizkysxoy/Build/Intermediates.noindex/OpenCVTest.build/Debug-iphonesimulator/OpenCVTest.build/Objects-normal/arm64/OpenCVTest.LinkFileList -Xlinker -rpath -Xlinker /usr/lib/swift -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/Kacper/Library/Developer/Xcode/DerivedData/OpenCVTest-agzhkmtplgmvfohcejwaizkysxoy/Build/Intermediates.noindex/OpenCVTest.build/Debug-iphonesimulator/OpenCVTest.build/Objects-normal/arm64/OpenCVTest_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -stdlib\=libc++ -fobjc-arc -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -L/usr/lib/swift -Xlinker -add_ast_path -Xlinker /Users/Kacper/Library/Developer/Xcode/DerivedData/OpenCVTest-agzhkmtplgmvfohcejwaizkysxoy/Build/Intermediates.noindex/OpenCVTest.build/Debug-iphonesimulator/OpenCVTest.build/Objects-normal/arm64/OpenCVTest.swiftmodule -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/Kacper/Library/Developer/Xcode/DerivedData/OpenCVTest-agzhkmtplgmvfohcejwaizkysxoy/Build/Intermediates.noindex/OpenCVTest.build/Debug-iphonesimulator/OpenCVTest.build/OpenCVTest.app-Simulated.xcent -framework opencv2 -framework CoreFoundation -framework Accelerate -framework CoreGraphics -framework AssetsLibrary -framework CoreMedia -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Users/Kacper/Library/Developer/Xcode/DerivedData/OpenCVTest-agzhkmtplgmvfohcejwaizkysxoy/Build/Intermediates.noindex/OpenCVTest.build/Debug-iphonesimulator/OpenCVTest.build/Objects-normal/arm64/OpenCVTest_dependency_info.dat -o /Users/Kacper/Library/Developer/Xcode/DerivedData/OpenCVTest-agzhkmtplgmvfohcejwaizkysxoy/Build/Products/Debug-iphonesimulator/OpenCVTest.app/OpenCVTest

ld: in /Users/Kacper/Downloads/OpenCVTest/opencv2.framework/opencv2(ios_conversions.o), building for iOS Simulator, but linking in object file built for iOS, for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Text formating of error is not my fault!

so, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64 I guess that means you need the library built for the simulator, not for the actual target device.

It works when you try compile it, using real iPhone/iPad

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM