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.