Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't install on linux/arm64 with docker node #2482

Closed
gpetrov opened this issue Dec 12, 2020 · 21 comments
Closed

Can't install on linux/arm64 with docker node #2482

gpetrov opened this issue Dec 12, 2020 · 21 comments

Comments

@gpetrov
Copy link

gpetrov commented Dec 12, 2020

Trying to run a simple Dockerfile to install node together with sharp on linux/arm64 fails.

FROM node:14-slim

RUN npm i detect-libc

RUN node -e "console.log('platform=' + process.platform);console.log('arch='+process.arch);console.log(require('detect-libc'))"

RUN npm i sharp

when ran on arm64 - it produces:

> [4/4] RUN npm i sharp:                                                                                                                                                                                     
#8 3.664                                                                                                                                                                                                      
#8 3.664 > [email protected] install /node_modules/sharp                                                                                                                                                           
#8 3.664 > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)                                                                                 
#8 3.664                                                                                                                                                                                                      
#8 3.736 ERR! sharp Use with glibc 2.24 requires manual installation of libvips >= 8.10.0
#8 3.736 info sharp Attempting to build from source via node-gyp but this may fail due to the above error
#8 3.736 info sharp Please see https://sharp.pixelplumbing.com/install for required dependencies
#8 3.789 gyp ERR! find Python 

while the arch checks gives:

platform=linux
arch=arm64
{
  GLIBC: 'glibc',
  MUSL: 'musl',
  family: 'glibc',
  version: '2.24',
  method: 'getconf',
  isNonGlibcLinux: false
}

There are already prebuild libvips images for arm64v8 - why aren't they used?

Running the same on Windows 10, goes actually just fine. While the arch checks is there pretty much the same:

Step 3/4 : RUN node -e "console.log('platform=' + process.platform);console.log('arch='+process.arch);console.log(require('detect-libc'))"
 ---> Running in 4c7db816aa17
platform=linux
arch=x64
{
  GLIBC: 'glibc',
  MUSL: 'musl',
  family: 'glibc',
  version: '2.24',
  method: 'getconf',
  isNonGlibcLinux: false
}
Removing intermediate container 4c7db816aa17
 ---> 68c8b2d9c3f4
Step 4/4 : RUN npm i sharp
 ---> Running in a617bbed12e4

> [email protected] install /node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.10.0/libvips-8.10.0-linux-x64.tar.br

+ [email protected]
added 73 packages from 173 contributors and audited 74 packages in 7.417s

@lovell I think the glibc check is a bit too hard and doesn't check for prebuild images first.

@lovell
Copy link
Owner

lovell commented Dec 12, 2020

Hi, the salient part is:

ERR! sharp Use with glibc 2.24 requires manual installation of libvips >= 8.10.0

This is documented at https://sharp.pixelplumbing.com/install#prebuilt-binaries

Ready-compiled sharp and libvips binaries are provided for use with Node.js v10+ on the most common platforms:
...
Linux ARM64 (glibc >= 2.29)

The following platforms require compilation of both libvips and sharp from source:
...
Linux ARM64 (glibc <= 2.28, musl)

@gpetrov
Copy link
Author

gpetrov commented Dec 12, 2020

But there is no need to compile anything...?

docker image is linux/arm64 and there is a prebuild binary available.

it runs all fine in linux/x86 - while there is the same glibc 2.24

or does node needs to change all their official docker image to include glibc 2.29+ ?

@lovell
Copy link
Owner

lovell commented Dec 12, 2020

Please see lovell/sharp-libvips@2e4202d for a discussion about why the prebuilt arm64 binaries currently require glibc 2.29+

@gpetrov
Copy link
Author

gpetrov commented Dec 12, 2020

Thanks - make sense now. Hope node updates their base images. However even latest buster image is still with glibc 2.28

Maybe you can consider to support musl? Trying docker node:14-alpine, produced:

> [email protected] install /node_modules/sharp                                                                                                                                                           
#8 3.650 > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)                                                                                 
#8 3.650                                                                                                                                                                                                      
#8 3.758 info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.10.0/libvips-8.10.0-linuxmusl-arm64v8.tar.br
#8 4.032 ERR! sharp Prebuilt libvips 8.10.0 binaries are not yet available for linuxmusl-arm64v8

@gpetrov
Copy link
Author

gpetrov commented Dec 13, 2020

Btw the Linux/arm64 is running natively on the new Apple Silicon M1 arm64 with the upcoming Docker Desktop version for the M1.

So it is essential to have the right binaries ready for easy docker deploy @lovell

@gpetrov
Copy link
Author

gpetrov commented Dec 18, 2020

can you clarify @lovell that you need GLIBC 2.29+ - just to run libvips? Not only to compile it?

@lovell
Copy link
Owner

lovell commented Dec 18, 2020

