{"record":{"id":"9ca40b6757fb3fd4","repo":"nodejs/node","slug":"s-icu-config-not-found-fix-path-or-specify-o-o","errorCode":null,"errorMessage":"%s: icu-config not found. Fix PATH or specify -O option\\n","messagePattern":"(.+?): icu-config not found\\. Fix PATH or specify -O option\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deps/icu-small/source/tools/pkgdata/pkgdata.cpp","lineNumber":2185,"sourceCode":"        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))) {\n        if (!getPkgDataPath(icuconfigCmd, verbose, buf, UPRV_LENGTHOF(buf))) {\n            fprintf(stderr, \"%s: icu-config not found. Fix PATH or specify -O option\\n\", progname);\n            return -1;\n        }\n\n        pkgconfigIsValid = false;\n    }\n\n    for (int32_t length = strlen(buf) - 1; length >= 0; length--) {\n        if (buf[length] == '\\n' || buf[length] == ' ') {\n            buf[length] = 0;\n        } else {\n            break;\n        }\n    }\n\n    if (!*buf) {\n        fprintf(stderr, \"%s: Unable to locate pkgdata.inc. Unable to parse the results of '%s'. Check paths or use the -O option to specify the path to pkgdata.inc.\\n\", progname, pkgconfigIsValid ? pkgconfigCmd : icuconfigCmd);\n        return -1;\n    }","sourceCodeStart":2167,"sourceCodeEnd":2203,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/icu-small/source/tools/pkgdata/pkgdata.cpp#L2167-L2203","documentation":"Both probes used to locate pkgdata.inc failed: the pkg-config command did not yield a usable pkglibdir, and the fallback icu-config command also failed. pkg_getPkgDataPath returns -1. The message instructs fixing PATH or using the -O option to specify the path to pkgdata.inc directly.","triggerScenarios":"Neither 'pkg-config --variable=pkglibdir icu-uc' nor 'icu-config --incpkgdatafile' produced output. Both executables are missing from PATH, or popen is unavailable (U_HAVE_POPEN false), or ICU was never installed on the build host.","commonSituations":"Building against a source-only ICU checkout that was not 'make install'ed; cross-compile environments; stripped-down CI images without icu-dev tools; a PATH that excludes the ICU bin directory.","solutions":["Install ICU development tools (icu-config / libicu-dev / icu4c) and confirm 'icu-config --incpkgdatafile' prints a path.","Add ICU's bin directory to PATH.","Use the -O option to point pkgdata directly at pkgdata.inc (a.k.a. Makefile.inc).","If U_HAVE_POPEN is false on your platform, -O is mandatory."],"exampleFix":"# before: pkgdata cannot self-locate\npkgdata -p mypkg\n\n# after: supply the inc file explicitly\npkgdata -O /opt/icu/lib/icu-67/pkgdata.inc -p mypkg","handlingStrategy":"validation","validationCode":"# Make sure at least one locator is usable, else supply -O.\nif ! pkg-config --exists icu-uc && ! command -v icu-config >/dev/null; then\n  echo \"supply -O <path-to-pkgdata.inc>\"; exit 1\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install ICU dev tools (libicu-dev / icu4c) on the build host.","Add ICU's bin dir to PATH so icu-config is found.","Use -O to point at pkgdata.inc when auto-detection is impossible.","On popen-less platforms, always pass -O."],"tags":["icu","pkgdata","build-tool","configuration","pkg-config","icu-config"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}