flutter-plugin icon indicating copy to clipboard operation
flutter-plugin copied to clipboard

Getting Undefined Symbol Errors when archiving iOS build

Open siddhantverma95 opened this issue 4 years ago • 6 comments

Undefined symbols for architecture armv7:
  "_OBJC_CLASS_$_ASExternalEvent", referenced from:
      objc-class-ref in ASPluginEventsHandler.o
  "_AS_COMMANDS_MONITOR", referenced from:
      -[AppSpectorPlugin validateAndMapRawMonitorIds:] in AppSpectorPlugin.o
  "_AS_HTTP_MONITOR", referenced from:
      -[AppSpectorPlugin validateAndMapRawMonitorIds:] in AppSpectorPlugin.o
      -[ASPluginEventsHandler handleHTTPRequestCall:result:] in ASPluginEventsHandler.o
      -[ASPluginEventsHandler handleHTTPResponseCall:result:] in ASPluginEventsHandler.o
  "_AS_FS_MONITOR", referenced from:
      -[AppSpectorPlugin validateAndMapRawMonitorIds:] in AppSpectorPlugin.o
  "_OBJC_CLASS_$_AppSpector", referenced from:
      objc-class-ref in AppSpectorPlugin.o
      objc-class-ref in ASPluginEventsHandler.o
     (maybe you meant: _OBJC_CLASS_$_AppSpectorPlugin)
  "_AS_LOG_MONITOR", referenced from:
      -[AppSpectorPlugin validateAndMapRawMonitorIds:] in AppSpectorPlugin.o
      -[ASPluginEventsHandler handleLogEventCall:result:] in ASPluginEventsHandler.o
  "_AS_SCREENSHOT_MONITOR", referenced from:
      -[AppSpectorPlugin validateAndMapRawMonitorIds:] in AppSpectorPlugin.o
  "_AS_ENVIRONMENT_MONITOR", referenced from:
      -[AppSpectorPlugin validateAndMapRawMonitorIds:] in AppSpectorPlugin.o
  "_AS_COREDATA_MONITOR", referenced from:
      -[AppSpectorPlugin validateAndMapRawMonitorIds:] in AppSpectorPlugin.o
  "_AS_SQLITE_MONITOR", referenced from:
      -[AppSpectorPlugin validateAndMapRawMonitorIds:] in AppSpectorPlugin.o
  "_AS_NOTIFICATION_MONITOR", referenced from:
      -[AppSpectorPlugin validateAndMapRawMonitorIds:] in AppSpectorPlugin.o
  "_AS_DEFAULTS_MONITOR", referenced from:
      -[AppSpectorPlugin validateAndMapRawMonitorIds:] in AppSpectorPlugin.o
  "_AS_ANALYTICS_MONITOR", referenced from:
      -[AppSpectorPlugin validateAndMapRawMonitorIds:] in AppSpectorPlugin.o
  "_AS_PERFORMANCE_MONITOR", referenced from:
      -[AppSpectorPlugin validateAndMapRawMonitorIds:] in AppSpectorPlugin.o
  "_AS_LOCATION_MONITOR", referenced from:
      -[AppSpectorPlugin validateAndMapRawMonitorIds:] in AppSpectorPlugin.o
  "_OBJC_CLASS_$_AppSpectorConfig", referenced from:
      objc-class-ref in AppSpectorPlugin.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Podfile.lock

 - appspector (0.0.1):
    - AppSpectorSDK
    - Flutter
  - AppSpectorSDK (1.4.4)

Pubspec.lock

appspector:
    dependency: "direct main"
    description:
      name: appspector
      url: "https://pub.dartlang.org"
    source: hosted
    version: "0.7.0"

siddhantverma95 avatar Oct 11 '21 05:10 siddhantverma95

Hi @siddhantverma95 , thanks for reporting this. Can you please update plugin to the latest version (0.8.1) and check one more time?

deszip avatar Oct 11 '21 18:10 deszip

Ok, after a bit of investigation situation is following:

  • we dropped armv7 support in our SDK because we no longer support iOS versions below 11
  • for some reason when you create a new project in Xcode it adds armv7 to architectures list and tries to find appropriate slice in all binaries while archiving. And obviously fails to do that for AppSpector SDK.

Solution we can suggest you is to tell Xcode that you don't need armv7. There are a couple of ways to do that. One I would recommend to use is just set architectures to arm64 in xcode build settings:

Снимок экрана 2021-10-17 в 15 01 39

Other ways are adding armv7 to EXCLUDED_ARCHS either manually or via post install hook in your podfile:

post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS"] = "armv7"
  end
end

Hope this works for you, feel free to ping us here in case you have more questions. We'll keep working on this a bit more and update the issue if we'll find a better solution.

deszip avatar Oct 17 '21 12:10 deszip

In my case I am facing this issue. I have tried few solutions already but not working, Also few works in debug for simulators but not works for real devices and also not works for release..

Error (Xcode): Building for iOS Simulator, but linking in dylib built for iOS, file ‘/Users/adil/Development/Mob/cross-platform/ClientsWork/alp/ios/Pods/AppSpectorSDK/AppSpectorSDK.framework/AppSpectorSDK’ for architecture arm64

ch-muhammad-adil avatar Oct 26 '22 11:10 ch-muhammad-adil

Can we have sort of proper fix inside the plugin? @deszip

ch-muhammad-adil avatar Oct 26 '22 11:10 ch-muhammad-adil

I agree, this does not work for simulator!

tomas-carv-com avatar Mar 18 '23 20:03 tomas-carv-com

In my case I am facing this issue. I have tried few solutions already but not working, Also few works in debug for simulators but not works for real devices and also not works for release..

Error (Xcode): Building for iOS Simulator, but linking in dylib built for iOS, file ‘/Users/adil/Development/Mob/cross-platform/ClientsWork/alp/ios/Pods/AppSpectorSDK/AppSpectorSDK.framework/AppSpectorSDK’ for architecture arm64

Add

post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end

to Podfile work to me.

nghiashiyi avatar Aug 07 '23 16:08 nghiashiyi