lovell / sharp

High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library.
https://sharp.pixelplumbing.com
Apache License 2.0
29.04k stars 1.29k forks source link

Investigate reducing the dependencies to install vips #42

Closed ide closed 8 years ago

ide commented 10 years ago

One of the hardest parts about using Sharp is setting it up. Being able to just say "npm install sharp" would make it easier for a lot of people to try it out.

Currently libvips isn't very easy to set up on an Amazon Linux box, and on Mac OS X it requires brew (there are some instances in which one may wish not to install brew). So if there were an easier way to build vips and it were integrated with Sharp's installation that could help a lot.

mahnunchik commented 8 years ago

I've tested on:

vips package does not pass build time checks. So I've been able to install it only by the following comand:

$ brew install vips --with-webp --with-graphicsmagick --without-check

And it works as expected.

lovell commented 8 years ago

@mahnunchik Thanks for testing/confirming. If it makes you feel any better, I'm hearing about all sorts of problems with El Capitan upgrades breaking homebrew, xcode etc.

papandreou commented 8 years ago

On Debian Wheezy I get:

$ npm install git+https://github.com/lovell/sharp#look
-
> sharp@0.12.0 install /home/andreas/express-processimage/node_modules/sharp
> node-gyp rebuild

ERROR: libc version 2.13 requires manual installation
gyp: Call to 'LDD_VERSION="ldd (Debian EGLIBC 2.13-38+deb7u8) 2.13
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper." node -e "require('./binding').download_vips()"' returned exit status 1. 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 (/home/andreas/.nvm/v0.10.40/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:343:16)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Linux 3.14.36-20150326-1131-6606ede
gyp ERR! command "node" "/home/andreas/.nvm/v0.10.40/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/andreas/express-processimage/node_modules/sharp
gyp ERR! node -v v0.10.40
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok 
npm WARN optional dep failed, continuing sharp@0.12.0
papandreou commented 8 years ago

Oh, I should look at https://github.com/lovell/sharp/blob/look/docs/install.md instead, of course, and it does say Debian 8. Bummer.

lovell commented 8 years ago

@papandreou Yes, sorry, I had to draw a line somewhere. Debian Wheezy's version of libc is over 4 years' old. Is this likely to be a problem?

papandreou commented 8 years ago

I'm stuck with Wheezy in my production environment for the time being, so for me personally, yes :(

Do you have any idea how much work it'd be?

lovell commented 8 years ago

@papandreou It might be as simple as changing the base OS in the Dockerfile used to generate the binaries.

If you'd like to experiment, you can run ./packaging/build.sh to generate the packaging/libvips-8.1.1-lin.tar.gz file. If present, this file is used instead of downloading from bintray at npm install time.

papandreou commented 8 years ago

@lovell That worked, yay! PR here: https://github.com/lovell/sharp/pull/307

lovell commented 8 years ago

I've managed to locally reproduce the heap corruption problem affecting Node v4 and v5 on the Windows CI environment. I think it's something to do with thread switching but I haven't figured it out yet. Here's the stacktrace should anyone else have any ideas:

ntdll!RtlpNtMakeTemporaryKey+0x4000
ntdll!memset+0x160da
msvcrt!free+0x1c
node!node::Start+0x53e
node!v8::Testing::DeoptimizeAll+0x12bdf3
node!v8::Testing::DeoptimizeAll+0x12c5f5
node!v8::Testing::DeoptimizeAll+0xa5ca3
node!v8::Testing::DeoptimizeAll+0xa4e81
node!v8::Testing::DeoptimizeAll+0x14d4fe
node!v8::Unlocker::~Unlocker+0x1429ce
lovell commented 8 years ago

Windows problems finally fixed with commit 3dbedf1 - there was a mismatched malloc/free - see https://ci.appveyor.com/project/lovell/sharp/build/269

lovell commented 8 years ago

The look branch has now been merged to the master branch pending release.

lovell commented 8 years ago

The forthcoming v0.12.0 release will provide pre-compiled binaries for 64-bit Windows and Linux. I've moved the work to investigate the best way to support OS X (and ARM) to #312.

Thank you very much to everyone on this thread for all your suggestions, help and testing during the last year and a half!

I'm closing+locking this issue now - please open a new issue if you're having any problems with the pre-compiled binaries or have further thoughts.

lovell commented 8 years ago

v0.12.0 now available via npm - tell all your friends!