nodejs/node · error

%s: Error calling '%s'\n

Error message

%s: Error calling '%s'\n

What it means

In the getPkgDataPath helper used to locate pkgdata.inc, popen() of the probe command returned null, or fread() returned <=0 bytes. The function prints the program name and the failed command, zeroes the buffer, and returns false. This is the low-level failure behind both the icu-config-not-found and pkgdata.inc-not-found errors.

Source

Thrown at deps/icu-small/source/tools/pkgdata/pkgdata.cpp:2165

    } /* for each file list file */
}

/* Helper for pkg_getPkgDataPath() */
#if U_HAVE_POPEN
static UBool getPkgDataPath(const char *cmd, UBool verbose, char *buf, size_t items) {
    icu::CharString cmdBuf;
    UErrorCode status = U_ZERO_ERROR;
    icu::LocalPipeFilePointer p;
    size_t n;

    cmdBuf.append(cmd, status);
    if (verbose) {
        fprintf(stdout, "# Calling: %s\n", cmdBuf.data());
    }
    p.adoptInstead( popen(cmdBuf.data(), "r") );

    if (p.isNull() || (n = fread(buf, 1, items-1, p.getAlias())) <= 0) {
        fprintf(stderr, "%s: Error calling '%s'\n", progname, cmd);
        *buf = 0;
        return false;
    }

    return true;
}
#endif

/* Get path to pkgdata.inc. Try pkg-config first, falling back to icu-config. */
static int32_t pkg_getPkgDataPath(UBool verbose, UOption *option) {
#if U_HAVE_POPEN
    static char buf[512] = "";
    UBool pkgconfigIsValid = true;
    const char *pkgconfigCmd = "pkg-config --variable=pkglibdir icu-uc";
    const char *icuconfigCmd = "icu-config --incpkgdatafile";
    const char *pkgdata = "pkgdata.inc";

    if (!getPkgDataPath(pkgconfigCmd, verbose, buf, UPRV_LENGTHOF(buf))) {

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Ensure pkg-config is installed and on PATH (which pkg-config).
  2. Set PKG_CONFIG_PATH to the prefix where ICU's .pc files live.
  3. If pkg-config is unavailable, put icu-config on PATH or use the -O option to point directly at pkgdata.inc.
  4. On platforms without popen, supply the path explicitly via -O.

Example fix

# before: pkg-config not found by pkgdata
pkgdata -p mypkg

# after: tell pkg-config where ICU is
export PKG_CONFIG_PATH=/opt/icu/lib/pkgconfig
pkgdata -p mypkg
# or bypass entirely:
pkgdata -O /opt/icu/lib/icu/Makefile.inc -p mypkg
Defensive patterns

Strategy: validation

Validate before calling

# Confirm the probe commands pkgdata will run actually work before invoking it.
command -v pkg-config >/dev/null || command -v icu-config >/dev/null || { echo "no probe tool on PATH"; exit 1; }
pkg-config --variable=pkglibdir icu-uc >/dev/null 2>&1 || icu-config --incpkgdatafile >/dev/null 2>&1 || { echo "probes empty"; exit 1; }

Prevention

When it happens

Trigger: popen fails when /bin/sh is unavailable or the process limit is hit; fread returns 0 when the command (pkg-config or icu-config) is absent from PATH, exits non-zero, or prints nothing. Compile guarded by #if U_HAVE_POPEN, so it never runs on platforms without popen.

Common situations: Cross-compiling where pkg-config/icu-config for the target are not on the build host PATH; a minimal build container lacking pkg-config; ICU installed in a non-standard prefix not reflected in PKG_CONFIG_PATH.

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/b6823d880c0382b8. Report an issue: GitHub.