sharp icon indicating copy to clipboard operation
sharp copied to clipboard

AMD Turion II Neo N54L, Illegal instruction (core dumped)

Open Ben2303 opened this issue 3 years ago • 6 comments

Possible install-time or require-time problem

  • [x] I have read the documentation relating to installation.
  • [x] I have ensured that the architecture and platform of Node.js used for npm install is the same as the architecture and platform of Node.js used at runtime.

Are you using the latest version of sharp?

  • [x] I am using the latest version of sharp as reported by npm view sharp dist-tags.latest.

If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.

If you are using another package which depends on a version of sharp that is not the latest, please open an issue against that package instead.

Is this a problem with filesystem permissions?

If you are using npm v7 or later, does the user running npm install own the directory it is run in? yes

If you are using the ignore-scripts feature of npm, have you tried with the npm install --ignore-scripts=false flag?

What is the complete output of running npm install --verbose --foreground-scripts sharp in an empty directory?

npm verb cli /usr/local/bin/node /usr/local/bin/npm npm info using [email protected] npm info using [email protected] npm verb title npm install sharp npm verb argv "install" "--loglevel" "verbose" "--foreground-scripts" "sharp" npm verb logfile logs-max:10 dir:/root/.npm/_logs/2023-07-28T07_26_47_798Z- npm verb logfile /root/.npm/_logs/2023-07-28T07_26_47_798Z-debug-0.log npm http fetch GET 200 https://registry.npmjs.org/sharp 376ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/color 78ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/tunnel-agent 190ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/detect-libc 208ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/simple-get 221ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/tar-fs 226ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/node-addon-api 234ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/prebuild-install 240ms (cache miss) npm http fetch GET 200 https://registry.npmjs.org/semver 243ms (cache miss) npm verb stack TypeError: Cannot read properties of null (reading 'matches') npm verb stack at Link.matches (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/node.js:1115:41) npm verb stack at Link.canDedupe (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/node.js:1069:15 ) npm verb stack at PlaceDep.pruneDedupable (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/place- dep.js:426:14) npm verb stack at new PlaceDep (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/place-dep.js:278: 14) npm verb stack at #buildDepStep (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-i deal-tree.js:933:18) npm verb stack at async Arborist.buildIdealTree (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/ arborist/build-ideal-tree.js:196:7) npm verb stack at async Promise.all (index 1) npm verb stack at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/ reify.js:159:5) npm verb stack at async Install.exec (/usr/local/lib/node_modules/npm/lib/commands/install.js:147:5) npm verb stack at async module.exports (/usr/local/lib/node_modules/npm/lib/cli.js:89:5) npm verb cwd /app npm verb Linux 5.15.0-78-generic npm verb node v20.2.0 npm verb npm v9.6.6 npm ERR! Cannot read properties of null (reading 'matches') npm verb exit 1 npm verb unfinished npm timer reify 1690529208407 npm verb unfinished npm timer reify:loadTrees 1690529208417 npm verb unfinished npm timer idealTree:buildDeps 1690529215766 npm verb unfinished npm timer idealTree:node_modules/sharp 1690529216473 npm verb code 1

npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-07-28T07_26_47_798Z-debug-0.log

What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?

  System:
    OS: Linux 5.15 Alpine Linux
    CPU: (2) x64 AMD Turion(tm) II Neo N54L Dual-Core Processor
    Memory: 5.19 GB / 7.63 GB
    Container: Yes
    Shell: 1.36.0 - /bin/ash
  Binaries:
    Node: 20.2.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.6.6 - /usr/local/bin/npm
    pnpm: 8.6.10 - /usr/local/bin/pnpm
  npmPackages:
    sharp: ^0.32.4 => 0.32.4

Ben2303 avatar Jul 28 '23 07:07 Ben2303

(gdb) run -e "require('sharp')"
Starting program: /usr/local/bin/node -e "require('sharp')"
warning: Error disabling address space randomization: Operation not permitted
[New LWP 383]
[New LWP 384]
[New LWP 385]
[New LWP 386]
[New LWP 387]
[New LWP 388]

Thread 1 "node" received signal SIGILL, Illegal instruction.
0x00007f7703750363 in ?? ()
   from /app/node_modules/.pnpm/[email protected]/node_modules/sharp/build/Release/../.././vendor/8.14.3/linuxmusl-x64/lib/l
ibvips-cpp.so.42

Ben2303 avatar Jul 28 '23 07:07 Ben2303

I've got another user that has the same issue using an amd phenom ii x6 processor.

Alfagun74 avatar Jul 28 '23 08:07 Alfagun74

https://sharp.pixelplumbing.com/install#prebuilt-binaries

Linux x64 (glibc >= 2.17, musl >= 1.1.24, CPU with SSE4.2)

The AMD Turion II Neo N54L CPU is from 2010 and does not provide SSE4.2 intrinsics.

See also https://github.com/lovell/sharp/issues/2723

lovell avatar Jul 28 '23 09:07 lovell

@lovell

I wanted to make sure older systems remain compatible with my app while using the latest version of sharp in the package.json by enforcing the use of another sharp binary through an environment variable and the various builds on your release page.

But based on my reading on https://sharp.pixelplumbing.com/install#custom-prebuilt-binaries, it automatically appends the package version to the URL instead of allowing you to force a particular version. So, I either downgrade sharp for all of my users, or, what I actually wanted: tell them to set an environment variable, and it magically works for them because it uses a specific version.

Is there a simple way to address this issue specifically only for users with older CPUs? Also, have you considered integrating a compatibility mode directly into the library so it runs on older hardware? Because i doubt one would upgrade it solely to compress his images.

Also, what is the latest version of sharp that supports non SSE4.2 CPUs?

Alfagun74 avatar Jul 28 '23 10:07 Alfagun74

sharp will always look for and use a globally-installed libvips at install time e.g. via most Linux package managers - https://sharp.pixelplumbing.com/install#custom-libvips

As you've seen, you can also build and provide your own custom binaries. All the scripts to do this are open source and available at https://github.com/lovell/sharp-libvips

lovell avatar Jul 28 '23 12:07 lovell

I hope this information helped. Please feel free to re-open with more details if further assistance is required.

lovell avatar Jul 31 '23 08:07 lovell