Skip to content

Investigate reducing the dependencies to install vips #42

Closed

Description

@ide

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.

Activity

  1. lovell commented on May 28, 2014

    @lovell
    Owner

    Instructions in the README for yum-based installation (to include AWS's default AMIs) would definitely help, thanks for the suggestion.

    How about a sample Dockerfile? That would help with an Elastic Beanstalk deployment.

    Not sure I'd want the maintenance overhead of including and compiling all dependencies from source!

  2. ide commented on May 28, 2014

    @ide
    ContributorAuthor

    Instructions for yum (EC2 in particular) and a dockerfile would certainly be useful for production setups.

    I was chatting with a friend earlier today who didn't have brew installed and he found Sharp difficult to set up on Mavericks. I don't think it's reasonable for the Sharp project to precompile vips for major platforms but it would be nice for compilation to be easier.

    For example node-fibers is pretty easy to install on all major platforms and it ships with the source of its dependencies. So something similar where Sharp ships with the source of vips could be helpful, even if it's a longer term goal that might require help from the vips team.

    On Tue, May 27, 2014 at 11:31 PM, Lovell Fuller [email protected]
    wrote:

    Instructions in the README for yum-based installation (to include AWS's default AMIs) would definitely help, thanks for the suggestion.
    How about a sample Dockerfile? That would help with an Elastic Beanstalk deployment.

    Not sure I'd want the maintenance overhead of including and compiling all dependencies from source!

    Reply to this email directly or view it on GitHub:
    #42 (comment)

  3. lovell commented on May 28, 2014

    @lovell
    Owner

    The libcoro dependency of node-fibers appears a lot simpler than libvips (which then has its own dependencies to worry about too).

    What I really like about the node-fibers repo is the provision of build.js, an idea sharp could borrow as a "bootstrap" to verify that dependencies are present, providing more useful feedback/help in the event things are not quite ready. Thanks for the inspiration!

    I'm also happy to provide installation instructions for other Mac OS package managers, e.g. Fink, if there's enough call for it.

  4. jonathanong commented on May 29, 2014

    @jonathanong
    Contributor

    i would love if vips was included so i can deploy it to places like heroku without crazy images and stuff. however, it makes total sense not to as it's super complicated. it could also take forever to build

  5. lovell commented on May 29, 2014

    @lovell
    Owner

    @jonathanong There's a Heroku Buildpack at https://github.com/alex88/heroku-buildpack-vips which I've not tried but seems only slightly out of date with respect to required version numbers. Perhaps send a PR to upgrade to libvips 7.38.5 and liborc 0.4.19.

  6. lovell commented on Oct 23, 2014

    @lovell
    Owner

    I've added a preinstall.sh shell script on the preinstall branch that can be used to install libvips and its dependencies on a wide variety of OS and package manager combos (but not Windows).

    If everyone/anyone following this issue is able to test the instructions at https://github.com/lovell/sharp/tree/preinstall#prerequisites - especially on Mac OS as I've not been able to verify this - I would very much appreciate it.

  7. lovell commented on Oct 24, 2014

    @lovell
    Owner

    When everyone is happy that preinstall.sh is solid enough, I'd like to either add it as the preinstall script in package.json (completely ignoring the "INSTALL SCRIPTS ARE AN ANTIPATTERN" warning) or somehow get gyp to call it.

  8. ide commented on Oct 25, 2014

    @ide
    ContributorAuthor

    Here's my output on Yosemite. Seems to be working.

    $ ./preinstall.sh 
    Found libvips 7.40.11
    $ brew remove vips
    Uninstalling /usr/local/Cellar/vips/7.40.11...
    $ ./preinstall.sh 
    Could not find libvips using a PKG_CONFIG_PATH of '/usr/lib/pkgconfig:/usr/local/Library/ENV/pkgconfig/10.10::/usr/local/lib/pkgconfig:/usr/lib/pkgconfig'
    Detected Mac OS
    Installing libvips via homebrew
    ==> Downloading http://www.vips.ecs.soton.ac.uk/supported/7.40/vips-7.40.11.tar.g
    Already downloaded: /Library/Caches/Homebrew/vips-7.40.11.tar.gz
    ==> ./configure --prefix=/usr/local/Cellar/vips/7.40.11 --with-magick --with-magi
    ==> make check
    ==> make install
    ==> Caveats
    If you need Python to find the installed site-packages:
      mkdir -p ~/Library/Python/2.7/lib/python/site-packages
      echo '/usr/local/lib/python2.7/site-packages' > ~/Library/Python/2.7/lib/python/site-packages/homebrew.pth
    ==> Summary
    🍺  /usr/local/Cellar/vips/7.40.11: 196 files, 13M, built in 65 seconds
    
  9. lovell commented on Oct 25, 2014

    @lovell
    Owner

    Great news, thanks @ide.

    "I was chatting with a friend earlier today who didn't have brew installed and he found Sharp difficult to set up on Mavericks."

    Is your friend available to help? What, if any, package/dependency management tool(s) do they use?

  10. toulouse commented on Oct 27, 2014

    @toulouse

    That's me.

    I use vanilla ./configure with $PREFIX set to a subdirectory of my home directory, and make install things. I'm not a UNIX neckbeard, but it's a very reasonable expectation to expect to be able to make local, non-global installations of compiled software.

    Only being able to have a single active version of a dependency on an entire system is literally a singleton pattern and it makes a number of compromises to the system's integrity I'm not really willing to make, not the least of which is making a subdirectory of /usr/local user-owned-and-writable.

    Not to mention, new OS upgrades often break - sometimes subtly, sometimes blatantly - changes made by the package managers, and I prefer not to be dependent on upstream fixes to get a system up and running to where I'd like it to be.

  11. papandreou commented on Oct 27, 2014

    @papandreou
    Contributor

    The preinstall script works fine on Ubuntu 14.04 here. This patch makes it work with Debian Wheezy as well: #111

  12. 41 remaining items

  13. lovell commented on Nov 10, 2015

    @lovell
    Owner

    @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.

  14. papandreou commented on Nov 17, 2015

    @papandreou
    Contributor

    On Debian Wheezy I get:

    $ npm install git+https://github.com/lovell/sharp#look
    -
    > [email protected] 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 [email protected]
    
  15. papandreou commented on Nov 17, 2015

    @papandreou
    Contributor
  16. lovell commented on Nov 17, 2015

    @lovell
    Owner

    @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?

  17. papandreou commented on Nov 17, 2015

    @papandreou
    Contributor

    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?

  18. lovell commented on Nov 17, 2015

    @lovell
    Owner

    @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.

  19. papandreou commented on Nov 17, 2015

    @papandreou
    Contributor

    @lovell That worked, yay! PR here: #307

  20. lovell commented on Nov 18, 2015

    @lovell
    Owner

    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
    
  21. lovell commented on Nov 21, 2015

    @lovell
    Owner

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

  22. lovell commented on Nov 22, 2015

    @lovell
    Owner

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

  23. lovell commented on Nov 22, 2015

    @lovell
    Owner

    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.

  24. Repository owner locked and limited conversation to collaborators on Nov 22, 2015
  25. lovell commented on Nov 23, 2015

    @lovell
    Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions