Repository: flutter
Issue: Flutter Engine not able to be compiled on arm64 Linux
Labels: c: crash,engine,platform-linux,a: desktop,P2,e: local-engine-development,team-linux,triaged-linux

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

1. Pull with gclient
2. Run the `gn` script with these arguments: ` --no-goma --embedder-for-target --prebuilt-dart-sdk`
3. Run ninja

Some extra info:
- This was discovered while packaging the Flutter Engine for Nix and the problem occurs on their CI servers along with my own setup
- This particular issue is being reported on an M1 Pro with NixOS dual booted

Despite these, this issue does occur on other ARM64 hardware/setups so it likely not just an issue with any special setups.

The exact source of what is going on can be found here, specifically how it is configured: https://github.com/NixOS/nixpkgs/compare/master...ExpidusOS:nixpkgs:flutter-engine/init#diff-dc69ccff28f124ab7e96c03b146167c0a901b6157be252e984ef46a1f13494feR310-R311

### Expected results

Engine should compile all dependencies and itself correctly

### Actual results

```
flutter-engine-d44b5a94c976fbb65815374f61ab5392a220b084> clang-16: error: unsupported argument 'x86-64' to option '-march='
flutter-engine-d44b5a94c976fbb65815374f61ab5392a220b084> ninja: build stopped: subcommand failed.
error: builder for '/nix/store/nbv4b6x705vgdkb0ckmpnawqxdkphkyb-flutter-engine-d44b5a94c976fbb65815374f61ab5392a220b084.drv' failed with exit code 1;
       last 10 log lines:
       > clang-16: error: unsupported argument 'x86-64' to option '-march='
       > [9/91] CXX obj/third_party/flatbuffers/grpc/src/compiler/flatc.ts_generator.o
       > FAILED: obj/third_party/flatbuffers/grpc/src/compiler/flatc.ts_generator.o
       > ../../../../../build/flutter-engine-source-d44b5a94c976fbb65815374f61ab5392a220b084/src/buildtools/linux-arm64/clang/bin/clang++ -MD -MF obj/third_party/flatbuffers/grpc/src/compiler/flatc.ts_generator.o.d -DUSE_OPENSSL=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_LIBCPP_DISABLE_AVAILABILITY=1 -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -I../../../../../build/flutter-engine-source-d44b5a94c976fbb65815374f61ab5392a220b084/src/third_party/flatbuffers/grpc -I../../../../../build/flutter-engine-source-d44b5a94c976fbb65815374f61ab5392a220b084/src -Igen -I../../../../../build/flutter-engine-source-d44b5a94c976fbb65815374f61ab5392a220b084/src/third_party/libcxx/include -I../../../../../build/flutter-engine-source-d44b5a94c976fbb65815374f61ab5392a220b084/src/third_party/libcxxabi/include -I../../../../../build/flutter-engine-source-d44b5a94c976fbb65815374f61ab5392a220b084/src/build/secondary/third_party/libcxx/config -I../../../../../build/flutter-engine-source-d44b5a94c976fbb65815374f61ab5392a220b084/src/third_party/flatbuffers/include -fno-strict-aliasing -fstack-protector --param=ssp-buffer-size=4 -m64 -march=x86-64 -fPIC -pipe -pthread -fcolor-diagnostics -Wall -Wextra -Wendif-labels -Werror -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-but-set-parameter -Wno-unused-but-set-variable -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-deprecated-copy -Wno-psabi -Wno-unqualified-std-cast-call -Wno-non-c-typedef-for-linkage -Wno-range-loop-construct -fvisibility=hidden --sysroot=/nix/store/sp2mnbznnis4pf6jzwczbbi51nnwdvhq-flutter-engine-toolchain-d44b5a94c976fbb65815374f61ab5392a220b084 -Wstring-conversion -Wnewline-eof -O2 -fno-ident -fdata-sections -ffunction-sections -g0 -Wno-newline-eof -fvisibility-inlines-hidden -std=c++17 -fno-rtti -nostdinc++ -nostdinc++ -fvisibility=hidden -fno-exceptions   -c ../../../../../build/flutter-engine-source-d44b5a94c976fbb65815374f61ab5392a220b084/src/third_party/flatbuffers/grpc/src/compiler/ts_generator.cc -o obj/third_party/flatbuffers/grpc/src/compiler/flatc.ts_generator.o
       > clang-16: error: unsupported argument 'x86-64' to option '-march='
       > [10/91] CXX obj/third_party/flatbuffers/grpc/src/compiler/flatc.java_generator.o
       > FAILED: obj/third_party/flatbuffers/grpc/src/compiler/flatc.java_generator.o
       > ../../../../../build/flutter-engine-source-d44b5a94c976fbb65815374f61ab5392a220b084/src/buildtools/linux-arm64/clang/bin/clang++ -MD -MF obj/third_party/flatbuffers/grpc/src/compiler/flatc.java_generator.o.d -DUSE_OPENSSL=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_LIBCPP_DISABLE_AVAILABILITY=1 -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -I../../../../../build/flutter-engine-source-d44b5a94c976fbb65815374f61ab5392a220b084/src/third_party/flatbuffers/grpc -I../../../../../build/flutter-engine-source-d44b5a94c976fbb65815374f61ab5392a220b084/src -Igen -I../../../../../build/flutter-engine-source-d44b5a94c976fbb65815374f61ab5392a220b084/src/third_party/libcxx/include -I../../../../../build/flutter-engine-source-d44b5a94c976fbb65815374f61ab5392a220b084/src/third_party/libcxxabi/include -I../../../../../build/flutter-engine-source-d44b5a94c976fbb65815374f61ab5392a220b084/src/build/secondary/third_party/libcxx/config -I../../../../../build/flutter-engine-source-d44b5a94c976fbb65815374f61ab5392a220b084/src/third_party/flatbuffers/include -fno-strict-aliasing -fstack-protector --param=ssp-buffer-size=4 -m64 -march=x86-64 -fPIC -pipe -pthread -fcolor-diagnostics -Wall -Wextra -Wendif-labels -Werror -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-but-set-parameter -Wno-unused-but-set-variable -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-deprecated-copy -Wno-psabi -Wno-unqualified-std-cast-call -Wno-non-c-typedef-for-linkage -Wno-range-loop-construct -fvisibility=hidden --sysroot=/nix/store/sp2mnbznnis4pf6jzwczbbi51nnwdvhq-flutter-engine-toolchain-d44b5a94c976fbb65815374f61ab5392a220b084 -Wstring-conversion -Wnewline-eof -O2 -fno-ident -fdata-sections -ffunction-sections -g0 -Wno-newline-eof -fvisibility-inlines-hidden -std=c++17 -fno-rtti -nostdinc++ -nostdinc++ -fvisibility=hidden -fno-exceptions   -c ../../../../../build/flutter-engine-source-d44b5a94c976fbb65815374f61ab5392a220b084/src/third_party/flatbuffers/grpc/src/compiler/java_generator.cc -o obj/third_party/flatbuffers/grpc/src/compiler/flatc.java_generator.o
       > clang-16: error: unsupported argument 'x86-64' to option '-march='
       > ninja: build stopped: subcommand failed
```
(Shortened due to repetition)

### Code sample

<details><summary>Code sample</summary>

```dart
[Paste your code here]
```

</details>


### Screenshots or Video

<details>
<summary>Screenshots / Video demonstration</summary>

![screenshot](https://github.com/flutter/flutter/assets/19699320/1d55faaf-6674-497b-b141-328cca9eed0a)
</details>


### Logs

<details><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
[Paste your output here]
```

</details>