Closed zoltancsipler closed 1 month ago
Hi @priankakariatyml,
Do you know how to create a dynamic framework?
Thank you!!
Any updates on this?
Any updates on this?
The following is the command to build the frameworks using bazel: FRAMEWORK_NAME=MediaPipeTasksCommon MPP_BUILD_VERSION=your_version 'path/to/mediapipe/tasks/ios/build_ios_framework.sh'
This creates the archives in your home directory.
Repeat the same for MediaPipeTasksVision.
MediaPipeTasksCommon archive also contains additional static graph libraries which are to be force linked in to the app via the OTHER_LINKER_FLAGS
. That's why you are getting those undefined symbols because these libraries are not force linked.
You can take a look at the pod spec for MediaPipeTasksCommon
to check what is to be added to your library's pod spec to get those graph libraries linked.
Hi @ashishkakkad8,
Could you please review the information above and provide an update on the status?
Thank you!!
Any updates on this?
The following is the command to build the frameworks using bazel: FRAMEWORK_NAME=MediaPipeTasksCommon MPP_BUILD_VERSION=your_version 'path/to/mediapipe/tasks/ios/build_ios_framework.sh'
This creates the archives in your home directory.
Repeat the same for MediaPipeTasksVision.
MediaPipeTasksCommon archive also contains additional static graph libraries which are to be force linked in to the app via the
OTHER_LINKER_FLAGS
. That's why you are getting those undefined symbols because these libraries are not force linked.You can take a look at the pod spec for
MediaPipeTasksCommon
to check what is to be added to your library's pod spec to get those graph libraries linked.
Also, if you don't want to use Bazel to build the frameworks and graph libraries, you can obtain these additional static graph libraries archives from your Xcode project after the MediaPipeTasksVision
pod is installed from YOUR_PROJECT_ROOT/Pods/MediaPipeTasksCommon/frameworks/graph_libraries
These libraries won't be visible in your project navigator in Xcode, but you can see them in finder.
Thanks for the reply.
After adding in MySDK podspec I am still getting following crash while initializing the library :
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString cppString]: unrecognized selector sent to instance 0x10ec572b8' *** First throw call stack: (0x199618f20 0x1914ce018 0x199722480 0x1995b5fb4 0x1995b58d0 0x10d646f80 0x10d6461a4 0x10dcf24f8 0x10dcf1094 0x10cb76b68 0x10cb73bf4 0x10cb73ac4 0x10cb73844 0x10cb733c8 0x10cb73f60 0x10d487a0c 0x10d48771c 0x10d48702c 0x10d481044 0x10d481074 0x19b875280 0x19b873e48 0x19b873a80 0x19bd83050 0x19bd82b4c 0x19bd83d44 0x19bd857e4 0x19bd7f81c 0x19bd7f544 0x19bd7f3d8 0x10d48c378 0x10d48cef4 0x10c39a4bc 0x19bace2e4 0x19bacdd88 0x19bb279ac 0x19bbcbe30 0x19bbcbab4 0x19b8a691c 0x19b8a6800 0x19b8a5518 0x19b8b2b14 0x19b8b2b84 0x19ac54c50 0x1087ba7bc 0x1087cad58 0x1087ca90c 0x1995eb710 0x1995e8914 0x1995e7cd8 0x1de4981a8 0x19bc2090c 0x19bcd49d0 0x19be4e384 0x104395368 0x1043952e0 0x1043953e4 0x1bcc99e4c) -[__NSCFConstantString cppString]: unrecognized selector sent to instance 0x10ec572b8 ["0 CoreFoundation 0x0000000199618f2c 00E76A98-210C-3CB5-930B-F236807FF24C + 540460", "1 libobjc.A.dylib 0x00000001914ce018 objc_exception_throw + 60", "2 CoreFoundation 0x0000000199722480 00E76A98-210C-3CB5-930B-F236807FF24C + 1627264", "3 CoreFoundation 0x00000001995b5fb4 00E76A98-210C-3CB5-930B-F236807FF24C + 135092", "4 CoreFoundation 0x00000001995b58d0 _CF_forwarding_prep_0 + 96", "5 MySDK 0x000000010d646f80 -[MPPTaskInfo generateGraphConfigWithError:] + 328", "6 MySDK 0x000000010d6461a4 -[MPPTaskRunner initWithTaskInfo:packetsCallback:error:] + 84", "7 MySDK 0x000000010dcf24f8 -[MPPVisionTaskRunner initWithTaskInfo:runningMode:roiAllowed:packetsCallback:imageInputStreamName:normRectInputStreamName:error:] + 364", "8 MySDK 0x000000010dcf1094 -[MPPFaceDetector initWithOptions:error:] + 856", "9 MySDK 0x000000010cb76b68 $sSo15MPPFaceDetectorC7optionsABSo0aB7OptionsC_tKcfcTO + 128", "10 MySDK 0x000000010cb73bf4 $sSo15MPPFaceDetectorC7optionsABSo0aB7OptionsC_tKcfC + 52", "11 MySDK 0x000000010cb73ac4 $s9MySDK19FaceDetectorServiceC06createcD033_CFB0652C910AF8F9E82691C102BFD6F3LLyyF + 576", "12 MySDK 0x000000010cb73844 $s9MySDK19FaceDetectorServiceC9modelPath22minDetectionConfidence0H20SuppressionThreshold11runningMode8delegateACSgSSSg_S2fSo010MPPRunningN0VSo11MPPDelegateVtc33_CFB0652C910AF8F9E82691C102BFD6F3Llfc + 1132", "13 MySDK 0x000000010cb733c8 $s9MySDK19FaceDetectorServiceC9modelPath22minDetectionConfidence0H20SuppressionThreshold11runningMode8delegateACSgSSSg_S2fSo010MPPRunningN0VSo11MPPDelegateVtc33_CFB0652C910AF8F9E82691C102BFD6F3LlfC + 80", "14 MySDK 0x000000010cb73f60 $s9MySDK19FaceDetectorServiceC010stillImagedE09modelPath22minDetectionConfidence0J20SuppressionThreshold8delegateACSgSSSg_S2fSo11MPPDelegateVtFZ + 140", "15 MySDK 0x000000010d487a0c $s9MySDK38UploadAvatarPhotoPreviewViewControllerC37clearAndInitializeFaceDetectorServiceyyF + 332", "16 MySDK 0x000000010d48771c $s9MySDK38UploadAvatarPhotoPreviewViewControllerC10detectFace33_BEAB8AA81E4FD5F8C6578C5342F15ECFLL4fromySo7UIImageC_tF + 280", "17 MySDK 0x000000010d48702c $s9MySDK38UploadAvatarPhotoPreviewViewControllerC07displayF033_BEAB8AA81E4FD5F8C6578C5342F15ECFLLyyF + 1072", "18 MySDK 0x000000010d481044 $s9MySDK38UploadAvatarPhotoPreviewViewControllerC11viewDidLoadyyF + 124", "19 MySDK 0x000000010d481074 $s9MySDK38UploadAvatarPhotoPreviewViewControllerC11viewDidLoadyyFTo + 36", "20 UIKitCore 0x000000019b875280 1741FA37-4E53-371E-8DAE-D611AAB0043D + 389760", "21 UIKitCore 0x000000019b873e48 1741FA37-4E53-371E-8DAE-D611AAB0043D + 384584", "22 UIKitCore 0x000000019b873a80 1741FA37-4E53-371E-8DAE-D611AAB0043D + 383616", "23 UIKitCore 0x000000019bd83050 1741FA37-4E53-371E-8DAE-D611AAB0043D + 5689424", "24 UIKitCore 0x000000019bd82b4c 1741FA37-4E53-371E-8DAE-D611AAB0043D + 5688140", "25 UIKitCore 0x000000019bd83d44 1741FA37-4E53-371E-8DAE-D611AAB0043D + 5692740", "26 UIKitCore 0x000000019bd857e4 1741FA37-4E53-371E-8DAE-D611AAB0043D + 5699556", "27 UIKitCore 0x000000019bd7f81c 1741FA37-4E53-371E-8DAE-D611AAB0043D + 5675036", "28 UIKitCore 0x000000019bd7f544 1741FA37-4E53-371E-8DAE-D611AAB0043D + 5674308", "29 UIKitCore 0x000000019bd7f3d8 1741FA37-4E53-371E-8DAE-D611AAB0043D + 5673944", "30 MySDK 0x000000010d48c378 $s9MySDK31UploadAvatarPhotoViewControllerC04opencde7PreviewfG05imageySo7UIImageC_tF + 244", "31 MySDK 0x000000010d48cef4 $s9MySDK31UploadAvatarPhotoViewControllerC011imagePickerG0_29didFinishPickingMediaWithInfoySo07UIImageiG0C_SDySo0pigO3KeyaypGtFyycfU_ + 188", "32 MySDK 0x000000010c39a4bc $sIeg_IeyB_TR + 48", "33 UIKitCore 0x000000019bace2e4 1741FA37-4E53-371E-8DAE-D611AAB0043D + 2851556", "34 UIKitCore 0x000000019bacdd88 1741FA37-4E53-371E-8DAE-D611AAB0043D + 2850184", "35 UIKitCore 0x000000019bb279ac 1741FA37-4E53-371E-8DAE-D611AAB0043D + 3217836", "36 UIKitCore 0x000000019bbcbe30 1741FA37-4E53-371E-8DAE-D611AAB0043D + 3890736", "37 UIKitCore 0x000000019bbcbab4 1741FA37-4E53-371E-8DAE-D611AAB0043D + 3889844", "38 UIKitCore 0x000000019b8a691c __UIVIEW_IS_EXECUTING_ANIMATION_COMPLETION_BLOCK__ + 36", "39 UIKitCore 0x000000019b8a6800 1741FA37-4E53-371E-8DAE-D611AAB0043D + 591872", "40 UIKitCore 0x000000019b8a5518 1741FA37-4E53-371E-8DAE-D611AAB0043D + 587032", "41 UIKitCore 0x000000019b8b2b14 1741FA37-4E53-371E-8DAE-D611AAB0043D + 641812", "42 UIKitCore 0x000000019b8b2b84 1741FA37-4E53-371E-8DAE-D611AAB0043D + 641924", "43 QuartzCore 0x000000019ac54c50 A4B65B35-9EEB-38E4-9D4F-7146AAE1E28C + 318544", "44 libdispatch.dylib 0x00000001087ba7bc _dispatch_client_callout + 20", "45 libdispatch.dylib 0x00000001087cad58 _dispatch_main_queue_drain + 1084", "46 libdispatch.dylib 0x00000001087ca90c _dispatch_main_queue_callback_4CF + 44", "47 CoreFoundation 0x00000001995eb710 00E76A98-210C-3CB5-930B-F236807FF24C + 354064", "48 CoreFoundation 0x00000001995e8914 00E76A98-210C-3CB5-930B-F236807FF24C + 342292", "49 CoreFoundation 0x00000001995e7cd8 CFRunLoopRunSpecific + 608", "50 GraphicsServices 0x00000001de4981a8 GSEventRunModal + 164", "51 UIKitCore 0x000000019bc2090c 1741FA37-4E53-371E-8DAE-D611AAB0043D + 4237580", "52 UIKitCore 0x000000019bcd49d0 UIApplicationMain + 340", "53 UIKitCore 0x000000019be4e384 1741FA37-4E53-371E-8DAE-D611AAB0043D + 6521732", "54 MySDKExample 0x0000000104395368 $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ + 120", "55 MySDKExample 0x00000001043952e0 $s16MySDKExample11AppDelegateC5$mainyyFZ + 44", "56 MySDKExample 0x00000001043953e4 main + 28", "57 dyld 0x00000001bcc99e4c 71846EAC-EE65-3697-BF7D-790B6A07DCDB + 249420"] libc++abi: terminating due to uncaught exception of type NSException
Podspec of my SDK:
Pod::Spec.new do |spec|
spec.name = "MySDK"
spec.version = "0.0.1"
spec.summary = "MySDK is an SDK that consist feeds for which user has shown interest."
spec.description = "This is a sdk"
spec.license = "MIT"
spec.platform = :ios
spec.platform = :ios, "15.0"
spec.ios.deployment_target = "15.0"
spec.source_files = 'MySDK/Classes/**/*.{swift,plist,xcdatamodeld,momd,h,m,storyboard,xib}', 'MySDK/Classes/Database/my.xcdatamodeld', 'MySDK/Classes/Database/my.xcdatamodeld/*.xcdatamodel', 'MySDK/MySDK.h'
spec.exclude_files = "Classes/Exclude"
spec.swift_version = "5.0"
spec.preserve_paths = 'MySDK/Classes/Database/my.xcdatamodeld'
spec.public_header_files = "MySDK/MySDK.h", "MySDK/Classes/Libraries/XHScrollMenu/Source/*.h", "MySDK/Classes/Libraries/CustomViews/*.h"
spec.resources = ["MySDK/Resources/**/*.{storyboard,xib,xcassets,json,png,gif,jpg,mp4,ttf,tflite}", 'MySDK/Classes/Database/my.xcdatamodeld', 'MySDK/Classes/Database/my.xcdatamodeld/*.xcdatamodel']
spec.dependency 'Alamofire', '~> 5.8.1'
spec.dependency 'SDWebImage', '~> 5.18.10'
spec.dependency 'Socket.IO-Client-Swift', '~> 16.1.0'
spec.dependency 'URLEmbeddedView', '~> 0.18.0'
#spec.dependency 'AppsFlyerFramework', '~> 6.12.3'
spec.dependency 'lottie-ios', '~> 4.4.0'
spec.dependency 'ffmpeg-kit-ios-min-gpl', '~> 6.0.0'
spec.dependency 'DatadogSDK', '~> 1.23.0'
spec.dependency 'DatadogSDKAlamofireExtension', '~> 1.23.0'
spec.dependency 'Hero', '~> 1.6.2'
spec.dependency 'libPhoneNumber-iOS', '~> 0.9.15'
spec.dependency 'SkeletonView', '~> 1.30.4'
spec.dependency 'CryptoSwift', '~> 1.8.1'
spec.dependency 'SnapKit', '~> 5.6.0'
spec.dependency 'EasyTipView', '~> 2.1'
spec.dependency 'XLPagerTabStrip', '~> 9.1.0'
#spec.dependency 'FirebaseCrashlytics', '~> 10.20.0'
#spec.dependency 'FirebaseMessaging', '~> 10.20.0'
#spec.dependency 'FirebaseAnalytics/WithoutAdIdSupport', '~> 10.20.0'
#spec.dependency 'FirebaseDynamicLinks', '~> 10.20.0'
spec.dependency 'Giphy', '~> 2.1.22'
spec.dependency 'CropViewController', '~> 2.6.1'
spec.dependency 'Rudder', '~> 2.4.2'
spec.dependency 'SwiftyGif', '~> 5.4.4'
spec.dependency 'MaterialComponents/ActivityIndicator', '~> 124.2.0'
#spec.dependency 'UXCam', '~> 3.6.8'
spec.dependency 'SwiftMessages', '~> 9.0.9'
#spec.dependency 'Mixpanel-swift', '~> 4.2.0'
#spec.dependency 'MediaPipeTasksVision', '0.10.14'
spec.vendored_frameworks = "MySDK/Frameworks/MediaPipeTasksCommon.xcframework", "MySDK/Frameworks/MediaPipeTasksVision.xcframework"
spec.pod_target_xcconfig = {
'OTHER_LDFLAGS[sdk=iphonesimulator*]' => '$(inherited) -l"c++" -force_load "${PODS_ROOT}/../../MySDK/Frameworks/graph_libraries/libMediaPipeTasksCommon_simulator_graph.a"',
'OTHER_LDFLAGS[sdk=iphoneos*]' => '$(inherited) -l"c++" -force_load "$(PODS_ROOT)/../../MySDK/Frameworks/graph_libraries/libMediaPipeTasksCommon_device_graph.a"',
}
# spec.library = 'c++'
spec.frameworks = 'Accelerate', 'CoreMedia', 'AssetsLibrary', 'CoreFoundation', 'CoreGraphics', 'CoreImage', 'QuartzCore', 'AVFoundation', 'CoreVideo'
end
@priankakariatyml @kuaashish
I found the solution. -ObjC
linker flag required in podspec.
spec.vendored_frameworks = "MySDK/Frameworks/MediaPipeTasksCommon.xcframework", "MySDK/Frameworks/MediaPipeTasksVision.xcframework"
spec.pod_target_xcconfig = {
'OTHER_LDFLAGS[sdk=iphonesimulator*]' => '$(inherited) -l"c++" -ObjC -force_load "${PODS_ROOT}/../../MySDK/Frameworks/graph_libraries/libMediaPipeTasksCommon_simulator_graph.a"',
'OTHER_LDFLAGS[sdk=iphoneos*]' => '$(inherited) -l"c++" -ObjC -force_load "$(PODS_ROOT)/../../MySDK/Frameworks/graph_libraries/libMediaPipeTasksCommon_device_graph.a"',
}
Hi @zoltancsipler,
Could you please try the above suggestion https://github.com/google-ai-edge/mediapipe/issues/5328#issuecomment-2314589955 and let us know if you are still experiencing the issue?
Thank yoi!!
This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.
This issue was closed due to lack of activity after being marked stale for past 7 days.
OS Platform and Distribution
iOS
Compiler version
No response
Programming Language and version
Swift
Installed using virtualenv? pip? Conda?(if python)
No response
MediaPipe version
0.10.5
Bazel version
No response
XCode and Tulsi versions (if iOS)
15.0.1
Android SDK and NDK versions (if android)
No response
Android AAR (if android)
None
OpenCV version (if running on desktop)
No response
Describe the problem
I have a dynamic framework where I would like to use the FaceDetector feature of MediaPipeTasksVision. Since it is a static library, I cannot use dependency in my framework's podspec file. Setting my framework to static is not an option since I have assets in my framework. I tried to manually add MediaPipeTasksVision.xcframeworks and MediaPipeTasksCommon.xcframework to my framework but in that case when I build an app which integrates my framework I get Undefined Symbols (RenderData, NormalizedRect) build error. Also it cannot link CoreAudioTypes.
Is there any way to build a dynamic framework that could work in my environment?
I checked documentation but not sure about how to use Bazel to solve my problem. I do not want to build example project and handle provisionings profiles, I just need a version of MediaPipeVision sdk that can be integrated in my dynamic framework.
Complete Logs