As you hopefully saw from the discussion in lovell/sharp-libvips@2e4202d, gcc 9.2.0+ is required to compile libvips on arm64 without introducing compiler bugs. The oldest OS that provides gcc 9.2.0 is Debian 11, which also provides and therefore requires glibc 2.29.

@gpetrov
Copy link
Author

gpetrov commented Dec 18, 2020

Yes I saw that - but I don't need to compile libvips - the precompiled binary from sharp-libvips for arm64v8 is just fine!
https://github.com/lovell/sharp-libvips/releases/download/v8.10.0/libvips-8.10.0-linux-arm64v8.tar.gz

But your check for glibc version prevents it from being downloaded....

@lovell
Copy link
Owner

lovell commented Dec 18, 2020

A binary compiled on Debian 11 will require glibc 2.29+ at runtime.

@gpetrov
Copy link
Author

gpetrov commented Dec 18, 2020

ok then we will have to wait for node to be available on debian bullseye ... it might take a while.

maybe there is a better hope for node-alpine with musl?

@lovell
Copy link
Owner

lovell commented Dec 18, 2020

we will have to wait for node to be available on debian bullseye

https://packages.debian.org/bullseye/nodejs

@gpetrov
Copy link
Author

gpetrov commented Dec 18, 2020

I mean the official docker node image:

https://hub.docker.com/_/node

It doesn't have bullseye yet, so no docker node installation under arm64 can run sharp ...

@gpetrov
Copy link
Author

gpetrov commented Dec 18, 2020

See also:

nodejs/docker-node#1415

@lovell
Copy link
Owner

lovell commented Jan 6, 2021

Let's track this at lovell/sharp-libvips#72

@gpetrov
Copy link
Author

gpetrov commented Mar 9, 2021

@lovell are the node-gyp checks already adjusted for the new live builds? I'm still getting errors of not found binaries.
Also on the regular linux/arm64 - the gcc version check is still in place:

Using node-14:slim (GCC)

#13 19.60 npm ERR! path /opt/node_app/node_modules/sharp
#13 19.60 npm ERR! command failed
#13 19.60 npm ERR! command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
#13 19.60 npm ERR! ERR! sharp Use with glibc 2.24 requires manual installation of libvips >= 8.10.5
#13 19.60 npm ERR! info sharp Attempting to build from source via node-gyp but this may fail due to the above error

and using node-14:alpine (MUSL)

#12 19.17 npm ERR! path /opt/node_app/node_modules/sharp
#12 19.17 npm ERR! command failed
#12 19.17 npm ERR! command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
#12 19.17 npm ERR! info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.10.5/libvips-8.10.5-linuxmusl-arm64v8.tar.br
#12 19.17 npm ERR! ERR! sharp Prebuilt libvips 8.10.5 binaries are not yet available for linuxmusl-arm64v8
#12 19.17 npm ERR! info sharp Attempting to build from source via node-gyp but this may fail due to the above error

@lovell
Copy link
Owner

lovell commented Mar 9, 2021

@gpetrov The linuxmusl-arm64v8 binaries will be made available from sharp v0.28.0+ and will require musl >= 1.1.24 (the linux-arm64v8 binaries will still require glibc >= 2.29).

@gpetrov
Copy link
Author

gpetrov commented Mar 9, 2021

ah bummer 😃 well lets hope 0.28 come soon then.

Yes node-14:slim uses unfortunately Debian Buster with glibc 2.28, so no much luck there. I thought you were able to lower that requirement with cross compiling?

Lets hope for the node-14:alpine that can use Alpine 3.13 having musl 1.2

@lovell
Copy link
Owner

lovell commented Mar 9, 2021

Debian Buster with glibc 2.28, so no much luck there. I thought you were able to lower that requirement with cross compiling?

No, sorry, I did some more digging and gcc 9 is required - see lovell/sharp-libvips#86 (comment)

@gpetrov
Copy link
Author

gpetrov commented Mar 9, 2021

Correction node-14:slim uses even Debian Stretch with glibc 2.24
We can target specific node-14:buster-slim that uses Debian Buster with glibc 2.28 but that is the max for now as described in: nodejs/docker-node#1415

@jeromecovington
Copy link

I'm seeing something similar today using the ubuntu-latest image provided by GitHub actions. I have seen the error when installing both with Node.js versions 16.x and 18.x. The tasks usually complete with a successful install after I re-run them. This issue was the closest thing I could find to my issue, so I am appending my comments to it.

sharp: Installation error: Prebuilt libvips 8.13.3 binaries are not yet available for linux-x64

@lovell
Copy link
Owner

lovell commented Feb 28, 2023

@jeromecovington Please open a new installation issue and answer all of the questions if you still require help.

Repository owner locked and limited conversation to collaborators Feb 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants