alan-ai / alan-sdk-flutter

Conversational AI SDK for Flutter to enable text and voice conversations with actions (iOS and Android)
https://alan.app
1.81k stars 39 forks source link

IOS build failed #13

Closed MarsadMaqsood closed 1 year ago

MarsadMaqsood commented 2 years ago

Uncategorized (Xcode): Command CompileSwiftSources failed with a nonzero exit code

Error (Xcode): Undefined symbol: _OBJCCLASS$_AlanText

Error (Xcode): Undefined symbol: _OBJCCLASS$_AlanButton

Error (Xcode): Undefined symbol: _OBJCCLASS$_AlanConfig

Error (Xcode): Undefined symbol: _OBJCCLASS$_AlanLog

snyuryev commented 2 years ago

Hi @MarsadMaqsood Could you please provide steps to reproduce your issue. What version of plugin and iOS do you use? What command do you run? What device do you use?

MarsadMaqsood commented 2 years ago

plugin version: 3.6.0 platform :ios, '12.0' flutter version: 3.0.5

I'm using Macbook Air M1 MacOS Monterey 12.4 and trying to run on Simulator (iPhone 13 Pro)


flutter run

Launching lib/main.dart on iPhone 13 Pro in debug mode...
Running Xcode build...                                                  
Xcode build done.                                            4.4s
Failed to build iOS app
Error output from Xcode build:
↳
    Writing result bundle at path:
        /var/folders/mn/5c8dql3j5lg85cnw80xdtd0m0000gn/T/flutter_tools.LDJdFi/flutter_ios_build_temp_dirSGG9dA/temporary_
        xcresult_bundle

    Command CompileSwiftSources failed with a nonzero exit code
    Command CompileSwiftSources failed with a nonzero exit code
    ld: warning: building for iOS Simulator, but linking in dylib built for iOS, 'AlanSDK.framework'
    ld: warning: Could not find or use auto-linked framework 'AlanSDK'
    Undefined symbols for architecture arm64:
      "_OBJC_CLASS_$_AlanText", referenced from:
          objc-class-ref in AlanVoicePlugin.o
      "_OBJC_CLASS_$_AlanButton", referenced from:
          objc-class-ref in AlanVoicePlugin.o
      "_OBJC_CLASS_$_AlanConfig", referenced from:
          objc-class-ref in AlanVoicePlugin.o
      "_OBJC_CLASS_$_AlanLog", referenced from:
          objc-class-ref in AlanVoicePlugin.o
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order

    Result bundle written to path:
        /var/folders/mn/5c8dql3j5lg85cnw80xdtd0m0000gn/T/flutter_tools.LDJdFi/flutter_ios_build_temp_dirSGG9dA/temporary_
        xcresult_bundle

Uncategorized (Xcode): Command CompileSwiftSources failed with a nonzero exit code

Error (Xcode): Undefined symbol: _OBJC_CLASS_$_AlanText

Error (Xcode): Undefined symbol: _OBJC_CLASS_$_AlanButton

Error (Xcode): Undefined symbol: _OBJC_CLASS_$_AlanConfig

Error (Xcode): Undefined symbol: _OBJC_CLASS_$_AlanLog

Could not build the application for the simulator.
Error launching application on iPhone 13 Pro.
snyuryev commented 2 years ago

@MarsadMaqsood Common workaround for this flutter issue could be this:

  1. Open iOS project with Xcode
  2. Navigate to Build Settings of your project and add "Any iOS Simulator SDK" with value arm64 inside Excluded Architecture.
  3. Set “Validate Workspace" to “Yes” (Build Settings)
  4. Add this lines to pod file.
    post_install do |installer|
    installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    end
    end
  5. Run the app
kherel commented 1 year ago

alan_voice: 3.7.0 flutter version: 3.0.5 M1 chip

I'm facing this issue, when I'm running from Xcode

Screenshot 2022-10-04 at 19 25 25
ilyasarafath commented 1 year ago

Uncategorized (Xcode): Command CompileSwiftSources failed with a nonzero exit code

Error (Xcode): Undefined symbol: _OBJCCLASS$_AlanText

Error (Xcode): Undefined symbol: _OBJCCLASS$_AlanButton

Error (Xcode): Undefined symbol: _OBJCCLASS$_AlanConfig

Error (Xcode): Undefined symbol: _OBJCCLASS$_AlanLog

facing the same issue . any solution?

snyuryev commented 1 year ago

@ilyasarafath please take a look to this comment https://github.com/alan-ai/alan-sdk-flutter/issues/13#issuecomment-1196805694

Amudajr commented 1 year ago

@MarsadMaqsood Common workaround for this flutter issue could be this:

  1. Open iOS project with Xcode
  2. Navigate to Build Settings of your project and add "Any iOS Simulator SDK" with value arm64 inside Excluded Architecture.
  3. Set “Validate Workspace" to “Yes” (Build Settings)
  4. Add this lines to pod file.
post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  end
end
  1. Run the app

i did exaclty as you said here but i ran into another error

Lexical or Preprocessor Issue (Xcode): 'Flutter/Flutter.h' file not found /Users/user/.pub-cache/hosted/pub.dartlang.org/package_info-2.0.2/ios/Classes/FLTPackageInfoPlugin.h:4:8

Uncategorized (Xcode): Command SwiftEmitModule failed with a nonzero exit code

hoseyneil commented 1 year ago

I am trying to follow instructions from https://github.com/alan-ai/alan-sdk-flutter/issues/13#issuecomment-1196805694

But I can't find Validate Workspace option in my build settings. Any idea what I'm doing wrong here?

snyuryev commented 1 year ago

@hoseyneil please update to the latest SDK version https://pub.dev/packages/alan_voice/versions/3.11.0