Compile errors (tag v2.88.3) static build for vulkan on arm64 linux / clang 21 / gcc 13

25 views
Skip to first unread message

Oisín Grehan

unread,
Apr 9, 2026, 10:17:59 AM (5 days ago) Apr 9
to skia-discuss
Since I cannot log issues on the skia bug tracker, I'm dumping this here:

ninja config:

bin/gn gen out/Static --args='is_official_build=true skia_use_vulkan=true cc="clang" cxx="clang++"'

I'm on a surface laptop 7 (snapdragon x elite) with vulkan support, compiling on wsl2 / ubuntu 24.04 -- vulkan support is exposed in wsl.

Using clang 21 + gcc 13 sysroot:

Issues & Fixes:

Description:

Fix three compilation errors encountered when building Skia statically on ARM64 Linux (WSL2) with Clang 21 using GCC 13's libstdc++ headers.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

src/utils/SkParseColor.cpp — missing <algorithm> and <iterator>

FindNamedColor uses std::begin, std::end, and std::lower_bound but the file only includes SkParse.h. With GCC 13 headers these are no longer transitively included, causing:

 error: no matching function for call to 'begin'
 error: no matching function for call to 'end'

Fix: add explicit #include <algorithm> and #include <iterator>.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

third_party/freetype2/BUILD.gn — sysroot-relative -I= flag

The system FreeType2 include path was specified as -I=/usr/include/freetype2. The = prefix is GCC's sysroot-relative include syntax, which requires --sysroot to be configured — without it, Clang does not resolve the path, causing:

 fatal error: 'ft2build.h' file not found

Fix: use the absolute path -I/usr/include/freetype2 directly.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

third_party/vulkanmemoryallocator/GrVulkanMemoryAllocator.cpp — snprintf undeclared

vk_mem_alloc.h uses snprintf in its stats string helpers but only includes <cstdlib>, not <cstdio>. With GCC 13 headers snprintf is no longer available transitively, causing:

 error: use of undeclared identifier 'snprintf'

Fix: add #include <cstdio> in GrVulkanMemoryAllocator.cpp before the VMA header is included, avoiding modification of the third-party header itself.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Testing: Full static library build completes without errors on ARM64 Linux (WSL2), Clang 21, GCC 13 sysroot.

kjlu...@google.com

unread,
Apr 9, 2026, 10:21:36 AM (5 days ago) Apr 9
to skia-discuss
You must be on an old version (what tag version is that?) because the missing includes in SkParseColor.cpp were added ~4 years ago https://review.skia.org/533981 and third_party/vulkanmemoryallocator/GrVulkanMemoryAllocator.cpp no longer exists (moved some time ago)

Oisín Grehan

unread,
Apr 9, 2026, 1:03:39 PM (5 days ago) Apr 9
to skia-discuss
Oh sh*t. 

I had cloned mono/skia not google/skia

Thanks... I'll try again. Appreciate the quick response. 

Oisin

Oisín Grehan

unread,
Apr 9, 2026, 1:03:40 PM (5 days ago) Apr 9
to skia-discuss
Yeah, I'm trying to use mono/SkiaSharp on dotnet and they have forked google/skia to mono/skia and it's probably about 4 years out of date :/

On Thursday, 9 April 2026 at 10:21:36 UTC-4 kjlu...@google.com wrote:
Reply all
Reply to author
Forward
0 new messages