{"record":{"id":"3df01fc08a0e4a42","repo":"nodejs/node","slug":"unsupported-libffi-target-os-name-target-arch","errorCode":null,"errorMessage":"Unsupported libffi target {os_name}/{target_arch}.","messagePattern":"Unsupported libffi target (.+?)/(.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"deps/libffi/generate-headers.py","lineNumber":64,"sourceCode":"\n    if target_arch == 'loong64':\n        return ('LOONGARCH64', 'loongarch')\n\n    if target_arch in ('mips', 'mipsel', 'mips64el'):\n        if os_name in ('freebsd', 'linux', 'openbsd'):\n            return ('MIPS', 'mips')\n\n    if target_arch == 'ppc64':\n        if os_name == 'aix':\n            return ('POWERPC_AIX', 'powerpc')\n        if os_name == 'mac':\n            return ('POWERPC_DARWIN', 'powerpc')\n        if os_name in ('freebsd', 'openbsd'):\n            return ('POWERPC_FREEBSD', 'powerpc')\n        if os_name == 'linux':\n            return ('POWERPC', 'powerpc')\n\n    raise ValueError(f'Unsupported libffi target {os_name}/{target_arch}.')\n\n\ndef has_long_double(os_name, target_arch):\n    target_arch = normalize_arch(target_arch)\n\n    if os_name == 'win':\n        return '0'\n\n    if os_name == 'mac' and target_arch == 'arm64':\n        return '0'\n\n    if target_arch == 'arm':\n        return '0'\n\n    return '1'\n\n\ndef uses_exec_trampoline_table(os_name, target_arch):","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/libffi/generate-headers.py#L46-L82","documentation":"libffi's generate-headers.py maps an (os_name, target_arch) pair to a preprocessor define and a source subdirectory (e.g. X86_64/x86_64). get_target() has explicit branches for the supported platforms/arches; any combination not listed falls through to this ValueError, signalling that no ffitarget header template exists for that target.","triggerScenarios":"Raised at the end of get_target() when target_arch is not one of x86/x86_64/arm/arm64/mips/mipsel/... or when a known arch is paired with an unsupported os_name (e.g. ppc64 only handled for aix/mac/freebsd/openbsd/linux).","commonSituations":"Cross-compiling for an architecture libffi's bundled headers don't ship (riscv, s390x, loongarch); exotic os/arch matrix cells in CI; a typo in --target-arch or an alias the normalizer doesn't recognize.","solutions":["Confirm the (os, arch) pair is one libffi supports in get_target(); pick the closest supported target.","If you must build for an unsupported arch, vendor the missing ffitarget.h template and extend get_target().","Check that --target-arch / TARGET_ARCH env uses a recognized alias (x64 not 'amd64-intel')."],"exampleFix":"# before\npython generate-headers.py --output-dir out --target-arch riscv64 --os linux\n# after\npython generate-headers.py --output-dir out --target-arch x86_64 --os linux","handlingStrategy":"type-guard","validationCode":"SUPPORTED = {('linux','x86_64'),('linux','arm64'),('mac','arm64'),('win','x86_64')}\nassert (os_name, target_arch) in SUPPORTED, f'unsupported libffi target {os_name}/{target_arch}'","typeGuard":"def is_supported_libffi_target(os_name, target_arch):\n    pairs = {('linux','x86'),('linux','x86_64'),('linux','arm'),('linux','arm64'),\n             ('mac','x86_64'),('mac','arm64'),('win','x86'),('win','x86_64'),\n             ('freebsd','x86_64'),('aix','ppc64')}\n    return (os_name, target_arch) in pairs","tryCatchPattern":null,"preventionTips":["Keep a project-level matrix of supported (os,arch) cells and validate builds against it.","Normalize target_arch through the same alias map libffi uses before invoking generate-headers.py."],"tags":["libffi","build","ffi","cross-compile","platform"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}