转载博客:http://www.kuazhi.com/post/426444.html
以下为遇到的问题
一,找不到c++头文件 <function>,<memory>
找到xcode_toolchain.py路径engine/src/build/config/mac/xcode_toolchain.py
修改path = os.path.join(path,处为path = os.path.join(path, "Platforms", "iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk")因为升级后之前的找不到c++/v1
二,执行./gn --xcode-symlinks --no-lto --no-dart-version-git-info --goma --unoptimized --runtime-mode=debug --no-prebuilt-dart-sdk --ios --simulator-cpu=arm64
执行ninja -C ios_debug_sim_unopt_arm64
这些可以参考以上博客
三,报错了,直接打开out/ios_debug_sim_unopt_arm64的xcode工程
四,在工程里搜索-stdlib=libc++为-nostdinc++,替换文件engine/src/build/config/compiler,engine/src/build/config/ios,src/build/config/mac下的BUILD.gn
五,修改create_macos_gen_snapshots.py
gen_snapshot_dir = os.path.join(directory, 'clang_arm64', 'gen_snapshot')把clang_x64替换掉,我的芯片是M系列,低版本应该不会报错
六,Wunused-but-set-variable,Wdeprecated-builtins报错,打开out/ios_debug_sim_unopt_arm64的xcode工程,搜索"-Werror"然后直接删除
七,再次ninja -C ios_debug_sim_unopt,最后成功编译完
备注:跑Runner.xcodeproj时候,执行
flutter run --local-engine-src-path /Users/admin/Documents/Flutter/engine/src --local-engine=ios_debug_sim_unopt_arm64
会提示
Showing Recent Errors Only
ERROR: FormatException: Could not find an option named "verbosity".
这个目前是https://github.com/flutter/engine的代码与本地flutter sdk里的engine版本不一致.
关联文件/Flutter/engine/src/third_party/dart/pkg/front_end/lib/src/api_prototype/compiler_options.dart,engine/src/third_party/dart/pkg/dartdev/lib/src/commands/compile.dart
本文暂时没有评论,来添加一个吧(●'◡'●)