build configuration for emscripten

16 views
Skip to first unread message

Sean

unread,
Jun 2, 2025, 1:08:43 PM (12 days ago) Jun 2
to skia-discuss
Hi all,

Im struggling with including paragraph into my libskia.a.
here is my args.gn which successfully being built (but no paragraph in it :( )

# -----------------------------------------------------------------------------
# 1. Build Type & Target Platform
# -----------------------------------------------------------------------------
is_official_build = true
is_component_build = false

target_os   = "emscripten"
target_cpu  = "wasm"

# -----------------------------------------------------------------------------
# 2. GPU / Graphics Backend
# -----------------------------------------------------------------------------
# Enable GPU support
skia_enable_gpu   = true

# Use OpenGL / WebGL surfaces
skia_use_gl       = true
skia_use_webgl    = true

# Disable EGL (not needed for Emscripten/WebGL)
skia_use_egl      = false

# Define these flags so Skia knows it’s a GL/Ganesh build
extra_cflags += [
  "-DSK_GL",
  "-DSK_GANESH",  # Enables Ganesh (the Skia GPU backend) explicitly
]

# -----------------------------------------------------------------------------
# 3. Compression / PNG / ZLib
# -----------------------------------------------------------------------------
# Enable zlib; bundle it instead of using system zlib
skia_use_zlib         = true
skia_use_system_zlib  = false

# When building libpng, ensure PNG does not try to enable WebP support
extra_cflags += [
  "-DSK_DISABLE_WEBP=1",
  "-DNDEBUG",
]

# -----------------------------------------------------------------------------
# 4. Font / Text / Internationalization
# -----------------------------------------------------------------------------
# ICU for full Unicode / locale support
skia_use_icu           = true
skia_use_system_icu    = false

# Enable SkUnicode + Shaper + Paragraph APIs
skia_enable_skunicode     = true    # Unicode fallback (Bidi / line-break)
skia_enable_skshaper      = true    # Glyph shaping engine
skia_enable_skparagraph   = true    # Paragraph API

# FreeType: font rasterizer
skia_use_freetype          = true
skia_use_system_freetype2  = false
skia_enable_fontmgr_empty  = false  # Use a real FontMgr instead of the empty stub

# Extra linker flag to ensure SkDebugf symbols are kept
extra_ldflags += [
  "-Wl,--undefined=_SkDebugf",
]

# -----------------------------------------------------------------------------
# 5. Optional Skia Features
# -----------------------------------------------------------------------------
skia_enable_skottie            = false  # Disable Skottie (animation) support
skia_enable_pdf                = false  # Disable PDF backend
skia_enable_spirv_validation   = false  # Disable SPIR-V validation

# -----------------------------------------------------------------------------
# 6. External Image Codecs
# -----------------------------------------------------------------------------
skia_use_libjpeg_turbo_decode  = false
skia_use_libjpeg_turbo_encode  = false

skia_use_libwebp_decode        = false
skia_use_libwebp_encode        = false

skia_use_expat                  = false  # XML parser (used by some Skia modules)

skia_use_dng_sdk                = false
skia_use_piex                   = false
skia_use_wuffs                  = false

# -----------------------------------------------------------------------------
# 7. Link-Time Optimization (LTO)
# -----------------------------------------------------------------------------
# Enable LTO for smaller, more optimized WASM binary
extra_cflags += [
  "-flto",
]
extra_ldflags += [
  "-flto",
]


here are my commands to build:
rm -rf out/wasm      
bin/gn gen out/wasm --args="$(< /canvas/skia_args.gn)"
ninja -C out/wasm skia

everything is working except for calls to paragraph APIs

last two weeks, I ate google and chatGPT yet not even a small success. I must miss something obvious...

I really appreciate your help and guidance. 



Regards,
Sean

jlav...@google.com

unread,
Jun 2, 2025, 3:26:56 PM (12 days ago) Jun 2
to skia-discuss
There is at least one thing that you are missing: 
skia_canvaskit_enable_paragraph = true
It might be the problem here.
Reply all
Reply to author
Forward
0 new messages