chrisben / image-thumb

NodeJS image thumbnail server
Other
21 stars 7 forks source link

lwip install fails #1

Closed IlyaSemenov closed 6 years ago

IlyaSemenov commented 6 years ago

I realise that this project is most probably abandoned, but in any case I'll leave the results of my investigation.

The thumbnail server won't compile in Alpine Linux 3.6 (probably other modern Linuxes as well).

Steps to reproduce:

docker run --rm -it alpine:3.6 sh

then inside the container:

apk add --no-cache \
        bash \
        build-base \
        git \
        freetype-dev libjpeg-turbo-dev openjpeg-dev zlib-dev  libpng-dev \
        nodejs nodejs-npm python
git clone https://github.com/chrisben/image-thumb.git
cd image-thumb
npm install

this will fail when compiling lwip with a zillion errors:

In file included from ../src/decoder/decoder.h:13:0,
                 from ../src/decoder/init.cpp:1:
../../nan/nan.h: At global scope:
../../nan/nan.h:590:20: error: variable or field 'AddGCEpilogueCallback' declared void
       v8::Isolate::GCEpilogueCallback callback
                    ^~~~~~~~~~~~~~~~~~
../../nan/nan.h:590:7: error: 'GCEpilogueCallback' is not a member of 'v8::Isolate'
       v8::Isolate::GCEpilogueCallback callback
       ^~

Manually upgrading lwip with npm i lwip@latest will also fail:

In file included from ../src/lib/png/png.c:14:0:
../src/lib/png/pngpriv.h:805:4: error: #error ZLIB_VERNUM != PNG_ZLIB_VERNUM "-I (include path) error: see the notes in pngpriv.h"
 #  error ZLIB_VERNUM != PNG_ZLIB_VERNUM \
    ^~~~~
make: *** [lwip_decoder.target.mk:165: Release/obj.target/lwip_decoder/src/lib/png/png.o] Error 1

People suggest to replace lwip with jimp which (supposedly) has almost identical API.

chrisben commented 6 years ago

Hi @IlyaSemenov

I haven't worked on this project since I uploaded it a few years ago and didn't know any one used it.

About your last test with lwip@latest, it looks like it's being discussed there. Looking at it quickly, it might require some image processing libraries installed on your instance, or to use node v6 instead of newer.

If you found it works better with jimp, I'll be happy to accept your pull request for that.

bustroker commented 6 years ago

Same issue here with Ubuntu... shame the project hasn't been kept it up to date..

npm WARN deprecated lodash-node@2.4.1: This package is discontinued. Use lodash@^4.0.0.

> lwip@0.0.8 install /home/src/image-thumb/node_modules/lwip
> node-gyp rebuild

/bin/sh: 1: node: not found
gyp: Call to 'node -e "require('nan')"' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:354:16)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.13.0-37-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/src/image-thumb/node_modules/lwip
gyp ERR! node -v v4.2.6
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
npm ERR! Linux 4.13.0-37-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE

npm ERR! lwip@0.0.8 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the lwip@0.0.8 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the lwip package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs lwip
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls lwip
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/src/image-thumb/npm-debug.log
bustroker commented 6 years ago

@IlyaSemenov, did you find a similar solution for thumnails in nodejs? Thx

IlyaSemenov commented 6 years ago

I came up with my own module (using sharp for image processing), and a caching layer in nginx.

chrisben commented 6 years ago

I dumped lwip in favour of sharp. Thanks for the tip.

ausitpro commented 5 years ago

regarding sharp - is there a way to pipe multer output to sharp prior to writing to disk? I asked this question on stackoverflow and was pointed to multer-resizer which depends on lwip. I've spent 2 days trying to resolve the similar lwip install issues and I'm ready to move on.