flutter desktop build fails with `com.apple.xcode.tools.swift.compiler`

蓝咒 提交于 2021-02-11 12:22:59

问题


I try to build and run flutter for desktop and I get the bellow error when I use ~/dev/flutter/bin/flutter run -v

Objects-normal/x86_64/GeneratedPluginRegistrant~partial.swiftmodule -emit-dependencies-path
/Users/myuser/tmp/flutter-desktop-embedding/example/build/macos/Build/Intermediates.noindex/Runner.build/Debug/Runner.build/
Objects-normal/x86_64/GeneratedPluginRegistrant.d -emit-reference-dependencies-path
/Users/myuser/tmp/flutter-desktop-embedding/example/build/macos/Build/Intermediates.noindex/Runner.build/Debug/Runner.build/
Objects-normal/x86_64/GeneratedPluginRegistrant.swiftdeps -o
/Users/myuser/tmp/flutter-desktop-embedding/example/build/macos/Build/Intermediates.noindex/Runner.build/Debug/Runner.build/
Objects-normal/x86_64/GeneratedPluginRegistrant.o
[  +27 ms] ** BUILD FAILED **
[   +3 ms] The following build commands failed:
[        ]      CompileSwift normal x86_64 /Users/myuser/tmp/flutter-desktop-embedding/example/macos/ExampleWindow.swift
[        ]      CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
[        ] (2 failures)
[  +16 ms] Building macOS application... (completed in 10.1s)
[  +10 ms] "flutter run" took 11,052ms.
Build process failed

#0      throwToolExit (package:flutter_tools/src/base/common.dart:28:3)
#1      buildMacOS (package:flutter_tools/src/macos/build_macos.dart:85:5)
<asynchronous suspension>
#2      MacOSDevice.startApp (package:flutter_tools/src/macos/macos_device.dart:86:13)
<asynchronous suspension>
#3      FlutterDevice.runHot (package:flutter_tools/src/resident_runner.dart:378:54)
<asynchronous suspension>
#4      HotRunner.run (package:flutter_tools/src/run_hot.dart:254:39)
<asynchronous suspension>
#5      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:472:37)
<asynchronous suspension>
#6      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:490:18)
#7      _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#8      _rootRunUnary (dart:async/zone.dart:1132:38)
#9      _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#10     _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#11     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#12     Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#13     Future._completeWithValue (dart:async/future_impl.dart:522:5)
#14     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:30:15)
#15     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:288:13)
#16     RunCommand.usageValues (package:flutter_tools/src/commands/run.dart)
#17     _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:71:64)
#18     _rootRunUnary (dart:async/zone.dart:1132:38)
#19     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
#20     _FutureListener.handleValue (dart:async/future_impl.dart:137:18)
#21     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:678:45)
#22     Future._propagateToListeners (dart:async/future_impl.dart:707:32)
#23     Future._completeWithValue (dart:async/future_impl.dart:522:5)
#24     Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:552:7)
#25     _rootRun (dart:async/zone.dart:1124:13)
#26     _CustomZone.run (dart:async/zone.dart:1021:19)
#27     _CustomZone.runGuarded (dart:async/zone.dart:923:7)
#28     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:963:23)
#29     _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#30     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#31     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:116:13)
#32     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:173:5)

This is how i setup the desktop:

~/dev/flutter/bin/flutter channel master
~/dev/flutter/bin/flutter upgrade
~/dev/flutter/bin/flutter doctor
export ENABLE_FLUTTER_DESKTOP=true
~/dev/flutter/bin/flutter devices
~/dev/flutter/bin/flutter packages get
~/dev/flutter/bin/flutter precache --macos

The example i'm trying to run:

https://github.com/google/flutter-desktop-embedding.git

来源:https://stackoverflow.com/questions/57547971/flutter-desktop-build-fails-with-com-apple-xcode-tools-swift-compiler

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!