nodejs/node · error

Error generating assembly code for data.

Error message

Error generating assembly code for data.

What it means

pkgdata failed to compile the generated assembly (.s) file into an object (.o) file and link it into a library. pkg_createWithAssemblyCode() (pkgdata.cpp:1510) builds a compiler command from pkgDataFlags[COMPILER] and pkgDataFlags[LIBFLAGS], invokes it via system(), then calls pkg_generateLibraryFile(). A non-zero return from any step triggers this message. The root cause is typically a misconfigured compiler path, incompatible assembler flags, or a linker failure.

Source

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

                if(o->verbose) {
                  fprintf(stdout, "# Generating assembly code %s of type %s ..\n", gencFilePath, genccodeAssembly);
                }
                
                /* Offset genccodeAssembly by 3 because "-a " */
                if (genccodeAssembly &&
                    (uprv_strlen(genccodeAssembly)>3) &&
                    checkAssemblyHeaderName(genccodeAssembly+3)) {
                    writeAssemblyCode(
                        datFileNamePath,
                        o->tmpDir,
                        o->entryName,
                        nullptr,
                        gencFilePath,
                        sizeof(gencFilePath));

                    result = pkg_createWithAssemblyCode(targetDir, mode, gencFilePath);
                    if (result != 0) {
                        fprintf(stderr, "Error generating assembly code for data.\n");
                        return result;
                    } else if (IN_STATIC_MODE(mode)) {
                      if(o->install != nullptr) {
                        if(o->verbose) {
                          fprintf(stdout, "# Installing static library into %s\n", o->install);
                        }
                        result = pkg_installLibrary(o->install, targetDir, noVersion);
                      }
                      return result;
                    }
                } else {
                    fprintf(stderr,"Assembly type \"%s\" is unknown.\n", genccodeAssembly);
                    return -1;
                }
            } else {
                if(o->verbose) {
                  fprintf(stdout, "# Writing object code to %s ..\n", gencFilePath);
                }

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Verify pkgDataFlags[COMPILER] points to a working C compiler: run the printed command manually and inspect the compiler's own error output.
  2. Check that pkgDataFlags[LIBFLAGS] contains flags valid for that compiler version.
  3. If cross-compiling, ensure the cross-compiler toolchain is installed and the GENCCODE_ASSEMBLY_TYPE matches the target (e.g. -a gcc for GNU as).
  4. Re-run ICU's configure so it regenerates the options file with the correct compiler and flags.

Example fix

// before: options file has stale compiler
//   CC=/usr/bin/cc-9
// after: regenerate after installing the toolchain
//   ./configure --with-cross-build=/path/to/build && make
// or manually fix the options file:
//   CC=gcc
//   LIBFLAGS=-m64
Defensive patterns

Strategy: validation

Validate before calling

// Before running pkgdata, verify the compiler exists and can assemble
#include <unistd.h>
#include <stdlib.h>

bool validateCompiler(const char* compiler) {
    // Check compiler is accessible
    if (access(compiler, X_OK) != 0) return false;
    // Test it can assemble a trivial file
    int rc = system("echo '.globl _test' > /tmp/_test.s && "
                    "cc -c -o /tmp/_test.o /tmp/_test.s 2>/dev/null");
    return rc == 0;
}

Prevention

When it happens

Trigger: Calling pkgdata in DLL or common mode with a non-empty GENCCODE_ASSEMBLY_TYPE flag, where the C compiler specified in the options file is missing, wrong, or rejects the generated assembly. The assembly file was successfully written by writeAssemblyCode() but the subsequent compiler invocation failed.

Common situations: Cross-compiling ICU data for a target architecture whose assembler syntax doesn't match the host compiler; using a stale or wrong Makefile.generated that sets CC/LIBFLAGS to a compiler not present in PATH; upgrading the system compiler to a version that changed inline assembly syntax.

Related errors


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