nodejs/node · error

U_UNSUPPORTED_ERROR

U_UNSUPPORTED_ERROR

Error message

genccode: match-arch file %s is too short\n

What it means

On ELF platforms, after reading the match-arch file genccode requires at least sizeof(Elf32_Ehdr) bytes. If fewer were read the file is too short to be a valid ELF header and it exits U_UNSUPPORTED_ERROR (pkg_genc.cpp:911).

Source

Thrown at deps/icu-small/source/tools/toolutil/pkg_genc.cpp:911

#   else
#      error "Unknown platform for CAN_GENERATE_OBJECTS."
#   endif
#else
#   error "Unknown platform for CAN_GENERATE_OBJECTS."
#endif
        return;
    }

    in=T_FileStream_open(filename, "rb");
    if(in==nullptr) {
        fprintf(stderr, "genccode: unable to open match-arch file %s\n", filename);
        exit(U_FILE_ACCESS_ERROR);
    }
    length=T_FileStream_read(in, buffer.bytes, sizeof(buffer.bytes));

#ifdef U_ELF
    if (length < static_cast<int32_t>(sizeof(Elf32_Ehdr))) {
        fprintf(stderr, "genccode: match-arch file %s is too short\n", filename);
        exit(U_UNSUPPORTED_ERROR);
    }
    if(
        buffer.header32.e_ident[0]!=ELFMAG0 ||
        buffer.header32.e_ident[1]!=ELFMAG1 ||
        buffer.header32.e_ident[2]!=ELFMAG2 ||
        buffer.header32.e_ident[3]!=ELFMAG3 ||
        buffer.header32.e_ident[EI_CLASS]<ELFCLASS32 || buffer.header32.e_ident[EI_CLASS]>ELFCLASS64
    ) {
        fprintf(stderr, "genccode: match-arch file %s is not an ELF object file, or not supported\n", filename);
        exit(U_UNSUPPORTED_ERROR);
    }

    *pBits= buffer.header32.e_ident[EI_CLASS]==ELFCLASS32 ? 32 : 64; /* only 32 or 64: see check above */
#ifdef U_ELF64
    if(*pBits!=32 && *pBits!=64) {
        fprintf(stderr, "genccode: currently only supports 32-bit and 64-bit ELF format\n");
        exit(U_UNSUPPORTED_ERROR);

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Regenerate the reference object so it is a complete ELF .o.
  2. Confirm the file size is at least sizeof(Elf32_Ehdr) (52 bytes).
  3. Recheck that the path actually points to a compiled object, not a source/intermediate file.
Defensive patterns

Strategy: validation

Validate before calling

# ELF match-arch must be at least Elf32_Ehdr (52 bytes).
[ -r "$MATCHARCH" ] || exit 2
sz=$(stat -c %s "$MATCHARCH" 2>/dev/null || stat -f %z "$MATCHARCH")
[ "${sz:-0}" -ge 52 ] || { echo "match-arch too short to be ELF"; exit 2; }

Prevention

When it happens

Trigger: The --match-arch file is empty, truncated, or not an ELF object (e.g. a text file) so its size is below the ELF header minimum.

Common situations: Pointing --match-arch at a partially-written or zero-byte object; a stale/aborted compile artifact; the wrong file passed by mistake.

Related errors


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