Repository: flutter
Issue: [engine] build asserts using custom sysroot and not downloading Linux sysroot
Labels: engine,platform-linux,P2,customer: going,team-engine,triaged-engine

flutter doctor -v
```
flutter doctor -v
[✓] Flutter (Channel beta, 1.26.0-17.6.pre, on Linux, locale en_US.UTF-8)
• Flutter version 1.26.0-17.6.pre at /home/joel/development/flutter
• Framework revision a29104a (6 days ago), 2021-02-16 09:26:56 -0800
• Engine revision 21fa8bb99e
• Dart version 2.12.0 (build 2.12.0-259.12.beta)

[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
flutter config --android-sdk to update to that location.

[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[✓] VS Code (version 1.52.1)
• VS Code at /usr/share/code
• Flutter extension version 3.19.0

[!] Connected device
! No devices available

! Doctor found issues in 3 categories.
```
.gclient
```
[
    {
        "managed" : False,
        "name" : "src/flutter",
        "url" : "https://github.com/flutter/engine.git",
        "deps_file": "DEPS",
        "custom_vars" : {
            "download_android_deps" : False,
            "download_windows_deps" : False,
            "download_linux_deps"   : False,
        }
    }
]
```

Building via
```
./flutter/tools/gn --disable-desktop-embeddings --embedder-for-target --enable-fontconfig --full-dart-sdk --clang --lto --target-os linux --linux-cpu arm64 --target-sysroot /b/.../tmp/work/aarch64-poky-linux/flutter-engine/git-r0/recipe-sysroot --target-toolchain /b/.../tmp/work/aarch64-poky-linux/flutter-engine/git-r0/src/buildtools/linux-x64/clang --target-triple aarch64-unknown-linux-gnu
```
Causes Build Assert
```
ERROR at //build/config/sysroot.gni:38:5: Assertion failed.
    assert(
    ^-----
Missing sysroot (/b/.../tmp/work/aarch64-poky-linux/flutter-engine/git-r0/src/build/linux/debian_sid_amd64-sysroot). To fix, run: build/linux/sysroot_scripts/install-sysroot.py --arch=x64
See //build/config/sysroot.gni:39:9: 
        exec_script("//build/dir_exists.py", [ sysroot ], "string") == "True",
        ^--------------------------------------------------------------------
This is where it was set.
See //build/config/linux/pkg_config.gni:5:1: whence it was imported.
import("//build/config/sysroot.gni")
^----------------------------------
See //build/config/linux/BUILD.gn:5:1: whence it was imported.
import("//build/config/linux/pkg_config.gni")
^-------------------------------------------
See //build/config/BUILDCONFIG.gn:357:33: which caused the file to be included.
  _native_compiler_configs += [ "//build/config/linux:sdk" ]
                                ^-------------------------
GOMA usage was specified but can't be found, falling back to local builds. Set the GOMA_DIR environment variable to fix GOMA.
Generating GN files in: out/linux_debug_arm64
WARNING: /b/.../tmp/work/aarch64-poky-linux/flutter-engine/git-r0/temp/run.do_configure.950414:1 exit 1 from './flutter/tools/gn --disable-desktop-embeddings --embedder-for-target --enable-fontconfig --full-dart-sdk --clang --lto --target-os linux --linux-cpu arm64 --target-sysroot /b/.../tmp/work/aarch64-poky-linux/flutter-engine/git-r0/recipe-sysroot --target-toolchain /b/.../tmp/work/aarch64-poky-linux/flutter-engine/git-r0/src/buildtools/linux-x64/clang --target-triple aarch64-unknown-linux-gnu'
```

Workaround
```
From 528c1f2f05a5eae710905547140f4a4f465d7d88 Mon Sep 17 00:00:00 2001
From: Joel Winarske <joel.winarske@toyotaconnected.com>
Date: Fri, 19 Feb 2021 22:16:00 +0000
Subject: [PATCH 2/2] x64 sysroot assert

---
 build/config/sysroot.gni | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/build/config/sysroot.gni b/build/config/sysroot.gni
index 12187df..2eb385c 100644
--- a/build/config/sysroot.gni
+++ b/build/config/sysroot.gni
@@ -14,7 +14,7 @@ declare_args() {
 
   # Whether to use the default sysroot when building for Linux, if an explicit
   # sysroot isn't set.
-  use_default_linux_sysroot = true
+  use_default_linux_sysroot = false
 
   # The absolute path to the Xcode toolchain. This is used to look for headers
   # that usually ship with the toolchain like c++/v1.
-- 
2.29.2
```

This issue has been around since Linux desktop support was added.  It would be nice to eliminate this patch.

@stuartmorgan