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

node-canvas loads incorrect libcairo #1859

Open
ejoebstl opened this issue Jul 15, 2021 · 2 comments
Open

node-canvas loads incorrect libcairo #1859

ejoebstl opened this issue Jul 15, 2021 · 2 comments

Comments

@ejoebstl
Copy link

I am running into a segfault when trying to render a PDF using pdf.js onto a canvas instance.

I have tried to run node with GDB and this is the output. It seems like the segfault happens inside a libcairo that comes pre-bundled with another package.

free(): invalid pointer

Thread 1 "node" received signal SIGABRT, Aborted.
0x00007ffff7ab19e5 in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff7ab19e5 in raise () from /lib64/libc.so.6
#1  0x00007ffff7a9a8a4 in abort () from /lib64/libc.so.6
#2  0x00007ffff7af4007 in __libc_message () from /lib64/libc.so.6
#3  0x00007ffff7afbcdc in malloc_printerr () from /lib64/libc.so.6
#4  0x00007ffff7afd0ac in _int_free () from /lib64/libc.so.6
#5  0x00007fffd74780e5 in ?? ()
   from /home/emi/Projects/authory/api/node_modules/sharp/build/Release/../../vendor/lib/libcairo.so.2
#6  0x00007fffd747ae16 in ?? ()
   from /home/emi/Projects/authory/api/node_modules/sharp/build/Release/../../vendor/lib/libcairo.so.2
#7  0x00007fffd74e08c0 in ?? ()
   from /home/emi/Projects/authory/api/node_modules/sharp/build/Release/../../vendor/lib/libcairo.so.2
#8  0x00007fffd7483a58 in ?? ()
   from /home/emi/Projects/authory/api/node_modules/sharp/build/Release/../../vendor/lib/libcairo.so.2
#9  0x00007fffd747da71 in ?? ()
   from /home/emi/Projects/authory/api/node_modules/sharp/build/Release/../../vendor/lib/libcairo.so.2
#10 0x00007fffd74f09ca in cairo_paint_with_alpha ()
   from /home/emi/Projects/authory/api/node_modules/sharp/build/Release/../../vendor/lib/libcairo.so.2
#11 0x00007fffd4b16d1f in Context2d::DrawImage(Nan::FunctionCallbackInfo<v8::Value> const&) ()
   from /home/emi/Projects/authory/common/node_modules/node-canvas/build/Release/canvas.node
#12 0x00007fffd4b0b9f8 in Nan::imp::FunctionCallbackWrapper(v8::FunctionCallbackInfo<v8::Value> const&) ()
   from /home/emi/Projects/authory/common/node_modules/node-canvas/build/Release/canvas.node
[omitted]

When I remove the other package from the project, the code works normally.

How can I configure node-canvas to load the libcairo I have installed on my OS, or another version that is appropriate?

Environment

[email protected]
Fedora release 33
Node v12.22.1

@zbjornson
Copy link
Collaborator

I think this is a variation of #930. I haven't looked at the issue in a long time though. Node-canvas prebuilds use the latest versions of Cairo/etc., and it specifically loads the SOs that we bundle, so I'm not sure what the conflict is anymore.

@ejoebstl
Copy link
Author

@zbjornson Gotcha. Do you have an idea or any pointer how to approach debugging this?

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

No branches or pull requests

2 participants