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

Error: librsvg-2.so.2: cannot enable executable stack as shared object requires: #3917

Closed
Lc0rE opened this issue Feb 8, 2018 · 5 comments · May be fixed by tejzpr/gatsby#63
Closed

Error: librsvg-2.so.2: cannot enable executable stack as shared object requires: #3917

Lc0rE opened this issue Feb 8, 2018 · 5 comments · May be fixed by tejzpr/gatsby#63

Comments

@Lc0rE
Copy link

Lc0rE commented Feb 8, 2018

Description

After upgrading both gatsby-cli and all the gatsby-* dependencies and plugins in the package.json, I'm facing the following error invoking gatsby-develop:

error UNHANDLED EXCEPTION

Error: librsvg-2.so.2: cannot enable executable stack as shared object requires: Invalid argument

- v8-compile-cache.js:159 require
    [trucioli-di-legno]/[v8-compile-cache]/v8-compile-cache.js:159:20

  - constructor.js:10 Object.<anonymous>
    [trucioli-di-legno]/[gatsby-plugin-sharp]/[sharp]/lib/constructor.js:10:15

  - v8-compile-cache.js:178 Module._compile
    [trucioli-di-legno]/[v8-compile-cache]/v8-compile-cache.js:178:30

  - v8-compile-cache.js:159 require
    [trucioli-di-legno]/[v8-compile-cache]/v8-compile-cache.js:159:20

  - index.js:3 Object.<anonymous>
    [trucioli-di-legno]/[gatsby-plugin-sharp]/[sharp]/lib/index.js:3:15

  - v8-compile-cache.js:178 Module._compile
    [trucioli-di-legno]/[v8-compile-cache]/v8-compile-cache.js:178:30

  - v8-compile-cache.js:159 require
    [trucioli-di-legno]/[v8-compile-cache]/v8-compile-cache.js:159:20

Environment

Gatsby version: 1.9.183
Node.js version: 8.9.4
Operating System: Windows 10 on WSL (Ubuntu)

Any ideas on what could cause this unexpected behavior? This only occurs on the WSL substrate on Windows 10. I tested it on macOS and it works fine.

I tried to delete both node_modules, .cache/ and build/ folders but nothing changed.

@m-allanson
Copy link
Contributor

@Lc0rE This could be an issue with sharp and WSL. It looks like there's some suggested workarounds over at lovell/sharp-libvips#3

@Lc0rE
Copy link
Author

Lc0rE commented Feb 8, 2018

Sorry, I forgot to mention that I tried to follow the steps proposed in the sharp issue you linked.

Trying to invoke the command execstack -c node_modules/sharp/vendor/lib/librsvg-2.so.2 gives me a execstack: cannot open "node_modules/sharp/vendor/lib/librsvg-2.so.2": No such file or directory error because it can't find the sharp library installed.

Since, as far as I understand, gatsby-image is relying on the sharp library to work, I'm wondering where to find the sharp module.

There is a sharp folder in node_modules/gatsby-plugin-sharp/sharp but it doesn't contain the librsvg-2.so.2 file.

@Lc0rE
Copy link
Author

Lc0rE commented Feb 8, 2018

Ok apparently I solved the issue like this:

  • cd node_modules/gatsby-plugin-sharp
  • execstack -c node_modules/sharp/vendor/lib/librsvg-2.so.2

At this point, invoking gatsby develop is giving back a Cannot find module sharp. While I don't recall of having installed sharp manually, the following steps are solving the issue:

  • back to the root of the project
  • npm install --save sharp

Now it's working.. hope it helps!

@KyleAMathews
Copy link
Contributor

gatsby-image depends on gatsby-transformer-sharp which depends on gatsby-plugin-sharp which depends on sharp. In case you were curious about the exact genealogy here :-)

@strarsis
Copy link

strarsis commented Feb 19, 2018

@Lc0rE: Thanks a lot! Could this workaround be somehow added to sharp build script?
Or the underlying cause (librsvg-2.so.2) requires a library by its original ELF header?

For me this single command sufficed:

$ execstack -c node_modules/sharp/vendor/lib/librsvg-2.so.2

Current long-term fix for me is this command as postinstall script in package.json of the project using it:

"postinstall": "execstack -c node_modules/sharp/vendor/lib/librsvg-2.so.2"

Edit: Note: With recent sharp and node the workaround above may not be needed anymore and could cause a build error.

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