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

Provide pre-compiled libvips+deps for OS X #312

Closed
2 tasks done
lovell opened this issue Nov 22, 2015 · 22 comments
Closed
2 tasks done

Provide pre-compiled libvips+deps for OS X #312

lovell opened this issue Nov 22, 2015 · 22 comments
Milestone

Comments

@lovell
Copy link
Owner

lovell commented Nov 22, 2015

#42 provided the infrastructure and initial support for 64-bit Windows and Linux binaries.

  • OS X

We could use Travis' OS X environment + homebrew e.g. https://github.com/lovell/package-libvips-darwin-x64/blob/master/.travis.yml

If we use this approach a shell script is required to update the paths in the .dylib files - this will look something like:

for each .dylib file (e.g. libvips.42.dylib):
- otool libvips.42.dylib
- install_name_tool -id @rpath/libvips.42.dylib libvips.42.dylib
- for any entry that does not start with /usr/lib (e.g. libGraphicsMagick.3.dylib):
  - install_name_tool -change /usr/local/opt/graphicsmagick/lib/libGraphicsMagick.3.dylib @rpath/libGraphicsMagick.3.dylib libvips.42.dylib
  • ARM

Best bet is to use a first generation Raspberry Pi Model B to compile ARMv6 binaries, possibly via Hypriot. Support for ARMv6+ added in v0.12.2.

@lovell
Copy link
Owner Author

lovell commented Jan 1, 2016

ARMv6 build machine in action. This might take some time.

@lovell
Copy link
Owner Author

lovell commented Jan 6, 2016

Commit a0e034a adds support for building and using pre-compiled libvips binaries on ARMv6+.

This will be included in sharp v0.12.2.

@lovell lovell changed the title Investigate pre-compiled libvips+deps for OS X and ARM-based systems Investigate pre-compiled libvips+deps for OS X Jan 16, 2016
@davej
Copy link

davej commented Mar 10, 2016

How about falling back to sips on OS X. Could that be a viable alternative to compiling libvips?

@lovell
Copy link
Owner Author

lovell commented Mar 10, 2016

@davej Installation of libvips is already relatively easy on OS X via:

brew install homebrew/science/vips

This task relates to making it even easier.

@homerjam
Copy link

@lovell I think what @davej means is - could you fallback to using sips instead of vips from sharp in order to support using sharp in electron apps on osx.

@davej can you clarify? And that link to sips leads nowhere? Can I find more info on that somewhere else? Thanks!

Just to mention - I'm mega interested in making an electron app that can use sharp cross platform under the hood.

@davej
Copy link

davej commented Apr 27, 2016

@homerjam Here's the cached man page. I ended up creating my own lib to do cross-platform resizing of images on Electron, not the most performant approach but it works: https://github.com/davej/electron-image-resize

@lovell
Copy link
Owner Author

lovell commented Jun 17, 2016

There's now an experimental packaging script for OS X and commit dac8654 on the osx-binaries branch takes advantage of the pre-built binaries it creates.

I'd very much appreciate it if everyone interested in this feature can test it by running the following on a Mac where vips is not already installed (or has been removed via brew unlink vips or brew uninstall vips) and report back here.

npm install lovell/sharp#osx-binaries

npm install lovell/sharp#pencil

@lovell lovell added this to the v0.16.0 milestone Jun 26, 2016
@lovell lovell changed the title Investigate pre-compiled libvips+deps for OS X Provide pre-compiled libvips+deps for OS X Jun 26, 2016
@sharpfuryz
Copy link

I would like to notice: this solution is working unless your app is packed in asar (which is default in electron-bootstrap). In my case it caused errors because nodejs can't resolve libraries inside app.asar, so I unpack to app/ and it fixed this issue.
error

@lovell
Copy link
Owner Author

lovell commented Jul 26, 2016

Commit 36bfbde on the pencil (v0.16.0) branch adds the use of pre-compiled binaries for OS X.

https://travis-ci.org/lovell/sharp/jobs/147224162

@AlekzZz
Copy link

AlekzZz commented Jul 28, 2016

I get the following error during installation:

npm install -S lovell/sharp#osx-binaries

npm ERR! git rev-list -n1 osx-binaries: fatal: ambiguous argument 'osx-binaries': unknown revision or path not in the working tree.
npm ERR! git rev-list -n1 osx-binaries: Use '--' to separate paths from revisions, like this:
npm ERR! git rev-list -n1 osx-binaries: 'git [...] -- [...]'
npm ERR! git rev-list -n1 osx-binaries:
npm ERR! git rev-list -n1 osx-binaries: fatal: ambiguous argument 'osx-binaries': unknown revision or path not in the working tree.
npm ERR! git rev-list -n1 osx-binaries: Use '--' to separate paths from revisions, like this:
npm ERR! git rev-list -n1 osx-binaries: 'git [...] -- [...]'
npm ERR! git rev-list -n1 osx-binaries:
npm ERR! git rev-list -n1 osx-binaries: fatal: ambiguous argument 'osx-binaries': unknown revision or path not in the working tree.
npm ERR! git rev-list -n1 osx-binaries: Use '--' to separate paths from revisions, like this:
npm ERR! git rev-list -n1 osx-binaries: 'git [...] -- [...]'
npm ERR! git rev-list -n1 osx-binaries:
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/6.3.1/bin/node" "/usr/local/bin/npm" "install" "-S" "lovell/sharp#osx-binaries"
npm ERR! node v6.3.1
npm ERR! npm v3.10.5
npm ERR! code 128

@lovell
Copy link
Owner Author

lovell commented Jul 28, 2016

@AlekzZz Please use npm install lovell/sharp#pencil (I've updated my comment too, sorry).

@digital-flowers
Copy link

if i use "npm install lovell/sharp#pencil" i had the following errors:
clang: error: no such file or directory: 'node_modules/sharp/include'
clang: error: no such file or directory: 'node_modules/sharp/include/glib-2.0'
clang: error: no such file or directory: 'node_modules/sharp/lib/glib-2.0/include'
do i need to add these files manually ?

@lovell
Copy link
Owner Author

lovell commented Aug 1, 2016

@digital-flowers Those should be created for you. Are you able to share the full npm install log?

@digital-flowers
Copy link

after trials i have found that this only happened if the project directory has space in it is name, i renamed the folder and it is working now

@digital-flowers
Copy link

so project folder should have no spaces to make this work

@lovell
Copy link
Owner Author

lovell commented Aug 1, 2016

@digital-flowers Thanks, it looks like you ran into nodejs/node-gyp#65

@digital-flowers
Copy link

exactly thank you :)

@digital-flowers
Copy link

digital-flowers commented Aug 1, 2016

is there any chance to include image magick in this prebuild version? i need it only because of bmp file format.

@lovell
Copy link
Owner Author

lovell commented Aug 1, 2016

@digital-flowers The pre-built binaries only include shared libraries I'm willing to support and *magick is a security nightmare. Please install vips yourself if you need to use extra libraries and take your own precautions if using untrusted images.

@digital-flowers
Copy link

yes i understand thank you

@lovell
Copy link
Owner Author

lovell commented Aug 1, 2016

@digital-flowers Commit da0dc28 on the pencil branch might help workaround the spaces-in-path problem.

@lovell
Copy link
Owner Author

lovell commented Aug 18, 2016

v0.16.0 is now available via npm, providing pre-compiled shared library binaries for OS X.

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

No branches or pull requests

6 participants