[Bug 298461] emulators/qemu-user-static-devel: does not build on FreeBSD 15 (undefined symbol __realpathat; keymap generation)

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 13 Sep 2026 22:34:17 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=298461

            Bug ID: 298461
           Summary: emulators/qemu-user-static-devel: does not build on
                    FreeBSD 15 (undefined symbol __realpathat; keymap
                    generation)
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: emulation@FreeBSD.org
          Reporter: rick@sloservers.com
          Assignee: emulation@FreeBSD.org
             Flags: maintainer-feedback?(emulation@FreeBSD.org)

Created attachment 274708
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=274708&action=edit
Fix build on FreeBSD 15: __realpathat symbol + skip keymap generation;
PORTREVISION 4 -> 5

emulators/qemu-user-static-devel (qemu 6.2.50, PORTREVISION 4) does not build
on
FreeBSD 15.1-RELEASE amd64. Two independent causes; the attached patch fixes
both
and bumps PORTREVISION to 5.

1) Link failure: undefined symbol __realpathat

    ld: error: undefined symbol: __realpathat
    >>> referenced by os-stat.h:705 (bsd-user/freebsd/os-stat.h:705)
    >>>              
libqemu-arm-bsd-user.fa.p/bsd-user_freebsd_os-syscall.c.o:(do_freebsd_realpathat)
    >>> did you mean: ___realpathat
    >>> defined in: /usr/lib/libc.a(___realpathat.o)

All seven targets fail identically (qemu-arm, qemu-aarch64, qemu-i386,
qemu-x86_64, qemu-ppc, qemu-ppc64, qemu-riscv64). Compilation is clean; only
the link fails.

bsd-user/freebsd/os-stat.h declares and calls __realpathat (two leading
underscores). libc spells it with three:

    $ nm -D /lib/libc.so.7 | grep realpathat
    00000000001443c0 W ___realpathat@@FBSDprivate_1.0
    00000000001443c0 T __sys___realpathat@@FBSDprivate_1.0

The kernel syscall is __realpathat; the libc wrapper prepends an underscore,
giving ___realpathat.

Note the change must stay scoped to os-stat.h: elsewhere the same string occurs
inside the macro TARGET_FREEBSD_NR___realpathat (os-syscall.c, syscall_nr.h,
strace.list), and a tree-wide substitution would break syscall dispatch.

One question for the maintainer: the block is already guarded by
__FreeBSD_version >= 1300080. If some version in that range genuinely exported
the two-underscore spelling, this wants a narrower version guard rather than a
rename. Only 15.1 was available to test on.

2) Build failure: pc-bios keymaps regenerated against current xkeyboard-config

Triggered whenever any qemu package is already installed:

    /usr/local/bin/qemu-keymap -f pc-bios/keymaps/ar -l ar
    xkbcommon: ERROR: [XKB-338] Couldn't find file "symbols/ar" in include
paths
    ninja: build stopped: subcommand failed.

meson locates qemu-keymap on PATH and picks up the binary from an unrelated
installed qemu (here qemu-11.0.2), using a version-11 tool to generate data for
a 6.2.50 build. The layout it requests no longer exists either:
xkeyboard-config
2.48 renamed the Arabic layout from "ar" to "ara".

This port configures --disable-system --disable-tools, so the keymaps are never
used. Upstream already handles the tool being absent by copying the
pre-generated keymaps from the source tree; the patch takes that path
unconditionally.

Reproduced with xkeyboard-config-2.48 and qemu-11.0.2 installed.

Validation

Clean room on 15.1-RELEASE-p2 amd64, stock invocation, no environment
overrides,
qemu-keymap left installed:

    cd /usr/ports/emulators/qemu-user-static-devel
    make clean
    make build

Result: 962/962 targets, all seven qemu-*-bsd-user binaries linked. The port
then installs, and qemu-arm-static reports "qemu-arm version 6.2.50" and
executes armv7 binaries correctly under binmiscctl. Each patch was also
verified
to apply with patch -p0 against a pristine extract.

Why this port matters: it is the only static user-mode emulator available for
cross-building packages with poudriere. emulators/qemu-user-static is pinned at
QEMU 3.1.0 (2018), and emulators/qemu-devel's STATIC_LINK option covers system
emulation rather than the user-mode binaries binmiscctl needs.

-- 
You are receiving this mail because:
You are the assignee for the bug.