8.8 KiB
Cross-build workarounds for pkgsrc on a non-NetBSD host
Status: 2026-11-14. This documents settings that make make userland
(tools/userland.sh, cross mode on a host where uname -s != NetBSD) work
against the target sysroot/toolchain produced by this tree. It is not a
contract; it records measured causes and what must be true before a workaround
can be removed.
Rules: pkgsrc/ is not patched (pkgsrc/AGENTS.md, root AGENTS.md), so
cross-only or host-specific fixes live in tools/pkgsrc-cross.mk.conf (or in
our forks under ext/ when the source itself is wrong). Every statement below
cites a commit, a log path, or file:line in this tree.
Where the settings live
tools/pkgsrc-cross.mk.conf— pkgsrc cross mk fragment (included by the bootstrap mk.conf; seetools/userland.shensure_mkconf).- Work dirs keep configured flags; after changing the fragment, work dirs must
be cleaned/reconfigured (
tools/userland.shensure_mk_key, keybuild/pkgsrc-work/.makronix-mk-key;tasksd t0168).
Workarounds added 2026-11-13 (task t0169)
The four settings below were introduced together in commit 4facdf5c9b
(2026-11-13, "userland cross: the target's X is reachable to the compiler, and
libXft's missing prototype is brought in"). Commit message evidence cites
build/logs/userland-2026-11-13t.log, build/logs/xft2-single*.log, and
build/logs/xft2-single4-2026-11-13.log (exit 0 for fonts/Xft2 after fixes).
1. fonts/Xft2: USE_LANGUAGES+= c c++
- Setting:
tools/pkgsrc-cross.mk.conf:130-131.if ${PKGPATH} == "fonts/Xft2"/USE_LANGUAGES+= c c++
- Cause: libXft 2.1.7 runs
AC_PROG_CXXthough it is a C package and does not listc++inUSE_LANGUAGES. For languages a package does not ask for, pkgsrc installs its fail-wrapper (mk/compiler.mk:380, per in-file comment), so the probe failed ("GNU C++ compiler... no", then "C++ preprocessor "cpp" fails sanity check") and configure stopped.cmust remain because the recipe'sUSE_LANGUAGESwas empty in that context; withoutcpkgsrc also wrapsccand the C preprocessor probe fails the same way. - Evidence:
tools/pkgsrc-cross.mk.conf:120-129citesbuild/logs/userland-2026-11-13r.log:1521, Xft2config.log:314-318(PKGSRC-WARNING), andbuild/logs/userland-2026-11-13s.log:88; commit4facdf5c9b. - Native impact: possible on any host/build where pkgsrc's fail-wrapper is
applied the same way for this recipe/configure behavior; needs verification
on a native Makronix/NetBSD build before moving into a fork recipe (decision
with Konrad, task
t0169item 2). - Removal criteria:
fonts/Xft2configures/builds without forcingc c++in cross and native modes (or the fix belongs in the recipe/fork if package-specific and not cross-only), with logs showingAC_PROG_CXX/cpp sanity checks succeeding.
2. fonts/Xft2: CFLAGS+= -include freetype/ftsynth.h
- Setting:
tools/pkgsrc-cross.mk.conf:132-140CFLAGS+= -include freetype/ftsynth.h
- Cause: libXft 2.1.7 calls
FT_GlyphSlot_Embolden(xftglyphs.c:177) without a declaration in scope after FreeType droppedFT_SYNTHESIS_Hfromft2build.h. Configure found the symbol in the library instead of the header (config.log:1033 ac_cv_func_FT_GlyphSlot_Embolden=yes), and GCC 14 treats implicit declaration as an error. - Evidence:
tools/pkgsrc-cross.mk.conf:132-139citesbuild/logs/xft2-single2-2026-11-13.log:316and states the declaration is in<freetype/ftsynth.h>(measured: compiles with-include freetype/ftsynth.h); commit4facdf5c9b. - Native impact: this is a source/GCC-14 compatibility issue, not
inherently cross-only; likely affects any GCC 14 build of this
fonts/Xft2version. Taskt0169item 2/3: verify native impact and decide whether the fix belongs in a fork/recipe patch vs cross config; consider separating general GCC-14 hardening work. - Removal criteria: package builds without the forced include on the supported compilers/hosts (or equivalent fix is carried in the appropriate recipe/fork), evidenced by build logs.
3. pkgtools/x11-links: X11BASE=${CROSS_DESTDIR}/usr/X11R7
- Setting:
tools/pkgsrc-cross.mk.conf:158-168.if ${PKGPATH} == "pkgtools/x11-links"/X11BASE=${CROSS_DESTDIR}/usr/X11R7
- Cause:
x11-linksprobes${X11BASE}/<file>and/usr/<file>to build its shadow tree. In a cross build those resolved to host paths, so it linked host (Debian) xorgproto headers and did not produceXrender.h;fonts/Xft2then failed withXrender.h not founddespite the file existing in the target sysroot. - Evidence: commit
4facdf5c9bcitesbuild/logs/userland-2026-11-13t.log:155;tools/pkgsrc-cross.mk.conf:158-165cites measured farm state inbuild/obj/destdir.amd64/usr/pkg/share/x11-links/include(52 links, all to/usr/include). Pointing at${CROSS_DESTDIR}/usr/X11R7makes it find the target X as on a NetBSD host where/usr/X11R7is native. - Native impact: cross-only in intent (host path leakage during cross
build). A native NetBSD/Makronix build should use its own
/usr/X11R7. - Removal criteria: cross build of
pkgtools/x11-linksproduces a correct target-only shadow tree without overridingX11BASEto the sysroot, with no links outside${CROSS_DESTDIR}and no missing headers required by dependent packages (see alsotools/check-x11-links.sh,tasksd t0167).
4. Global X include/lib paths: CPPFLAGS+= -I=${X11BASE}/include, LDFLAGS+= -L=${X11BASE}/lib
- Setting:
tools/pkgsrc-cross.mk.conf:179-189CPPFLAGS+= -I=${X11BASE}/includeLDFLAGS+= -L=${X11BASE}/lib
- Cause: X is target base (
X11_TYPE=native,X11BASE=/usr/X11R7) andmk/x11.buildlink3.mk:31passes absolute configure flags (--x-includes=/usr/X11R7/include --x-libraries=/usr/X11R7/lib). On a non-NetBSD cross host those absolute paths do not resolve into the sysroot;--sysrootand cwrappers did not fix it (wrappers rewrote paths into the work.x11-buildlinkshadow tree of host X). GCC's sysroot-relative=form (-I=/...,-L=/...) is resolved against<sysroot>and passed through by wrappers. - Evidence: commit
4facdf5c9bandtools/pkgsrc-cross.mk.conf:179-188cite measurement in a work directory (./cwrapper/bin/cc -c -I=/usr/X11R7/includecompiles) and reference thex11-linkshost-shadow issue above. - Native impact: intended for cross builds on non-NetBSD hosts; on native
builds absolute
/usr/X11R7paths are normally correct. Needs confirmation that native behavior is unaffected (or scope-guard if necessary) — taskt0169item 2. - Removal criteria: cross GNU-configure/pkgsrc X builds resolve target X headers/libs correctly without global sysroot-relative overrides (e.g. if cwrappers/sysroot handling is fixed upstream or in our config), evidenced by successful builds and no host-X leakage.
Additional cross-build settings currently present (observed 2026-11-14)
These are in tools/pkgsrc-cross.mk.conf now and affect cross builds, but were
not listed as the original four items in tasksd t0169; they should be reviewed
and either folded into this document's evidence/removal criteria or split into
follow-up tasks:
tools/pkgsrc-cross.mk.conf:143-156—cross/cross-libtool-base:CONFIGURE_ARGS+= --with-sysroot=${CROSS_DESTDIR}(commit-era rationale in comments; citesbuild/logs/userland-2026-11-14e.log,build/logs/mcde-single-2026-11-14.log).tools/pkgsrc-cross.mk.conf:171-177—PREPEND_PATH+= ${TOOLDIR}/binfor ksh93/bin/package finding$CCby name in cross builds (citesbuild/logs/userland-2026-11-14c.log:5299).
Related changes (not mk.conf workarounds)
- Commit
719967a4ee(2026-11-13,tools/pkglist.sh): narrowed "built" set (set+repo, not fetched games) to avoid host-tools stage building unnecessary tool chains; evidencebuild/logs/userland-2026-11-13o.log:5,61. - Commit
6c2d627ae3(2026-11-13,ext/src/mcde/motif/config/util/makestrs.c): GCC 14 incompat-pointer-types fix in MCDE Motif fork source (not a pkgsrc cross-mk workaround); evidencebuild/logs/userland-2026-11-13u.log:1267-1313. This is a candidate for "general GCC-14 hardening" tracking (t0169item 3).
Open questions / decisions (Konrad)
- Which of the
fonts/Xft2fixes (1,2) also apply to native builds, and should they move into a fork/recipe instead of global cross config? - Should global
CPPFLAGS/LDFLAGSsysroot-relative overrides be scoped more narrowly if they affect native builds? - Whether to add this documentation link/summary into
docs/BUILD-CONTRACT.mdrequires user request (docs/AGENTS.md: BUILD-CONTRACT changed only when the user asks).