xamarin MAUI iOS构建失败,因为链接器缺少libmono-component-hot_reload-static.a文件

2cmtqfgy  于 6个月前  发布在  iOS
关注(0)|答案(1)|浏览(74)

我将我的项目更新为.NET 8,将Mac更新为MacOS 14和XCode 15。当我构建MAUI iOS项目时,它失败并显示以下构建日志:

15:01:05:572    1>    Target _LinkNativeExecutable:
15:01:05:572    1>      Task "WriteLinesToFile"
15:01:05:634    1>      Done executing task "WriteLinesToFile".
15:01:05:634    1>      Task "LinkNativeCode"
15:01:08:377    1>        Tool xcrun execution finished (exit code = 1).
15:01:08:377    1>        ld: file too small (length=0) file '/Users/lukevo/Library/Caches/Xamarin/mtbs/builds/QrCodeGenerator/e8f6ae8766723632f111f0b174d6655fba863f7868f747ef284c64d3142ef3f3/C:/Program Files/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.ios-arm64/8.0.0/runtimes/ios-arm64/native/libmono-component-hot_reload-stub-static.a'
15:01:08:377    1>        clang: error: linker command failed with exit code 1 (use -v to see invocation)
15:01:08:377    1>        C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\17.0.8478\targets\Xamarin.Shared.Sdk.targets(1556,3): error : clang++ exited with code 1:
15:01:08:377    1>        C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\17.0.8478\targets\Xamarin.Shared.Sdk.targets(1556,3): error : ld: file too small (length=0) file '/Users/lukevo/Library/Caches/Xamarin/mtbs/builds/QrCodeGenerator/e8f6ae8766723632f111f0b174d6655fba863f7868f747ef284c64d3142ef3f3/C:/Program Files/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.ios-arm64/8.0.0/runtimes/ios-arm64/native/libmono-component-hot_reload-stub-static.a'
15:01:08:377    1>        C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\17.0.8478\targets\Xamarin.Shared.Sdk.targets(1556,3): error : clang: error: linker command failed with exit code 1 (use -v to see invocation)
15:01:08:451    1>      Done executing task "LinkNativeCode" -- FAILED.
15:01:08:451    1>    Done building target "_LinkNativeExecutable" in project "QrCodeGenerator.csproj" -- FAILED.
15:01:08:451    1>
15:01:08:451    1>    Done building project "QrCodeGenerator.csproj" -- FAILED.
15:01:08:455    1>  Done executing task "MSBuild" -- FAILED.
15:01:08:455    1>
15:01:08:455    1>Done building project "QrCodeGenerator.csproj" -- FAILED.
15:01:08:455    1>
15:01:08:455    1>Build FAILED.
15:01:08:455    1>
15:01:08:455    1>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\17.0.8478\tools\msbuild\iOS\Xamarin.Shared.targets(1174,3): warning : The given path's format is not supported.
15:01:08:455    1>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\17.0.8478\targets\Xamarin.Shared.Sdk.targets(743,3): warning MT7091: The framework C:/Users/lukev/.nuget/packages/xamarin.firebase.ios.core/8.10.0.3/lib/net6.0-ios15.4/Firebase.Core.resources/GoogleUtilitiesComponents.xcframework/ios-arm64/GoogleUtilitiesComponents.framework is a framework of static libraries, and will not be copied to the app.
15:01:08:455    1>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\17.0.8478\targets\Xamarin.Shared.Sdk.targets(743,3): warning MT7091: The framework C:/Users/lukev/AppData/Local/XamarinBuildDownloadCache/FAdM-8.13.0/Frameworks/GoogleMobileAdsFramework-Current/GoogleMobileAds.xcframework/ios-arm64_armv7/GoogleMobileAds.framework is a framework of static libraries, and will not be copied to the app.
15:01:08:455    1>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\17.0.8478\targets\Xamarin.Shared.Sdk.targets(743,3): warning MT7091: The framework C:/Users/lukev/AppData/Local/XamarinBuildDownloadCache/GAppM-8.9.1/GoogleAppMeasurement-8.9.1/Frameworks/GoogleAppMeasurement.xcframework/ios-arm64_armv7/GoogleAppMeasurement.framework is a framework of static libraries, and will not be copied to the app.
15:01:08:455    1>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\17.0.8478\targets\Xamarin.Shared.Sdk.targets(1556,3): error : clang++ exited with code 1:
15:01:08:455    1>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\17.0.8478\targets\Xamarin.Shared.Sdk.targets(1556,3): error : ld: file too small (length=0) file '/Users/lukevo/Library/Caches/Xamarin/mtbs/builds/QrCodeGenerator/e8f6ae8766723632f111f0b174d6655fba863f7868f747ef284c64d3142ef3f3/C:/Program Files/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.ios-arm64/8.0.0/runtimes/ios-arm64/native/libmono-component-hot_reload-stub-static.a'
15:01:08:455    1>C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\17.0.8478\targets\Xamarin.Shared.Sdk.targets(1556,3): error : clang: error: linker command failed with exit code 1 (use -v to see invocation)

字符串
我检查了我的Windows笔记本电脑上的文件夹,C:/Program Files/dotnet/packs/Microsoft.NETCore.App.Runtime.Mono.ios-arm64/8.0.0/runtimes/ios-arm64/native/libmono-component-hot_reload-stub-static.a存在(约45KB),但在Mac上,我根本看不到/Users/lukevo/Library/Caches/Xamarin文件夹。
我也试图禁用热插件,因为我不使用它,但问题仍然发生。我也运行dotnet nuget locals all --clear之前,试图再次构建,但问题仍然发生。
这也发生在新创建的带有捆绑签名设置的MAUI Blazor Hybrid上(如果没有签名,则没有错误)。
请告诉我如何修复它或建议下一步诊断问题。

6ljaweal

6ljaweal1#

如果您的日志文件在任何Mac代理的“安装”,“安装”或“启动”步骤中显示问题,您可以尝试删除XMA缓存文件夹以强制Visual Studio重新上传它们。
如 * 在Mac上清除Broker、IDB、Build和Designer代理 * 中所述,您可以尝试删除Mac和Windows的XMA文件夹。(此文档是关于Xamarin的,它也适用于MAUI)。
对于Macos,XMA文件夹放置在"$HOME/Library/Caches/Xamarin/XMA"中。
对于Windows,XMA文件夹放在%localappdata%\Temp\Xamarin\XMA中。
删除这两个文件夹。下次启动时,Visual Studio将检测并重新上传它们。删除文件夹后,重新启动Visual Studio和Visual Studio for Mac。
有关使用pair to mac时故障排除的更多信息,您也可以参考Connection Troubleshooting for a Xamarin.iOS Build Host

相关问题