iOS Development

ld: Undefined symbols: error for my Flutter plugin which has kotlin multi platform as dependecy when working ios instance app

Spread the love


I am writing a Flutter plugin that reveals native ios screens that use kotlin multi platform so I added it as a dependency together with it within the podspec file as a vendor_framework s.vendored_frameworks="kotlin-mpp/kotlin-mpp/construct/cocoapods/framework/kotlin_mpp.framework".
When working Xcode fails with error:

ld: warning: ignoring file '/Customers/vincenzo.calia/Paperwork/Initiatives/my_yap_native_screens_plugin/ios/kotlin-mpp/kotlin-mpp/construct/cocoapods/framework/kotlin_mpp.framework/kotlin_mpp[2](consequence.o)': discovered structure 'x86_64', required structure 'arm64'
ld: warning: Couldn't discover or use auto-linked framework 'CoreAudioTypes': framework 'CoreAudioTypes' not discovered
ld: Undefined symbols:
  _OBJC_CLASS_$_Kotlin_mppActivityModel, referenced from:
       in DocumentRowModelWrapper.o
  _OBJC_CLASS_$_Kotlin_mppApiEnumsActivityStateEnum, referenced from:
       in MMBWorkOrderRowActionsViewController.o
  _OBJC_CLASS_$_Kotlin_mppApiEnumsDepotCausalEnum, referenced from:
       in DepotSectionController.o
  _OBJC_CLASS_$_Kotlin_mppApiEnumsFuelQuantityEnum, referenced from:
       in EditWorkOrderSectionController.o
  _OBJC_CLASS_$_Kotlin_mppApiEnumsTagContextEnum, referenced from:
       in MMBAppointmentListViewController.o
  _OBJC_CLASS_$_Kotlin_mppApiEnumsTechnicalSpecModelTypeEnum, referenced from:
       in MMBFolderTechDataViewController.o
  _OBJC_CLASS_$_Kotlin_mppApiEnumsTireAxleEnum, referenced from:
       in MMBTireBaseViewController.o
  _OBJC_CLASS_$_Kotlin_mppApiEnumsTirePositionEnum, referenced from:
       in MMBTireBaseViewController.o
  _OBJC_CLASS_$_Kotlin_mppApiEnumsTireTypeEnum, referenced from:
       in TireAxleModelWrapper.o
  _OBJC_CLASS_$_Kotlin_mppApiEnumsTireWheelRimEnum, referenced from:
       in TireSectionController.o
  _OBJC_CLASS_$_Kotlin_mppApiModelManager, referenced from:
       in MMBFolderTechDataViewController.o
  _OBJC_CLASS_$_Kotlin_mppApiService, referenced from:
       in AppDelegate.o
  _OBJC_CLASS_$_Kotlin_mppAppSettings, referenced from:
       in AppDelegate.o
  _OBJC_CLASS_$_Kotlin_mppAppleSettings, referenced from:
       in AppDelegate.o
  _OBJC_CLASS_$_Kotlin_mppAppointmentInvoicing, referenced from:
       in MMBAppointmentListViewController.o
  _OBJC_CLASS_$_Kotlin_mppAppointmentModel, referenced from:
       in AppointmentModelWrapper.o
  _OBJC_CLASS_$_Kotlin_mppAppointmentPresenter, referenced from:
       in MMBAppointmentDetailViewController.o
  _OBJC_CLASS_$_Kotlin_mppAppointmentPresenterAppointmentRequestViewState, referenced from:
       in MMBAppointmentDetailViewController.o
  _OBJC_CLASS_$_Kotlin_mppAppointmentToUpdateModel, referenced from:
       in MMBAppointmentDetailViewController.o
  _OBJC_CLASS_$_Kotlin_mppAppointmentsPresenter, referenced from:
       in MMBAppointmentListViewController.o
  _OBJC_CLASS_$_Kotlin_mppAppointmentsPresenterAppointmentsRequestViewState, referenced from:
       in MMBAppointmentListViewController.o
  _OBJC_CLASS_$_Kotlin_mppBasePresenter, referenced from:
       in MMBBaseViewController.o
  _OBJC_CLASS_$_Kotlin_mppBasePresenterBaseRequestViewState, referenced from:
       in EditWorkOrderViewController.o
  _OBJC_CLASS_$_Kotlin_mppBoolean, referenced from:
       in AppointmentSectionController.o
  _OBJC_CLASS_$_Kotlin_mppChangePasswordModel, referenced from:
       in MMBChangePasswordViewController.o
  _OBJC_CLASS_$_Kotlin_mppCheckInNoteCheckModel, referenced from:
       in EditWorkOrderSectionController.o
  _OBJC_CLASS_$_Kotlin_mppCheckInNoteCheckModelCheckResult, referenced from:
       in EditWorkOrderSectionController.o
  _OBJC_CLASS_$_Kotlin_mppCheckInNoteConfigsModel, referenced from:
       in EditWorkOrderViewController.o
  _OBJC_CLASS_$_Kotlin_mppCheckResultConfigModel, referenced from:
       in EditWorkOrderSectionController.o
  _OBJC_CLASS_$_Kotlin_mppCheckResultConfigModelResult, referenced from:
       in EditWorkOrderSectionController.o
  _OBJC_CLASS_$_Kotlin_mppCompanyModel, referenced from:
       in CompanyModelWrapper.o
  _OBJC_CLASS_$_Kotlin_mppContactMethodModel, referenced from:
       in MMBFolderDataViewController.o
  _OBJC_CLASS_$_Kotlin_mppContextCalendarConfigModel, referenced from:
       in MMBPlanningAppointmentViewController.o
  _OBJC_CLASS_$_Kotlin_mppCrashIntegrationKt, referenced from:
       in AppDelegate.o
  _OBJC_CLASS_$_Kotlin_mppCrashkiosCrashHandler, referenced from:
      full kind metadata for my_yap_native_screens_plugin.CrashlyticsCrashHandler in CrashHandler.o
  _OBJC_CLASS_$_Kotlin_mppDbUtil, referenced from:
       in AppDelegate.o
  _OBJC_CLASS_$_Kotlin_mppDefaultBillDocumentModel, referenced from:
       in MMBFolderDataViewController.o
  _OBJC_CLASS_$_Kotlin_mppDeletedAppointmentModel, referenced from:
       in MMBAppointmentDetailViewController.o
  _OBJC_CLASS_$_Kotlin_mppDepotDocumentModel, referenced from:
       in DepotDocumentModelWrapper.o
  _OBJC_CLASS_$_Kotlin_mppDepotPresenter, referenced from:
       in MMBDepotTireViewController.o
  _OBJC_CLASS_$_Kotlin_mppDepotPresenterDepotRequestViewState, referenced from:
       in MMBDepotTireViewController.o
  _OBJC_CLASS_$_Kotlin_mppDocumentNumberSuffixesModel, referenced from:
       in EditWorkOrderViewController.o
  _OBJC_CLASS_$_Kotlin_mppDocumentNumberSuffixesPresenter, referenced from:
       in EditWorkOrderViewController.o
  _OBJC_CLASS_$_Kotlin_mppDocumentNumberSuffixesPresenterDocumentNumberSuffixesRequestViewState, referenced from:
       in EditWorkOrderViewController.o
  _OBJC_CLASS_$_Kotlin_mppDocumentRowModel, referenced from:
       in DocumentRowModelWrapper.o
  _OBJC_CLASS_$_Kotlin_mppDouble, referenced from:
       in KmmUtil.o
  _OBJC_CLASS_$_Kotlin_mppErrorManager, referenced from:
       in MMBChangePasswordViewController.o
  _OBJC_CLASS_$_Kotlin_mppErrorMessageErrorType, referenced from:
       in ApiPresenterUtil.o
  _OBJC_CLASS_$_Kotlin_mppFolderImagesToDeleteModel, referenced from:
       in MMBPhotoBrowserViewController.o
  _OBJC_CLASS_$_Kotlin_mppFolderModel, referenced from:
       in MMBAppointmentDetailViewController.o
  _OBJC_CLASS_$_Kotlin_mppFolderPresenter, referenced from:
       in MMBAppointmentDetailViewController.o
  _OBJC_CLASS_$_Kotlin_mppFolderPresenterFolderRequestViewState, referenced from:
       in MMBAppointmentDetailViewController.o
  _OBJC_CLASS_$_Kotlin_mppFormPdfMetadataModel, referenced from:
       in MMBSignPdfPreviewController.o
  _OBJC_CLASS_$_Kotlin_mppGarbageCollector, referenced from:
       in AppDelegate.o
  _OBJC_CLASS_$_Kotlin_mppImageModel, referenced from:
       in CheckInNoteCheckModelWrapper.o
  _OBJC_CLASS_$_Kotlin_mppImageToCreateModel, referenced from:
       in EditWorkOrderViewController.o
  _OBJC_CLASS_$_Kotlin_mppImagesPresenter, referenced from:
       in EditWorkOrderViewController.o
  _OBJC_CLASS_$_Kotlin_mppImagesPresenterImagesRequestViewState, referenced from:
       in EditWorkOrderViewController.o
  _OBJC_CLASS_$_Kotlin_mppInt, referenced from:
       in ApiPresenterUtil.o
  _OBJC_CLASS_$_Kotlin_mppJsonUtil, referenced from:
       in ViewControllerGetter.o
  _OBJC_CLASS_$_Kotlin_mppLibraryVersion, referenced from:
       in AppDelegate.o
  _OBJC_CLASS_$_Kotlin_mppLocationModel, referenced from:
       in MMBDepotViewController.o
  _OBJC_CLASS_$_Kotlin_mppLoginActionsModel, referenced from:
       in MMBLoginTwoFactorViewController.o
  _OBJC_CLASS_$_Kotlin_mppLoginActionsPresenter, referenced from:
       in MMBChangePasswordViewController.o
  _OBJC_CLASS_$_Kotlin_mppLoginActionsPresenterLoginActionsViewState, referenced from:
       in MMBChangePasswordViewController.o
  _OBJC_CLASS_$_Kotlin_mppLoginRequestModel, referenced from:
       in MMBBaseLoginViewController.o
  _OBJC_CLASS_$_Kotlin_mppLoginRequestPresenter, referenced from:
       in MMBBaseLoginViewController.o
  _OBJC_CLASS_$_Kotlin_mppLoginRequestPresenterLoginRequestViewState, referenced from:
       in MMBBaseLoginViewController.o
  _OBJC_CLASS_$_Kotlin_mppLoginTokenPresenter, referenced from:
       in MMBBaseLoginViewController.o
  _OBJC_CLASS_$_Kotlin_mppLoginTokenPresenterLoginTokenViewState, referenced from:
       in MMBLoginViewController.o
  _OBJC_CLASS_$_Kotlin_mppLoginTokenRequestModel, referenced from:
       in MMBLoginViewController.o
  _OBJC_CLASS_$_Kotlin_mppLong, referenced from:
       in AppointmentModelWrapper.o
  _OBJC_CLASS_$_Kotlin_mppMetadataModel, referenced from:
       in MMBSignPdfPreviewController.o
  _OBJC_CLASS_$_Kotlin_mppMobileDb, referenced from:
       in AppDelegate.o
  _OBJC_CLASS_$_Kotlin_mppMotModel, referenced from:
       in MMBMotSectionViewController.o
  _OBJC_CLASS_$_Kotlin_mppMotModelMotResult, referenced from:
       in MotModelWrapper.o
  _OBJC_CLASS_$_Kotlin_mppMotModelMotState, referenced from:
       in MotModelWrapper.o
  _OBJC_CLASS_$_Kotlin_mppMotsPresenter, referenced from:
       in MMBFolderActionsViewController.o
  _OBJC_CLASS_$_Kotlin_mppMotsPresenterMotsRequestViewState, referenced from:
       in MMBFolderActionsViewController.o
  _OBJC_CLASS_$_Kotlin_mppNewAppointmentModel, referenced from:
       in MMBAppointmentListViewController.o
  _OBJC_CLASS_$_Kotlin_mppNewFolderModel, referenced from:
       in MMBBaseViewController.o
  _OBJC_CLASS_$_Kotlin_mppNewFolderModelVehicleCategory, referenced from:
       in MMBBaseViewController.o
  _OBJC_CLASS_$_Kotlin_mppNewRemoteAppointmentModel, referenced from:
       in MMBRemoteAppointmentSummaryViewController.o
  _OBJC_CLASS_$_Kotlin_mppPaperlessDocumentModel, referenced from:
       in MMBSignPdfPreviewController.o
  _OBJC_CLASS_$_Kotlin_mppPaperlessDocumentState, referenced from:
       in MMBSignPdfPreviewController.o
  _OBJC_CLASS_$_Kotlin_mppPaperlessDocumentToCreateModel, referenced from:
       in MMBSignSectionViewController.o
  _OBJC_CLASS_$_Kotlin_mppPaperlessPresenter, referenced from:
       in MMBSignPdfPreviewController.o
  _OBJC_CLASS_$_Kotlin_mppPaperlessPresenterPaperlessRequestViewState, referenced from:
       in MMBSignPdfPreviewController.o
  _OBJC_CLASS_$_Kotlin_mppPaymentMethodModel, referenced from:
       in MMBFolderDataViewController.o
  _OBJC_CLASS_$_Kotlin_mppPlanningDayModel, referenced from:
       in ApiPlanningManager.o
  _OBJC_CLASS_$_Kotlin_mppPlanningPresenter, referenced from:
       in MMBPadPlanningViewController.o
  _OBJC_CLASS_$_Kotlin_mppPlanningPresenterPlanningRequestViewState, referenced from:
       in ApiPlanningManager.o
  _OBJC_CLASS_$_Kotlin_mppPlanningSlotModel, referenced from:
       in MMBPadPlanningViewController.o
  _OBJC_CLASS_$_Kotlin_mppPreMotCheckModel, referenced from:
       in MMBMotSectionViewController.o
  _OBJC_CLASS_$_Kotlin_mppPrepareAppointmentModel, referenced from:
       in MMBPlanningViewController.o
  _OBJC_CLASS_$_Kotlin_mppPrintTemplateModel, referenced from:
       in MMBSignPdfPreviewController.o
  _OBJC_CLASS_$_Kotlin_mppRecognitionImageRequestModelShape, referenced from:
       in MMBBaseViewControllerNotificationEx.o
  _OBJC_CLASS_$_Kotlin_mppRecognitionImageRequestModelVehicleCategory, referenced from:
       in MMBBaseViewControllerNotificationEx.o
  _OBJC_CLASS_$_Kotlin_mppRecordModel, referenced from:
       in MMBSelectionRecordViewController.o
  _OBJC_CLASS_$_Kotlin_mppRecordsPresenter, referenced from:
       in MMBSelectionRecordViewController.o
  _OBJC_CLASS_$_Kotlin_mppRecordsPresenterRecordsRequestViewState, referenced from:
       in MMBSelectionRecordViewController.o
  _OBJC_CLASS_$_Kotlin_mppRegexManager, referenced from:
       in MMBFolderDataViewController.o
  _OBJC_CLASS_$_Kotlin_mppRemoteCompanyAppointmentModel, referenced from:
       in MMBRemoteAppointmentListViewController.o
  _OBJC_CLASS_$_Kotlin_mppReportType, referenced from:
       in MMBSignSectionViewController.o
  _OBJC_CLASS_$_Kotlin_mppReturnTimeClocksModel, referenced from:
       in MMBWorkOrderSectionViewController.o
  _OBJC_CLASS_$_Kotlin_mppSampleKt, referenced from:
       in AppDelegate.o
  _OBJC_CLASS_$_Kotlin_mppSendAtLineModel, referenced from:
       in MMBFolderActionsViewController.o
  _OBJC_CLASS_$_Kotlin_mppSettingsManager, referenced from:
       in MMBBaseViewControllerPhotoEx.o
  _OBJC_CLASS_$_Kotlin_mppSoftwareTiers, referenced from:
       in MMBBaseViewController.o
  _OBJC_CLASS_$_Kotlin_mppStringNormalizer, referenced from:
       in MMBBaseViewController.o
  _OBJC_CLASS_$_Kotlin_mppSubscriberModel, referenced from:
       in MMBSignPdfPreviewController.o
  _OBJC_CLASS_$_Kotlin_mppTagModel, referenced from:
       in AppointmentModelWrapper.o
  _OBJC_CLASS_$_Kotlin_mppTagsPresenter, referenced from:
       in MMBAppointmentListViewController.o
  _OBJC_CLASS_$_Kotlin_mppTagsPresenterTagsRequestViewState, referenced from:
       in MMBAppointmentListViewController.o
  _OBJC_CLASS_$_Kotlin_mppTechnicalSpecModel, referenced from:
       in FolderModelWrapper.o
  _OBJC_CLASS_$_Kotlin_mppTimeClockPresenter, referenced from:
       in MMBWorkOrderSectionViewController.o
  _OBJC_CLASS_$_Kotlin_mppTimeClockPresenterTimeClockRequestViewState, referenced from:
       in MMBWorkOrderSectionViewController.o
  _OBJC_CLASS_$_Kotlin_mppTireModel, referenced from:
       in DepotDocumentModelWrapper.o
  _OBJC_CLASS_$_Kotlin_mppUpdatedWorkOrderField, referenced from:
       in EditWorkOrderViewController.o
  _OBJC_CLASS_$_Kotlin_mppUserModel, referenced from:
       in UserModelWrapper.o
  _OBJC_CLASS_$_Kotlin_mppUserModelPresenter, referenced from:
       in MMBHomeViewController.o
  _OBJC_CLASS_$_Kotlin_mppUserModelPresenterUserModelRequestViewState, referenced from:
       in MMBHomeViewController.o
  _OBJC_CLASS_$_Kotlin_mppWorkOrderModel, referenced from:
       in EditWorkOrderViewController.o
  _OBJC_CLASS_$_Kotlin_mppWorkOrderPresenter, referenced from:
       in EditWorkOrderViewController.o
  _OBJC_CLASS_$_Kotlin_mppWorkOrderPresenterWorkOrderRequestViewState, referenced from:
       in EditWorkOrderViewController.o
  _OBJC_CLASS_$_Kotlin_mppWorkOrdersPresenter, referenced from:
       in MMBWorkOrderSectionViewController.o
  _OBJC_CLASS_$_Kotlin_mppWorkOrdersPresenterWorkOrdersRequestViewState, referenced from:
       in MMBWorkOrderSectionViewController.o
  _OBJC_CLASS_$_Kotlin_mppYapContext, referenced from:
       in MMBPadPlanningViewController.o
  _OBJC_CLASS_$_Kotlin_mppYapOverYapPresenter, referenced from:
       in MMBAppointmentListViewController.o
  _OBJC_CLASS_$_Kotlin_mppYapOverYapPresenterYapOverYapRequestViewState, referenced from:
       in MMBAppointmentListViewController.o
  _OBJC_CLASS_$_Kotlin_mppYapPermissionManager, referenced from:
       in AppointmentSectionController.o
  _OBJC_CLASS_$_Kotlin_mppYapPlanningAppointmentManager, referenced from:
       in PlanningAppintmentWhatView.o
  _OBJC_METACLASS_$_Kotlin_mppCrashkiosCrashHandler, referenced from:
      _OBJC_METACLASS_$__TtC28my_yap_native_screens_plugin23CrashlyticsCrashHandler in CrashHandler.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Including the -lObjC flag to s.pod_target_xcconfig podspec settings as per docs https://guides.cocoapods.org/syntax/podspec.html#pod_target_xcconfig did not remedy it. Checking the Different Linker Flags in Xcode I see -ObjC flag current by default, however the -lObjC added from the podspec will not be current within the record, dough I do see all the opposite flags from the podspec dependecies.

