Skip to content

Support for non-AVX CPUs with musl #1117

@7185

Description

@7185

Overview

Version 0.1.78 no longer seems to support non-AVX CPUs with musl.

I'm getting an Illegal Instruction error on my Intel Atom C2338 in a node:alpine docker image. I'm unable to reproduce this error directly on the Debian 12 host (glibc) running the container though (same with the node:slim image).

Here are my cpu flags:

flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 movbe popcnt tsc_deadline_timer aes rdrand lahf_lm 3dnowprefetch cpuid_fault epb pti ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid tsc_adjust smep erms dtherm arat md_clear

Steps to reproduce

% sudo docker run -it node:22-alpine sh
/ # mkdir test && cd test && npm init -y
Wrote to /test/package.json:

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}



npm notice
npm notice New major version of npm available! 10.9.3 -> 11.6.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.6.0
npm notice To update run: npm install -g npm@11.6.0
npm notice
/test # npm i @napi-rs/canvas@0.1.77

added 2 packages, and audited 3 packages in 6s

found 0 vulnerabilities
/test # node
Welcome to Node.js v22.19.0.
Type ".help" for more information.
> require('@napi-rs/canvas')
{
  clearAllCache: [Function: clearAllCache],
  Canvas: [class Canvas],
  createCanvas: [Function: createCanvas],
  Path2D: [Function: Path],
  ImageData: [Function: ImageData],
  Image: [Function: Image],
  PathOp: {
    Difference: 0,
    Intersect: 1,
    Union: 2,
    Xor: 3,
    ReverseDifference: 4
  },
  FillType: { Winding: 0, EvenOdd: 1, InverseWinding: 2, InverseEvenOdd: 3 },
  StrokeCap: { Butt: 0, Round: 1, Square: 2 },
  StrokeJoin: { Miter: 0, Round: 1, Bevel: 2 },
  SvgExportFlag: { ConvertTextToPaths: 1, NoPrettyXML: 2, RelativePathEncoding: 4 },
  GlobalFonts: {
    register: [Function: register],
    registerFromPath: [Function: registerFromPath],
    getFamilies: [Function: getFamilies],
    loadSystemFonts: [Function: loadSystemFonts],
    loadFontsFromDir: [Function: loadFontsFromDir],
    setAlias: [Function: setAlias],
    remove: [Function: remove]
  },
  convertSVGTextToPath: [Function: convertSVGTextToPath],
  DOMPoint: [class DOMPoint],
  DOMMatrix: [class DOMMatrix],
  DOMRect: [class DOMRect],
  loadImage: [AsyncFunction: loadImage],
  FontKey: [Function: FontKey],
  CanvasElement: [Function: CanvasElement],
  SVGCanvas: [Function: SVGCanvas]
}
> 
/test # npm i @napi-rs/canvas@0.1.78

changed 2 packages, and audited 3 packages in 5s

found 0 vulnerabilities
/test # node
Welcome to Node.js v22.19.0.
Type ".help" for more information.
> require('@napi-rs/canvas')
Illegal instruction (core dumped)

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions