{"record":{"id":"b6823d880c0382b8","repo":"nodejs/node","slug":"s-error-calling-s-n","errorCode":null,"errorMessage":"%s: Error calling '%s'\\n","messagePattern":"(.+?): Error calling '(.+?)'\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/icu-small/source/tools/pkgdata/pkgdata.cpp","lineNumber":2165,"sourceCode":"    } /* for each file list file */\n}\n\n/* Helper for pkg_getPkgDataPath() */\n#if U_HAVE_POPEN\nstatic UBool getPkgDataPath(const char *cmd, UBool verbose, char *buf, size_t items) {\n    icu::CharString cmdBuf;\n    UErrorCode status = U_ZERO_ERROR;\n    icu::LocalPipeFilePointer p;\n    size_t n;\n\n    cmdBuf.append(cmd, status);\n    if (verbose) {\n        fprintf(stdout, \"# Calling: %s\\n\", cmdBuf.data());\n    }\n    p.adoptInstead( popen(cmdBuf.data(), \"r\") );\n\n    if (p.isNull() || (n = fread(buf, 1, items-1, p.getAlias())) <= 0) {\n        fprintf(stderr, \"%s: Error calling '%s'\\n\", progname, cmd);\n        *buf = 0;\n        return false;\n    }\n\n    return true;\n}\n#endif\n\n/* Get path to pkgdata.inc. Try pkg-config first, falling back to icu-config. */\nstatic int32_t pkg_getPkgDataPath(UBool verbose, UOption *option) {\n#if U_HAVE_POPEN\n    static char buf[512] = \"\";\n    UBool pkgconfigIsValid = true;\n    const char *pkgconfigCmd = \"pkg-config --variable=pkglibdir icu-uc\";\n    const char *icuconfigCmd = \"icu-config --incpkgdatafile\";\n    const char *pkgdata = \"pkgdata.inc\";\n\n    if (!getPkgDataPath(pkgconfigCmd, verbose, buf, UPRV_LENGTHOF(buf))) {","sourceCodeStart":2147,"sourceCodeEnd":2183,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/pkgdata/pkgdata.cpp#L2147-L2183","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure pkg-config is installed and on PATH (which pkg-config).","Set PKG_CONFIG_PATH to the prefix where ICU's .pc files live.","If pkg-config is unavailable, put icu-config on PATH or use the -O option to point directly at pkgdata.inc.","On platforms without popen, supply the path explicitly via -O."],"exampleFix":"# before: pkg-config not found by pkgdata\npkgdata -p mypkg\n\n# after: tell pkg-config where ICU is\nexport PKG_CONFIG_PATH=/opt/icu/lib/pkgconfig\npkgdata -p mypkg\n# or bypass entirely:\npkgdata -O /opt/icu/lib/icu/Makefile.inc -p mypkg","handlingStrategy":"validation","validationCode":"# Confirm the probe commands pkgdata will run actually work before invoking it.\ncommand -v pkg-config >/dev/null || command -v icu-config >/dev/null || { echo \"no probe tool on PATH\"; exit 1; }\npkg-config --variable=pkglibdir icu-uc >/dev/null 2>&1 || icu-config --incpkgdatafile >/dev/null 2>&1 || { echo \"probes empty\"; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep pkg-config (or icu-config) on PATH.","Set PKG_CONFIG_PATH to the ICU install prefix.","If neither is available, pass -O <pkgdata.inc> explicitly.","Confirm U_HAVE_POPEN is enabled on the platform (else -O is required)."],"tags":["icu","pkgdata","build-tool","configuration","popen","pkg-config"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}