Unable to build the skia/tools/window support library

44 views
Skip to first unread message

Bruno Nicoletti

unread,
Mar 26, 2025, 11:16:30 AM3/26/25
to skia-discuss
Hi,


I am on the chrome/m135 branch and I’m currently trying to build the skia libwindow.a support library found in skia/tools/window and I can’t seem to figure out the right configuration options to `gn` to make it build. I have to set skia_enable_tools to and skia_enable_ganesh to true to get it to attempt to build it, but it fails to compile several files. I’ve tried various combinations of  skia_enable_graphite, skia_use_dawn and skia_use_gl but it is very unhappy. I'm doing this on MacOS.

Is there a magical combination of build configs I haven't figured yet, or is the library broken? Any help appreciated.


An example compilation error is...

[910/951] compile ../../../src/skia/tools/gpu/BackendSurfaceFactory.cpp
FAILED: obj/tools/gpu/gpu_tool_utils.BackendSurfaceFactory.o
clang++ -MD -MF obj/tools/gpu/gpu_tool_utils.BackendSurfaceFactory.o.d -DSK_ENABLE_DISCRETE_GPU -DNDEBUG -DSK_USE_INTERNAL_VULKAN_HEADERS -DSK_GAMMA_APPLY_TO_A8 -DSK_ENABLE_AVX512_OPTS -DSK_TYPEFACE_FACTORY_CORETEXT -DSK_FONTMGR_CORETEXT_AVAILABLE -DSK_GL -DSK_METAL -DSK_DAWN -DSK_CODEC_ENCODES_JPEG -DSK_CODEC_ENCODES_PNG -DSK_CODEC_ENCODES_PNG_WITH_LIBPNG -DSK_CODEC_DECODES_JPEG -DSK_CODEC_DECODES_ICO -DSK_CODEC_DECODES_PNG -DSK_CODEC_DECODES_PNG_WITH_LIBPNG -DSK_HAS_WUFFS_LIBRARY -DSK_CODEC_DECODES_GIF -DSK_XML -DSK_CODEC_DECODES_BMP -DSK_CODEC_DECODES_WBMP -DSK_ENABLE_PRECOMPILE -DSK_ASSUME_GL=1 -DSK_GANESH -DSK_GRAPHITE -DSK_DISABLE_TRACING -DSK_USE_PERFETTO -DSK_ENABLE_API_AVAILABLE -I../../../src/skia/include/third_party/vulkan -Igen/third_party/externals/dawn/include -I../../../src/skia/third_party/externals/dawn/include -I../../../src/skia -Wno-attributes -ffp-contract=off -fPIC -fvisibility=hidden -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk -target x86_64-apple-macos10.15 -fstrict-aliasing -O3 -mmacosx-version-min=10.15 -Wno-microsoft-cast -std=c++17 -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -c ../../../src/skia/tools/gpu/BackendSurfaceFactory.cpp -o obj/tools/gpu/gpu_tool_utils.BackendSurfaceFactory.o
../../../src/skia/tools/gpu/BackendSurfaceFactory.cpp:89:44: error: no member named 'createTestingOnlyBackendRenderTarget' in 'GrGpu'
   89 |     auto bert = dContext->priv().getGpu()->createTestingOnlyBackendRenderTarget(
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~  ^
../../../src/skia/tools/gpu/BackendSurfaceFactory.cpp:97:18: error: no member named 'deleteTestingOnlyBackendRenderTarget' in 'GrGpu'
   97 |             gpu->deleteTestingOnlyBackendRenderTarget(rc->fRenderTarget);
      |             ~~~  ^
2 errors generated.




James Godfrey-Kittle

unread,
Mar 26, 2025, 11:32:07 AM3/26/25
to skia-d...@googlegroups.com
Currently the window tools are only meant to be used as part of Skia's testing utils; practically speaking, the given compile error is caused because those symbols are only available if the macro GPU_TEST_UTILS is defined:

For this macro to be defined we must have "is_skia_dev_build && !is_wasm":

For is_skia_dev_build to be true we must have "is_skia_standalone && !is_official_build":

is_skia_standalone is probably true if you're building from the Skia codebase itself, but perhaps you are building for wasm or you've set is_official_build to true. We do admittedly suggest setting is_official_build to true in https://skia.org/docs/user/build. I don't think anyone anticipated Skia users wanting to build and use libwindow.

Bruno Nicoletti

unread,
Mar 26, 2025, 12:39:10 PM3/26/25
to skia-discuss
Thanks for the prompt response.

Perhaps I'm going about things the wrong way. I'm writing a cross platform application and I want to use use skia as the drawing library. So I'm looking for a library that will create native application windows that instantiate a skia surface backed by the appropriate platform GPU/CPU draw routines. Which is what tools/window does. Should I be using something else instead?

Inkling00

unread,
Mar 26, 2025, 12:44:38 PM3/26/25
to skia-d...@googlegroups.com
I'm writing a gui toolkit using skia as drawing library. For window management I use glfw, that also handles your input, and is cross platform. 

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/skia-discuss/92a84437-3d25-44f9-a211-543f72cbacf6n%40googlegroups.com.

Bruno Nicoletti

unread,
Mar 26, 2025, 12:51:58 PM3/26/25
to skia-discuss
I'm also writing a gui toolkit for my application.

Ideally I'd like to use the most optimal draw layer for the host OS, eg: that would metal on MacOS/iOS, given that Skia has a metal draw layer.

Jim Van Verth

unread,
Mar 26, 2025, 1:04:17 PM3/26/25
to skia-d...@googlegroups.com
I would recommend creating your own windowing library or use something more robust and thoroughly tested like SDL or GLFW. The library in tools is just enough to handle our test cases but nothing I would put in a final product.



--

Jim Van Verth |
 Software Engineer | Google.com

Bruno Nicoletti

unread,
Mar 26, 2025, 2:11:33 PM3/26/25
to skia-discuss
Thanks. I'm digging into SDL to see how I can shim skia into it.
Reply all
Reply to author
Forward
0 new messages