From 58bb0adf2ceb1c7ddcb854f867217305c2f63251 Mon Sep 17 00:00:00 2001 From: John O'Neil Date: Thu, 26 Oct 2023 14:10:04 -0700 Subject: [PATCH] Fix for undefined `uint8_t` seen on Clang-15+GCC13 (flutter/engine#47288) This PR is to address an issue we're seeing compiling flutter+impeller in certain configurations. Specifically: 1. Compiling with `clang-15` 2. using the GCC 13 backend to provide headers and cstdlib. Via the `clang-15` version flag: ``` clang-15 -v Debian clang version 15.0.7 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11 Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12 Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/13 Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/13 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Candidate multilib: x32;@mx32 Selected multilib: .;@m64 ``` We were building using the gcc 12 backend for a while, but picked up an update that forced us to 13, and then saw this issue. The issue is seen as `uint8_t` being undefined as in the following partial messages: ``` hex_codec.cc:18:5: error: unknown type name 'uint8_t' base32.cc:29:32: error: unknown type name 'uint8_t' ``` I'm not sure this is the cleanest fix, or if it might be better handled by adding some compile time switches, but I wanted to provide this to start conversation. I'm also hoping to get a better idea of tests run against a PR. If there's any I should run manually we can discuss that here. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style --- engine/src/flutter/fml/base32.cc | 1 + engine/src/flutter/fml/hex_codec.cc | 1 + 2 files changed, 2 insertions(+) diff --git a/engine/src/flutter/fml/base32.cc b/engine/src/flutter/fml/base32.cc index 6138f0f817..57472c6efb 100644 --- a/engine/src/flutter/fml/base32.cc +++ b/engine/src/flutter/fml/base32.cc @@ -4,6 +4,7 @@ #include "flutter/fml/base32.h" +#include // uint8_t #include #include diff --git a/engine/src/flutter/fml/hex_codec.cc b/engine/src/flutter/fml/hex_codec.cc index 7c5fb0f27b..7a3f4f102c 100644 --- a/engine/src/flutter/fml/hex_codec.cc +++ b/engine/src/flutter/fml/hex_codec.cc @@ -4,6 +4,7 @@ #include "flutter/fml/base32.h" +#include // uint8_t #include namespace fml {