xamarin / GoogleApisForiOSComponents

MIT License
225 stars 156 forks source link

Maui iOS publish failed with C++ static lib #587

Open shun9292 opened 1 year ago

shun9292 commented 1 year ago

Hello,

I'm using OpenCV 4.6, working fine in debug mode and tested as well. When running "dotnet publish" to build in release mode, it stops with the following error.

dotnet publish -f:net7.0-ios -c:Release /p:ServerAddress=172.30.1.22 /p:ServerUser=user /p:ServerPassword=1234 /p:TcpPort=58181 /p:ArchiveOnBuild=true /p:_DotNetRootRemoteDirectory=/Users/user/Library/Caches/Xamarin/XMA/SDKs/dotnet/ /p:EnableAssemblyILStripping=false

Visual Studio 2022 17.4.1 Xcode 14.1 macOS Monterey

ERROR: "Undefined symbols for architecture arm64:" is the starting point of the clang linker error.

 "$(xcrun -find bitcode_strip)" C:/Users/user/AppData/Local/XamarinBuildDownloadCache/GAppM-8.9.1/GoogleAppMeasurement-8.9.1/Frameworks/GoogleAppMeasurement.xcframework/ios-arm64_armv7/GoogleAppMeasurement.framewo
  rk/GoogleAppMeasurement -r -o C:/Users/user/AppData/Local/XamarinBuildDownloadCache/GAppM-8.9.1/GoogleAppMeasurement-8.9.1/Frameworks/GoogleAppMeasurement.xcframework/ios-arm64_armv7/GoogleAppMeasurement.framewor
  k/GoogleAppMeasurement
  "$(xcrun -find bitcode_strip)" C:/Users/user/AppData/Local/XamarinBuildDownloadCache/FAdM-8.13.0/Frameworks/GoogleMobileAdsFramework-Current/GoogleMobileAds.xcframework/ios-arm64_armv7/GoogleMobileAds.framework/G
  oogleMobileAds -r -o C:/Users/user/AppData/Local/XamarinBuildDownloadCache/FAdM-8.13.0/Frameworks/GoogleMobileAdsFramework-Current/GoogleMobileAds.xcframework/ios-arm64_armv7/GoogleMobileAds.framework/GoogleMobil
  eAds
  Tool xcrun execution finished (exit code = 1).

  Undefined symbols for architecture arm64:
    "_main", referenced from:
       implicit entry/start for main executable
       (maybe you meant: _mono_runtime_get_main_args_handle, _mono_runtime_run_main , _OBJC_IVAR_$_GADVideoAssetLoader._mainResourceBuffer , _mono_thread_set_main , _mono_native_thread_id_main_thread_known , _OBJC_IVAR_$_GA
  DSafeBrowsingReport._mainDocumentURL , _OBJC_IVAR_$_GADDevice._mainScreenDensity , _xamarin_extension_main , _OBJC_IVAR_$_GADInlineSingleNativeAdRenderer._mainThreadMediaContent , _OBJC_IVAR_$_GADAdMediaContent._mainImage
  View , _mono_runtime_try_exec_main , _mono_runtime_exec_main , _mono_main , _mono_runtime_try_run_main , _OBJC_IVAR_$_GADMediatedMediaContent._mainImage , _OBJC_IVAR_$_GADHTMLMediaContent._mainImage , _OBJC_IVAR_$_GADAppl
  ication._mainBundleIdentifier , _OBJC_IVAR_$_GADMainThreadAdMediaContent._mainImage , _mono_runtime_set_main_args , _xamarin_release_block_on_main_thread , _mono_runtime_run_main_checked , _OBJC_IVAR_$_GADAdMediaContent._
  mainImage , _mono_runtime_get_main_args , _mono_threads_platform_is_main_thread , _xamarin_main , _mono_assembly_set_main , _OBJC_IVAR_$_GADActiveViewReporter._mainThreadParameters , _mono_assembly_get_main , _OBJC_IVAR_$
  _GADImageMediaContent._mainImage , _OBJC_IVAR_$_GADSignals._mainQueueSignalUpdateBlocks , _OBJC_IVAR_$_GADMediaContent._mainImage , _mono_thread_get_main , _OBJC_IVAR_$_GADMediatedMediaContent._mainImageView , _OBJC_IVAR_
  $_GADOMIDAdSession._mainAdView , _mono_runtime_exec_main_checked , _OBJC_IVAR_$_GADMediatedMediaContent._mainImageAspectRatio )
  ld: symbol(s) not found for architecture arm64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)

C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.0.1478\targets\Xamarin.Shared.Sdk.targets(1230,3): error : clang++ exited with code 1: [C:\....csproj::TargetFramework=net7.0-ios]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.0.1478\targets\Xamarin.Shared.Sdk.targets(1230,3): error : Undefined symbols for architecture arm64: [C:\....csproj::TargetFramework=net7.0-ios]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.0.1478\targets\Xamarin.Shared.Sdk.targets(1230,3): error :   "_main", referenced from: [C:\....csproj::TargetFramework=net7.0-ios]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.0.1478\targets\Xamarin.Shared.Sdk.targets(1230,3): error :      implicit entry/start for main executable [C:\....csproj::TargetFramework=net7.0-ios]
C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\16.0.1478\targets\Xamarin.Shared.Sdk.targets(1230,3): error :      (maybe you meant: _mono_runtime_get_main_args_handle, _mono_runtime_run_main , _OBJC_IVAR_$_GADVideoAssetLoa
der._mainResourceBuffer , _mono_thread_set_main , _mono_native_thread_id_main_thread_known , _OBJC_IVAR_$_GADSafeBrowsingReport._mainDocumentURL , _OBJC_IVAR_$_GADDevice._mainScreenDensity , _xamarin_extension_main , _OBJC_
IVAR_$_GADInlineSingleNativeAdRenderer._mainThreadMediaContent , _OBJC_IVAR_$_GADAdMediaContent._mainImageView , _mono_runtime_try_exec_main , _mono_runtime_exec_main , _mono_main , _mono_runtime_try_run_main , _OBJC_IVAR_$
_GADMediatedMediaContent._mainImage , _OBJC_IVAR_$_GADHTMLMediaContent._mainImage , _OBJC_IVAR_$_GADApplication._mainBundleIdentifier , _OBJC_IVAR_$_GADMainThreadAdMediaContent._mainImage , _mono_runtime_set_main_args , _xa
marin_release_block_on_main_thread , _mono_runtime_run_main_checked , _OBJC_IVAR_$_GADAdMediaContent._mainImage , _mono_runtim [C:\....csproj::TargetFramework=net7.0-ios]