imagemin / cwebp-bin

cwebp bin-wrapper that makes it seamlessly available as a local dependency
https://developers.google.com/speed/webp
MIT License
91 stars 36 forks source link

Not working on Node 8.9.1 on Alpine 3.7 #18

Open affixalex opened 6 years ago

affixalex commented 6 years ago

https://github.com/hypoalex/reduction - A minimal reduction of the problem is available here, using Docker.

git clone git@github.com:hypoalex/reduction.git
cd reduction && docker build .

It doesn't actually throw an error. It just kinda fails to build.

grushikhin commented 6 years ago

Hello! Binary file cwebp-bin/vendor/linux/x64/cwebp is not compatible with Alpine Linux because it used musl lib c. What do you think about adding to the repository additional cwebp binary for musl based systems?

oprearocks commented 6 years ago

Is there any temporary solution for this? I've yet to find something that points to a solution that works properly. Something like building cwebp on the system itself, using musl.

oprearocks commented 6 years ago

Actually found that for me, the reason this wasn't working was due to npm. Yarn seems to properly build the module even on Alpine.

polarathene commented 5 years ago

Why does the bin-wrapper script only link to URLs? Can't use a local package?

polarathene commented 5 years ago

@oprearocks just tried yarn, it silently fails. Appears like it worked fine if you don't use verbose(which shows output you'd get with npm install)

[4/4] Building fresh packages...
verbose 9.242 ⚠ spawn /site/node_modules/cwebp-bin/vendor/cwebp ENOENT
  ⚠ cwebp pre-build test failed
  ℹ compiling from source
  ✖ Error: Command failed: /bin/sh -c ./configure --disable-shared --prefix="/site/node_modules/cwebp-bin/vendor" --bindir="/site/node_modules/cwebp-bin/vendor"
configure: error: in `/tmp/ef7f80d9-d8ef-4c47-b41e-0b2b00202369':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details

checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
checking for gcc... no
checking for cc... no
checking for cl.exe... no

    at Promise.all.then.arr (/site/node_modules/execa/index.js:231:11)
    at process._tickCallback (internal/process/next_tick.js:68:7)
success Saved 1 new dependency.
info Direct dependencies
└─ cwebp-bin@5.0.0
info All dependencies
└─ cwebp-bin@5.0.0
Done in 9.27s.

In this case I know why it can't compile, but I already have a valid binary(the one this package seems to pull in isn't compatible with Alpine afaik), it just fails to use it by attempting to download it's own binary file from the repo to use.

Difference in my image size if I have to compile is few hundred MB(due to not wanting to copy node_modules into the image file which would be similar bloat).