sharp icon indicating copy to clipboard operation
sharp copied to clipboard

Error during `npm install sharp`

Open gscottolson opened this issue 11 years ago • 4 comments

I should start off by saying a lot of this falls outside my area of expertise, so I might be incorrectly opening an issue for something that isn’t relevant to this library. Not 100% sure.

When I try to install sharp via npm, I get the following errors:

npm WARN package.json [email protected] No repository field.

> [email protected] install /Users/gscottolson/test
> node-gyp rebuild

  CXX(target) Release/obj.target/sharp/src/sharp.o
../src/sharp.cc:119:22: error: use of undeclared identifier 'VIPS_ANGLE_0'; did you mean 'VIPS_ANGLE_D0'?
  VipsAngle rotate = VIPS_ANGLE_0;
                     ^~~~~~~~~~~~
                     VIPS_ANGLE_D0
/usr/local/Cellar/vips/7.42.1/include/vips/conversion.h:65:2: note: 'VIPS_ANGLE_D0' declared here
        VIPS_ANGLE_D0,
        ^
../src/sharp.cc:124:18: error: use of undeclared identifier 'VIPS_ANGLE_90'
        rotate = VIPS_ANGLE_90;
                 ^
../src/sharp.cc:126:18: error: use of undeclared identifier 'VIPS_ANGLE_180'; did you mean
      'VIPS_ANGLE_D180'?
        rotate = VIPS_ANGLE_180;
                 ^~~~~~~~~~~~~~
                 VIPS_ANGLE_D180
/usr/local/Cellar/vips/7.42.1/include/vips/conversion.h:67:2: note: 'VIPS_ANGLE_D180' declared here
        VIPS_ANGLE_D180,
        ^
../src/sharp.cc:128:18: error: use of undeclared identifier 'VIPS_ANGLE_270'; did you mean
      'VIPS_ANGLE_D270'?
        rotate = VIPS_ANGLE_270;
                 ^~~~~~~~~~~~~~
                 VIPS_ANGLE_D270

At some point, the variables VIPS_ANGLE_XXX were renamed to VIPS_ANGLE_DXXX: https://github.com/jcupitt/libvips/commit/154796a8dc091ad545b6d56896b47e324c1471ab

Is this a version incompatibility with the libvips package? Is there an easy way to resolve this?

gscottolson avatar Jan 19 '15 16:01 gscottolson

Yes, as you spotted, the libvips API for angles changed slightly in 7.42.0.

v0.7.0+ of sharp has the https://github.com/lovell/sharp/commit/46f229e308da94074b6aeaa69b0a9a790ff6c0a2 fix, which allows it to work with versions of libvips before and after this.

If you're going to upgrade libvips and therefore upgrade sharp from v0.6.2, I recommend taking it all the way to the latest v0.8.4 to pick up changes that improved colour/profile handling and image quality.

lovell avatar Jan 19 '15 17:01 lovell

Thanks, @lovell. I appreciate the quick reply.

gscottolson avatar Jan 19 '15 17:01 gscottolson

@gscottolson Were you able to get this working with a more recent version?

lovell avatar Jan 31 '15 11:01 lovell

Yes! Thanks for following up. Feel free to close this issue.

gscottolson avatar Jan 31 '15 16:01 gscottolson