nodejs/node · error · RuntimeError
Assembly failed: {asm_command}
Error message
Assembly failed: {asm_command} What it means
After preprocessing, if --assemble was requested, preprocess_asm.py invokes armasm64.exe to turn the cleaned .s text into a .obj. If armasm64 exits non-zero the script logs both stderr and stdout and raises RuntimeError with the assembler command, rather than writing a half-assembled object file.
Source
Thrown at deps/libffi/preprocess_asm.py:117
lines = result.stdout.splitlines(keepends=True)
cleaned_lines = [line for line in lines if not line.lstrip().startswith('#')]
cleaned = ''.join(cleaned_lines)
output.write_text(cleaned, encoding='utf-8')
# If --assemble is specified, also run the assembler to produce an object file
if args.assemble:
assemble_output = Path(normalize_path(args.assemble))
assemble_output.parent.mkdir(parents=True, exist_ok=True)
armasm64 = find_armasm64()
asm_command = [armasm64, '-nologo', '-g', str(output), '-o', str(assemble_output)]
asm_result = subprocess.run(asm_command, capture_output=True, text=True)
if asm_result.returncode != 0:
sys.stderr.write(asm_result.stderr)
sys.stderr.write(asm_result.stdout)
raise RuntimeError(f'Assembly failed: {" ".join(asm_command)}')
def main(argv=None):
parser = argparse.ArgumentParser(description='Preprocess libffi assembly source')
parser.add_argument('--input', required=True)
parser.add_argument('--output', required=True)
parser.add_argument('--include-dir', action='append', default=[])
parser.add_argument('--define', action='append', default=[])
parser.add_argument('--assemble', help='Also assemble the output to this object file')
args = parser.parse_args(argv)
preprocess(args)
return 0
if __name__ == '__main__':
raise SystemExit(main())
View on GitHub (pinned to 1b2de5e052)
Solutions
- Inspect the armasm64 stderr/stdout the script already wrote to find the offending line/instruction.
- Verify the preprocessed output (the --output file) is clean ARM assembly with no stray C directives.
- Match the armasm64 version to the ARM ISA the source targets (e.g. ARMv8.3 vs v8.0).
Example fix
# before: preprocessed output still has stray # line markers python preprocess_asm.py --input src.S --output out.s --assemble out.obj # after: regenerate clean preprocessed file, then assemble python preprocess_asm.py --input src.S --output out.s --include-dir include --assemble out.obj
Defensive patterns
Strategy: try-catch
Validate before calling
asm_result = subprocess.run(asm_command, capture_output=True, text=True)
if asm_result.returncode != 0:
raise SystemExit(f'armasm64 failed:\n{asm_result.stderr}{asm_result.stdout}') Try / catch
try:
preprocess(args)
except RuntimeError as e:
raise SystemExit(f'libffi assembly failed: {e}') from None Prevention
- Inspect the cleaned preprocessed output before assembling to catch stray directives.
- Pin the MSVC/armasm64 version to one matching the source's ARM ISA target.
When it happens
Trigger: Raised when `subprocess.run(asm_command, ...).returncode != 0` in the `if args.assemble:` branch. asm_command is [armasm64, '-nologo', '-g', <preprocessed file>, '-o', <object file>].
Common situations: Preprocessor left a directive armasm64 can't parse (stripping of '#' lines was incomplete); ARM syntax the toolchain version doesn't accept; wrong ARM toolchain major version; source file targets a different ARM ISA than the installed armasm64.
Related errors
- Unable to locate armasm64.exe
- Preprocessing failed: {command}
- Unsupported libffi target {os_name}/{target_arch}.
- Missing libffi target header: {ffitarget_src}
- Unsupported host platform {sys.platform!r}
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/96b8ca95052f084a.
Report an issue: GitHub.