Automattic / Automattic/node-canvas

node: symbol lookup error when trying to draw fonts with node-gd also loaded

Open
#1,372 2 comments 0 reactions 0 assignees View on GitHub
Binaries
Dominant language
JavaScript
Stars
10.7k
Forks
1.2k
Avg merge
4d 8h
Merged PRs (30d)
1

Description

I am trying to draw a file with text in it. Initially I was trying to use text2png which used this as a dependency, but I get the same problem when using it alone.

## Issue or Feature
Here is the error message I receive:

`node: symbol lookup error: /home/ubuntu/workspace/node_modules/canvas/build/Release/libpangoft2-1.0.so.0: undefined symbol: FcWeightFromOpenTypeDouble`

`Process exited with code: 127`

## Steps to Reproduce
Running this code produces the error
```
var gd = require('node-gd');
var fs = require('fs-extra');
const {Canvas} = require('canvas');
const canvas = new Canvas(100, 100);
const ctx = canvas.getContext('2d');
ctx.font = '12px Impact';
ctx.fillText('It don\'t work!', 0, 20);
canvas.createPNGStream().pipe(fs.createWriteStream('out31.png'));
```

If I remove the first line (node-gd) the code runs as expected. If I remove the lines drawing the font, it also runs without error. The problem is my app uses node-gd in a lot of places, and I would like to use this as well. But it seems any time node-gd is loaded before drawing, it gives the error.

## Your Environment
* Version of node-canvas = ^2.3.1
* Environment = Ubuntu 16.04.5

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.