Hello,
I've been trying to add Sharp to a project I'm working on.
This is the environment I'm using:
Installation goes on fine, but running it fails with the following error:
module.js:689
return process.dlopen(module, path.toNamespacedPath(filename));
^
Error: librsvg-2.so.2: cannot enable executable stack as shared object requires: Invalid argument
at Object.Module._extensions..node (module.js:689:18)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/mnt/c/Users/Bogdan Calapod/Repos/TechLounge/harmonia/node_modules/sharp/lib/constructor.js:10:15)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
What's interesting is that it fails on just including sharp.
What I've tried:
rm -rf node_modules && yarn cache cleanlibvips and libvips-devSteps to reproduce:
npm init and npm install --save sharpconst sharp = require('sharp')node index.jsIt will fail with the above error.
Any ideas ? Is there any debug flag that I can set to see more info about what's happening?
A web search for "cannot enable executable stack as shared object" returns https://github.com/Microsoft/WSL/issues/286 which has some suggestions.
I've looked over the issues posted, it seems to have something to do with executable stack not being supported yet on WSL.
I tried playing around with execstack -c as the commenters suggested, but got a bit over my head. Well, I guess it's a WSL issue, not a sharp one after all.
Thanks for your effort!
Running execstack -c node_modules/sharp/vendor/lib/librsvg-2.so.2 might fix this.
It's possible librsvg has the execstack flag set for a reason, perhaps function trampolines are used due to the mix of Rust and C sources?
I've created https://github.com/lovell/sharp-libvips/issues/3 to investigate what, if anything, can be done.
This worked wonders for me on a Windows installation...
set GYP_MSVS_VERSION=2015
npm install --msvs_version=2015
npm install node-gyp -g
npm install sharp
Using Yarn?
I went into a different directory and just installed it there, it's all global so it works. Also did this so it wouldn't conflict with my yarn node_modules folder.
Most helpful comment
Running
execstack -c node_modules/sharp/vendor/lib/librsvg-2.so.2might fix this.It's possible librsvg has the execstack flag set for a reason, perhaps function trampolines are used due to the mix of Rust and C sources?
I've created https://github.com/lovell/sharp-libvips/issues/3 to investigate what, if anything, can be done.