Skip to content

0.15.0 fails to build on FreeBSD: use of undeclared identifier 'pty_close_inherited_fds' #116

Open

Description

@NorthernMan54

Summary

@homebridge/node-pty-prebuilt-multiarch@0.15.0 doesn't compile on FreeBSD. There are no FreeBSD prebuilds, so the install always builds from source, and that build fails:

../src/unix/pty.cc:477:7: error: use of undeclared identifier 'pty_close_inherited_fds'
  477 |       pty_close_inherited_fds();
1 error generated.
gmake: *** [pty.target.mk:117: Release/obj.target/pty/src/unix/pty.o] Error 1

Reported by @ssb-kod in homebridge/homebridge#4040 (comment), which has the full logs.

Cause

This comes from upstream. microsoft/node-pty#867 added pty_close_inherited_fds() and its helper SetCloseOnExec(), defined only on Linux, but the code that calls them runs on every platform except macOS:

  • pty.cc:115: the definitions are inside #if defined(__linux__)
  • pty.cc:418: the #else branch of #if defined(__APPLE__) starts here
  • pty.cc:477: the call, with no platform guard of its own

As of 2026-11-04 upstream main still has this, and it's tracked in microsoft/node-pty#962. src/unix/pty.cc on our main is identical to v0.15.0.

Impact

homebridge-config-ui-x 5.30.0 pins this package at 0.15.0, so updating the UI on FreeBSD fails. The reporter's FreeBSD 15.1 install can't move past UI 5.27.0, which pins 0.13.1 and builds fine on the same machine.

Environment

  • FreeBSD 15.1-RELEASE-p6 jail, x64
  • Node 24.22.1, node-gyp 13.0.0 (npm's bundled copy) and 13.1.0 (global)
  • homebridge-config-ui-x 5.30.0, updating from the web UI and from the reporter's install script

Fix

microsoft/node-pty#961 fixes this upstream. As of 2026-11-04 it's open and awaiting review. Its author reports a clean build and a working shell spawn on FreeBSD 15.1-RC2.

We can either wait for that PR to merge and sync it here, or apply the same change here in the meantime. It only covers FreeBSD, so OpenBSD would still fail to build (not tested).

Suggestion: add FreeBSD as a build target

Once the fix is in, add FreeBSD x64 to the build matrix in Stage 1 - Prebuilds - Publish.yml and ship prebuilds/freebsd-x64. 0.15.0 ships Linux, macOS and Windows prebuilds only, so FreeBSD users always compile from source.

  • FreeBSD installs would no longer need a compiler toolchain. scripts/prebuild.js already looks for prebuilds/freebsd-x64, as the reporter's log shows.
  • A build error like this one would be caught before release rather than by users.
  • GitHub has no hosted FreeBSD runners, so the job would need to run in a FreeBSD VM on a Linux runner.

Workaround

Stay on homebridge-config-ui-x@5.27.0.

Activity

  1. self-assigned this
    on Nov 4, 2026
  2. ssb-kod commented on Nov 7, 2026

    @ssb-kod

    Latest freebsd homebridge install script version has a patch starting at line 78 to install v5.30.0 now. Not sure if that code would be useful to you all. (https://github.com/ssb-kod/freebsd-homebridge-iocage-install/blob/main/freebsd-homebridge-install.sh )
    Patch written in by Claude after being directed to the microsoft#962 discovered by NorthernMan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions