flutter/engine のビルドでエラー missing required architecture i386 in file

Xcode 10 を使っていると [flutter/engine](https://github.com/flutter/engine) のビルドに失敗します。

通常は flutter/flutter を使うだけなので問題になるケースは少ないと思いますが engine を修正して使ったり、プルリクエストのためにビルドが必要な場合は困ります。

以下のように MacOSX SDKL に i386 が含まれないことでエラーになります。

```
ninja: Entering directory `out/android_release'
[1/5] LINK clang_x86/gen_snapshot
FAILED: clang_x86/gen_snapshot 
../../buildtools/mac-x64/clang/bin/clang++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.12 -m32 -flto -stdlib=libc++ -Wl,-dead_strip -Wl,-search_paths_first -L. -Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/../../.. -Wl,-pie -Xlinker -rpath -Xlinker @executable_path/Frameworks -o clang_x86/gen_snapshot -Wl,-filelist,clang_x86/gen_snapshot.rsp  -framework CoreFoundation -framework CoreServices -framework AppKit -framework ApplicationServices -framework Carbon -framework CoreVideo -framework Foundation -framework OpenGL -framework Security -framework IOKit -ldl -lpthread
ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS)
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//CoreServices.framework/CoreServices.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//CoreServices.framework/CoreServices.tbd
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//ApplicationServices.framework/ApplicationServices.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//ApplicationServices.framework/ApplicationServices.tbd
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//Carbon.framework/Carbon.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//Carbon.framework/Carbon.tbd
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//CoreVideo.framework/CoreVideo.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//CoreVideo.framework/CoreVideo.tbd
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//OpenGL.framework/OpenGL.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//OpenGL.framework/OpenGL.tbd
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd (2 slices)
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//AppKit.framework/AppKit.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//AppKit.framework/AppKit.tbd
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libdl.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libdl.tbd
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libpthread.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libpthread.tbd
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//Foundation.framework/Foundation.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//Foundation.framework/Foundation.tbd
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//IOKit.framework/IOKit.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//IOKit.framework/IOKit.tbd
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//Security.framework/Security.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks//Security.framework/Security.tbd
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libc++.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libc++.tbd
Undefined symbols for architecture i386:
  "_trunc", referenced from:
      __GLOBAL__sub_I_runtime_entry.cc in lto.o
     (maybe you meant: __ZN4dart12Intrinsifier19Integer_truncDivideEPNS_9AssemblerEPNS_5LabelE, __ZN4dart26FLAG_truncating_left_shiftE , __ZN4dart16BootstrapNatives19DN_Double_trunc_divEP21_Dart_NativeArguments , __ZN4dart16BootstrapNatives18DN_Double_truncateEP21_Dart_NativeArguments , __ZN4dart16BootstrapNatives30DN_Integer_truncDivFromIntegerEP21_Dart_NativeArguments )
```

Issue: https://github.com/flutter/flutter/issues/22598

公式のWikiはこちら: https://github.com/flutter/flutter/wiki/Supporting-legacy-platforms#building-armv7-ios--armeabi-v7a-android-with-xcode10

## 対処

Xcode 9 ではビルドできるので [Apple](https://developer.apple.com/download/more/) から Xcode 9 をダウンロードしてきて展開後、その中に含まれる `Xcode9.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk` (これが 10.13) を Xcode 10 の下(下記のパス)にコピーします。

```
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk
```

### 確認

flutter/engine に含まれる find_sdk.py を実行して:

```
src/build/mac/find_sdk.py 10.12
```

`10.13` と表示されればOKです。