nodejs/node · warning

Failed to compile %s\n

Error message

Failed to compile %s\n

What it means

In pkg_createOptMatchArch, after writing the probe source and forming a compiler command from pkgDataFlags[COMPILER], runCommand(cmd) returned non-zero — the compiler failed to produce the object file. The error names the source file; sprintf of obj into optMatchArch is skipped so architecture matching falls back. This is a non-fatal warning: the build continues but arch-specific matching is disabled.

Source

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

    const char* obj = "oma.obj";
    FileStream* stream = nullptr;

    stream = T_FileStream_open(source,"w");
    if (stream != nullptr) {
        T_FileStream_writeLine(stream, code);
        T_FileStream_close(stream);

        char cmd[LARGE_BUFFER_MAX_SIZE];
        snprintf(cmd, sizeof(cmd), "%s %s -o %s",
            pkgDataFlags[COMPILER],
            source,
            obj);

        if (runCommand(cmd) == 0){
            sprintf(optMatchArch, "%s", obj);
        }
        else {
            fprintf(stderr, "Failed to compile %s\n", source);
        }
        if(!T_FileStream_remove(source)){
            fprintf(stderr, "T_FileStream_remove failed to delete %s\n", source);
        }
    }
    else {
        fprintf(stderr, "T_FileStream_open failed to open %s for writing\n", source);
    }
#endif
}
static void pkg_destroyOptMatchArch(char *optMatchArch) {
    if(T_FileStream_file_exists(optMatchArch) && !T_FileStream_remove(optMatchArch)){
        fprintf(stderr, "T_FileStream_remove failed to delete %s\n", optMatchArch);
    }
}
#endif

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Check that the compiler in pkgDataFlags[COMPILER] is installed and on PATH.
  2. Regenerate pkgdata.inc (make install) so COMPILER matches the current toolchain.
  3. Run the exact cmd string printed in verbose mode manually to see the compiler's real error.
  4. If harmless, this warning can be ignored; arch-matching is optional.

Example fix

# before: stale pkgdata.inc points at clang
# verbose shows: Calling: clang -arch x86_64 probe.c -o probe.o (fails)

# after: regenerate inc with the installed compiler
make clean && make && make install  # rebuilds pkgdata.inc for current CC
Defensive patterns

Strategy: validation

Validate before calling

# Check that the compiler named in pkgdata.inc is runnable before pkgdata uses it.
cc=$(awk -F= '/^COMPILER/{gsub(/["\r\n]/,"",$2);print $2;exit}' pkgdata.inc 2>/dev/null)
command -v "$cc" >/dev/null 2>&1 || { echo "compiler $cc not found"; exit 1; }

Prevention

When it happens

Trigger: The C compiler named by pkgDataFlags[COMPILER] is missing, misconfigured, or rejected the probe source; pkgDataFlags (read from pkgdata.inc) are stale or for a different compiler; cross-compile CC not on PATH.

Common situations: Mixing compilers (e.g. pkgdata.inc generated by clang but cc is gcc); a toolchain not on PATH; incompatible compiler flags in the .inc file after an ICU upgrade.

Related errors


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