From 4facdf5c9b56c878dda650d90231c19b0779ace1 Mon Sep 17 00:00:00 2001 From: lotherk Date: Fri, 13 Nov 2026 22:43:42 +0000 Subject: [PATCH] userland cross: the target's X is reachable to the compiler, and libXft's missing prototype is brought in fonts/Xft2 stopped at three X problems in a row (build/logs/userland-2026-11-13t.log, build/logs/xft2-single*.log): - x11-links builds a shadow tree from ${X11BASE}/ and /usr/, both this host's paths in a cross build: it linked Debian's xorgproto headers and never Xrender.h. For that one package X11BASE is now the sysroot's /usr/X11R7. - mk/x11.buildlink3.mk:31 passes --x-includes=/usr/X11R7/include, and neither --sysroot nor the cwrappers make that resolve here (tested: plain gcc with --sysroot still fails; the wrapper rewrites the path into a shadow tree of the host's X). GCC's sysroot-relative form works and the wrapper passes it through untouched (tested in a work directory): CPPFLAGS+= -I=${X11BASE}/include, LDFLAGS+= -L=${X11BASE}/lib. - libXft 2.1.7 calls FT_GlyphSlot_Embolden with no declaration in scope and GCC 14 errors on that; configure proves the symbol is in the library, the prototype is in , so that header is included for the package. fonts/Xft2 now builds and installs (build/logs/xft2-single4-2026-11-13.log exit=0). tools/userland.sh's comment records that a CFLAGS change in the fragment needs a clean work directory. --- tools/pkgsrc-cross.mk.conf | 39 +++++++++++++++++++++++++++++++++++++- tools/userland.sh | 5 +++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/tools/pkgsrc-cross.mk.conf b/tools/pkgsrc-cross.mk.conf index dba5c6b9d9..c4f4432948 100644 --- a/tools/pkgsrc-cross.mk.conf +++ b/tools/pkgsrc-cross.mk.conf @@ -130,6 +130,43 @@ NATIVE_CC= /usr/bin/gcc # what the wrapper asks for; the recipe is pkgsrc's, which this tree does not # patch, so the setting is here. PKGPATH is defined when this file is read # (measured with a temporary mk.conf: show-var VARNAME=USE_LANGUAGES -> c++). +# c stays in the list: USE_LANGUAGES is empty in that recipe, so this is the +# only place the language list is set, and without c pkgsrc wraps cc too -- the +# C preprocessor probe then fails the same way (userland-2026-11-13s.log:88). .if ${PKGPATH} == "fonts/Xft2" -USE_LANGUAGES+= c++ +USE_LANGUAGES+= c c++ +# libXft 2.1.7 calls FT_GlyphSlot_Embolden (xftglyphs.c:177) without a +# declaration in scope: freetype dropped FT_SYNTHESIS_H from ft2build.h, and +# configure finds the symbol in the library instead of the header +# (config.log:1033 ac_cv_func_FT_GlyphSlot_Embolden=yes). GCC 14 makes an +# implicit declaration an error, so the build stops (build/logs/ +# xft2-single2-2026-11-13.log:316). The declaration is in +# ; bringing it in is the missing include, not a muted +# diagnostic (measured: the file compiles with -include freetype/ftsynth.h). +CFLAGS+= -include freetype/ftsynth.h .endif + +# pkgtools/x11-links builds the shadow tree the X packages see: it tests +# ${X11BASE}/ and /usr/ and links what it finds. In a cross build +# both are this host's paths, so it took Debian's xorgproto headers and never +# produced Xrender.h -- fonts/Xft2 then stopped with "Xrender.h not found" +# although the file is in the sysroot (measured 2026-11-13: the farm in +# build/obj/destdir.amd64/usr/pkg/share/x11-links/include had 52 links, all to +# /usr/include, build/logs/userland-2026-11-13t.log:155). Pointed at the +# sysroot it finds the target's X, as it would on a NetBSD host, where +# /usr/X11R7 *is* the native X. +.if ${PKGPATH} == "pkgtools/x11-links" +X11BASE= ${CROSS_DESTDIR}/usr/X11R7 +.endif + +# X is the target's base (X11_TYPE=native, X11BASE=/usr/X11R7), and +# mk/x11.buildlink3.mk:31 hands that path to every GNU configure: +# --x-includes=/usr/X11R7/include --x-libraries=/usr/X11R7/lib. This host has no +# /usr/X11R7, and neither --sysroot nor the cwrappers make such an absolute -I +# resolve: the wrapper even rewrites it to the work directory's .x11-buildlink, +# which holds links to the host's X (see pkgtools/x11-links above). The "=" form +# is GCC's sysroot-relative path (-I=/usr/X11R7/include is /usr/X11R7/ +# include), and the wrapper passes it through untouched (measured 2026-11-13 in +# a work directory: ./cwrapper/bin/cc -c -I=/usr/X11R7/include compiles). +CPPFLAGS+= -I=${X11BASE}/include +LDFLAGS+= -L=${X11BASE}/lib diff --git a/tools/userland.sh b/tools/userland.sh index aa066a3a70..26a0c3dbfd 100755 --- a/tools/userland.sh +++ b/tools/userland.sh @@ -43,6 +43,11 @@ die() # pkgsrc's mk.conf holds the copy of tools/pkgsrc-cross.mk.conf that the # bootstrap made; the live file is included after it (plain assignments, so # twice is the same), and a change in the fragment needs no re-bootstrap. +# +# A change of CFLAGS/CPPFLAGS/LDFLAGS there does need a fresh work directory: +# configure records them in the package's Makefile, so a running work dir keeps +# the old flags (measured 2026-11-13: -include freetype/ftsynth.h took effect +# only after `bmake clean' in fonts/Xft2). ensure_mkconf() { mk=$TOP/build/pkg/etc/mk.conf