I used to be additionally getting flag errors for _sqlite3 and looking out in SO and Github I noticed numerous posts suggesting to manually add the -lsqlite3 flag to the record in Xcode which solved it, even after I eliminated it and tried so as to add it by way of podspec file I do not get these errors anymore..solely the ObjC ones..

Any assist with this situation can be nice.
Many thanks
Cheers

that is the podfile:

#
# To be taught extra a couple of Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint my_native_screens_plugin.podspec` to validate earlier than publishing.
#
Pod::Spec.new do |s|
  s.identify="my_native_screens_plugin"
  s.model          = '0.0.1'
  s.abstract          = 'A brand new Flutter plugin mission.'
  s.description      = <<-DESC
A brand new Flutter plugin mission.
                       DESC
  s.homepage="http://instance.com"
  s.license          = { :file => '../LICENSE' }
  s.creator           = { 'Your Firm' => '[email protected]' }
  s.supply           = { :path => '.' }
  s.source_files="Lessons/**/*"

  #objc solely
  # s.public_header_files="Lessons/**/*.h"

  s.dependency 'Flutter'
  s.dependency 'MaterialComponents/Snackbar', '122.0.1'
  s.dependency 'MaterialComponents/TextFields', '122.0.1'
  s.dependency 'MaterialComponents/TextFields+Theming', '122.0.1'
  s.dependency 'MaterialComponents/Playing cards', '122.0.1'
  s.dependency 'MaterialComponents/BottomNavigation', '122.0.1'
  s.dependency 'MaterialComponents/Chips', '122.0.1'
  s.dependency 'MaterialComponents/Chips+Theming', '122.0.1'
  s.dependency 'MaterialComponents/Tabs+TabBarView', '122.0.1'
  s.dependency 'MaterialComponents/Buttons', '122.0.1'
  s.dependency 'MBProgressHUD', '1.2.0'
  s.dependency 'Firebase/CoreOnly', '10.9.0' 
  s.dependency 'Firebase/Analytics', '10.9.0' 
  s.dependency 'Firebase/Auth', '10.9.0'
  s.dependency 'Firebase/Crashlytics', '10.9.0'
  s.dependency 'IQKeyboardManagerSwift', '6.5.10'
  s.dependency 'IGListKit', '4.0.0'
  s.dependency 'SwiftRichString', '3.7.2'
  s.dependency 'JTAppleCalendar', '8.0.5'
  s.dependency 'SDWebImage', '5.13.1'
  s.dependency 'YPImagePicker', '5.2.2'
  s.dependency 'PanModal', '1.2.7'
  s.dependency 'lottie-ios', '3.4.0'
  # s.dependency 'TouchDraw', '2.1.2'

  s.ios.vendored_frameworks="kotlin-mpp/kotlin-mpp/construct/cocoapods/framework/kotlin_mpp.framework"
  s.platform = :ios, '15.0'

  # s.static_framework = true
  # Flutter.framework doesn't include a i386 slice.
  s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
  s.swift_version = '5.0'

  s.pod_target_xcconfig = { 'OTHER_LDFLAGS' => '-lsqlite3' }
finish

Leave a Reply

Your email address will not be published. Required fields are marked *