Skip to content

Commit c6282e3

Browse files
committed
docs: update known limitations and future work for X11 dependencies in Tk build script
1 parent e437929 commit c6282e3

1 file changed

Lines changed: 43 additions & 19 deletions

File tree

common/build/deplib/build_tk.sh

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,27 +54,51 @@ make -j $(nproc) && make install
5454
# KNOWN LIMITATION / TODO — X11 is NOT built from source (yet)
5555
# -----------------------------------------------------------------------
5656
# This `cp -a`-from-Alpine approach is a pragmatic deviation from the
57-
# project's "build everything from source with musl" principle. It keeps
58-
# the CI smoke test (`ci/smoke_tkinter.py` — headless, no display, no
59-
# drawing) green, but falls short for real GUI use:
57+
# project's "build everything from source with musl" principle. The
58+
# tkinter CI smoke (`ci/smoke_tkinter.py`) is intentionally marked
59+
# non-blocking (continue-on-error in .github/workflows/build.yml,
60+
# `|| echo` in .gitlab-ci.yml) so the rest of the build pipeline keeps
61+
# reporting useful signal while the full X11 stack remains unfinished.
6062
#
61-
# * No `/etc/fonts/fonts.conf` and no font files are shipped.
62-
# fontconfig will warn and "no fonts available" surfaces the moment
63-
# Tk tries to render text. On a Debian-slim final image with no host
64-
# fontconfig package, a real `Tk()` window cannot draw labels.
65-
# * No `/usr/share/X11/locale/` is shipped → XmbLookupString / i18n
66-
# input paths degrade to C locale fallback.
67-
# * Transitive ELF deps beyond the 8 names below may not all be
68-
# captured (e.g. libpng → freetype; expat SONAME alignment with the
69-
# Alpine-built fontconfig vs our own build_expat.sh output).
63+
# --- Confirmed failures observed on Debian-slim final image ---
64+
# 1. `import _tkinter` → ImportError: libbz2.so.1 not found, needed by
65+
# our copied libfreetype.so.6.
66+
# Root cause: build_bzip2.sh only produces static libbz2.a; no
67+
# libbz2.so* is ever installed into /opt/shared_libraries/lib/.
68+
# Alpine's libfreetype has DT_NEEDED=libbz2.so.1 → dlopen fails.
7069
#
71-
# The proper fix is to add build scripts for the full stack:
72-
# libXau, libXdmcp, xcb-proto (py), libxcb, xtrans, xorgproto, libX11,
73-
# libXrender, libXext, libpng, libfreetype, libfontconfig, libXft
74-
# plus ship a minimal `/opt/shared_libraries/etc/fonts/fonts.conf`
75-
# and a small font set (e.g. DejaVu subset), and set FONTCONFIG_PATH /
76-
# FONTCONFIG_FILE in launcher.c. Estimated ~10 scripts + ~1–2 days.
77-
# Tracked informally here until promoted to a real issue.
70+
# --- Predicted follow-on failures (not yet hit because we fail fast
71+
# on #1, but will surface once #1 is fixed) ---
72+
# 2. libfreetype.so.6 also has DT_NEEDED=libpng.so.16; we build no
73+
# libpng at all. Needs a new build_libpng.sh.
74+
# 3. libfontconfig.so.1 needs libexpat.so.1 at a specific SONAME.
75+
# We build expat (build_expat.sh) but the SONAME emitted by our
76+
# build may not match what Alpine's libfontconfig was linked to.
77+
# Needs `readelf -d` check.
78+
# 4. Actual GUI use (`Tk()` + `Label(text=...).pack()`):
79+
# a. No `/etc/fonts/fonts.conf` on final image → fontconfig
80+
# warns and falls back; on a Debian-slim base without the
81+
# fontconfig package, no font is found → render errors.
82+
# b. No font files shipped (e.g. DejaVu sans / Noto) →
83+
# fontconfig has nothing to serve even with a valid config.
84+
# c. No `/usr/share/X11/locale/` → XmbLookupString / i18n input
85+
# path degrades to C locale.
86+
#
87+
# --- Proper fix (Option A in the design discussion) ---
88+
# Replace this `cp -a` block with real from-source builds, in order:
89+
# libXau, libXdmcp, xcb-proto (python module), libxcb,
90+
# xtrans (headers), xorgproto (headers), libX11, libXext,
91+
# libXrender, libpng, libfreetype (relink against our libpng
92+
# + our libbz2.so.1 after build_bzip2.sh ships a shared version),
93+
# libfontconfig (against our expat + freetype), libXft.
94+
# Plus:
95+
# - ship `/opt/shared_libraries/etc/fonts/fonts.conf`
96+
# - ship a minimal font subset (e.g. DejaVu sans ~1–2 MB)
97+
# - set FONTCONFIG_PATH / FONTCONFIG_FILE in launcher.c so
98+
# fontconfig finds the shipped config/fonts first
99+
# Estimated ~10 build scripts + font/config shipping, ~1–2 days.
100+
#
101+
# Tracked informally here until promoted to a real GitHub issue.
78102
# -----------------------------------------------------------------------
79103
for name in X11 Xft Xrender Xau Xdmcp xcb fontconfig freetype; do
80104
found=0

0 commit comments

Comments
 (0)