lovell / sharp

High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library.

Home Page:https://sharp.pixelplumbing.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sharp v0.16.1, OS X, "readelf: command not found" when using a custom global vips

caoko opened this issue · comments

npm install sharp
(sharp@0.16.1)

node -v v6.8.0
node-gyp -v v3.4.0

/bin/sh: readelf: command not found
gyp: Call to 'if readelf -Ws "$(PKG_CONFIG_PATH="/usr/lib/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.11:$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig" pkg-config --libs-only-L vips-cpp | cut -c 3- | sed -e "s/^$//usr/lib/")/libvips-cpp.so" | c++filt | grep -qF __cxx11;then echo "1";else echo "0";fi' returned exit status 0 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/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 15.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"

Hello, the use of readelf was recently introduced via commit 07d66da. The OS X CI build passes quite happily, but I guess that environment may have more tools installed on it than provided by clang/xcode on a "stock" OS X machine.

The command is only needed for gcc, so I suspect limit use of that command to Linux only will "fix" this. Leave it with me, thanks for reporting.

This problem only affects OS X users who already have a globally-installed version of vips, probably via homebrew.

A workaround, assuming you don't need a custom installation of vips, is to remove it via brew remove vips and re-install sharp so it uses own pre-compiled version.

yes

brew uninstall --force vips

npm install ok.

thx.

Thanks for confirming. If it's OK with you I'd like to leave this issue open whilst I fix things for those who wish to use a custom installation of vips on OS X.

readelf command for mac os x.
ref> http://stackoverflow.com/questions/3286675/readelf-like-tool-for-mac-os-x

brew install binutils
sudo ln -s /usr/local/bin/greadelf /usr/local/bin/readelf

but, sharp does not install.

readelf: Error: '/usr/local/Cellar/vips/8.3.3/lib -L/usr/local/Cellar/glib/2.48.1/lib -L/usr/local/opt/gettext/lib/libvips-cpp.so': No such file
gyp: Call to 'if readelf -Ws "$(PKG_CONFIG_PATH="/usr/lib/pkgconfig:/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/10.11:$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig" pkg-config --libs-only-L vips-cpp | cut -c 3- | sed -e "s/^$//usr/lib/")/libvips-cpp.so" | c++filt | grep -qF __cxx11;then echo "1";else echo "0";fi' returned exit status 0 while in binding.gyp. while trying to load binding.gyp

Yeah I am in exactly this situation that would benefit from a fix here -- I want to keep my global install of vips on my development machine for other projects, but am building a small side project that will be deployed on EC2 or etc, so would rather leave it with the local version.

Commit 1a0030e should limit the use of readelf to Linux. Are you able to test?

npm install lovell/sharp

first test env is not installed global vips.
so. i install brew install vips

ok. test commit version 1a0030e. (by chekout)

test env.

$ brew info vips
homebrew/science/vips: stable 8.4.2 (bottled)
Image processing library
http://www.vips.ecs.soton.ac.uk/
/usr/local/Cellar/vips/8.4.2 (174 files, 12.4M) *
Poured from bottle on 2016-10-17 at 12:06:02
From: https://github.com/Homebrew/homebrew-science/blob/master/vips.rb
==> Dependencies
Build: pkg-config ✔
Required: fontconfig ✔, gettext ✔, glib ✔
Recommended: libpng ✔, jpeg ✔, orc ✔, libgsf ✔, libtiff ✔, fftw ✔, little-cms2 ✔, pango ✔, libexif ✔, gobject-introspection ✔, pygobject3 ✔, python ✔, poppler ✔, librsvg ✔, giflib ✔
Optional: openslide ✘, imagemagick ✘, graphicsmagick ✔, openexr ✘, cfitsio ✘, webp ✔, python3 ✘, libmatio ✘, mozjpeg ✘, jpeg-turbo ✘

$ npm run clean
$ npm install
$ npm test

  • npm install test ok. (not use global vips?)
  • npm test failed.

438 passing (4m)
11 failing

  1. Image metadata GIF via giflib:
  Uncaught AssertionError: 4 === 3
  + expected - actual

  -4
  +3

  at test/unit/metadata.js:143:16
  1. Image metadata GIF grey+alpha via giflib:
  Uncaught AssertionError: 4 === 2
  + expected - actual

  -4
  +2

  at test/unit/metadata.js:159:16
  1. Rotation Override EXIF Orientation tag metadata after auto-rotate:
  Uncaught AssertionError: 3 === 8
  + expected - actual

  -3
  +8

  at test/unit/rotate.js:113:18
  1. Rotation Input image has Orientation EXIF tag value of 5 (270 degrees + flip), auto-rotate:
  Uncaught AssertionError: false === true
  + expected - actual

  -false
  +true

  at test/unit/rotate.js:130:18
  1. Rotation Flip - vertical:
  Uncaught AssertionError: false === true
  + expected - actual

  -false
  +true

  at test/unit/rotate.js:180:18
  1. Rotation Flop - horizontal:
  Uncaught AssertionError: false === true
  + expected - actual

  -false
  +true

  at test/unit/rotate.js:198:18
  1. Tile Deep Zoom layout:
 Uncaught Error: ENOENT: no such file or directory, scandir '/Users/caoko/github/sharp/test/fixtures/output.dz_files'
  at Error (native)
  at Object.fs.readdirSync (fs.js:951:18)
  at assertDeepZoomTiles (test/unit/tile.js:17:19)
  at test/unit/tile.js:153:13
  1. Tile Deep Zoom layout with custom size+overlap:
 Uncaught Error: ENOENT: no such file or directory, scandir '/Users/caoko/github/sharp/test/fixtures/output.dz.512_files'
  at Error (native)
  at Object.fs.readdirSync (fs.js:951:18)
  at assertDeepZoomTiles (test/unit/tile.js:17:19)
  at test/unit/tile.js:169:13
  1. Tile Zoomify layout:
 Uncaught Error: ENOENT: no such file or directory, stat '/Users/caoko/github/sharp/test/fixtures/output.zoomify/ImageProperties.xml'
  at Error (native)
  1. Tile Google layout:
 Uncaught Error: ENOENT: no such file or directory, stat '/Users/caoko/github/sharp/test/fixtures/output.google/0/0/0.jpg'
  at Error (native)
  1. Tile Write to ZIP container using container tile option:
 Uncaught Error: ENOENT: no such file or directory, stat '/Users/caoko/github/sharp/test/fixtures/output.dz.containeropt.zip'
  at Error (native)

@caoko Brilliant, thank you for testing.

The failures from the master branch with vips 8.4.2 are expected and are fixed on the quill branch, which will become sharp v0.17.0 and have a dependency upon vips v8.4.2+.

v0.16.2 out now with this fix, thanks for reporting.