Skip to content

Cannot get canvas running on CentOS 7 #1796

Open
@Commandtechno

Description

@Commandtechno

I have been trying to get node canvas to work on CentOS 7 yet I keep getting this error that libstdc.6.so version CXXABI 1.3.9 is not found, from checking the version with strings /lib64/libstdc++.so.6 | grep CXXABI it lists the versions from 1.3 to 1.3.7. I found 1.3 - 1.3.10 in <project directory>/node_modules/canvas/build/Release/libstdc.so.6. I was wondering if anybody has had similar issues and know a fix, a way to redirect it to use that file (I tried LD_LIBRARY_PATH, but it didn't seem to do anything), or anything that could help. I also have the full console log below if it helps.

Issue or Feature

[server]$ node .
node:internal/modules/cjs/loader:1161
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /home/username/server/node_modules/canvas/build/Release/canvas.node)
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1161:18)
    at Module.load (node:internal/modules/cjs/loader:967:32)
    at Function.Module._load (node:internal/modules/cjs/loader:807:14)
    at Module.require (node:internal/modules/cjs/loader:991:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (/home/username/server/node_modules/canvas/lib/bindings.js:3:18)
    at Module._compile (node:internal/modules/cjs/loader:1102:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
    at Module.load (node:internal/modules/cjs/loader:967:32)
    at Function.Module._load (node:internal/modules/cjs/loader:807:14) {
  code: 'ERR_DLOPEN_FAILED'
}

Steps to Reproduce

const canvas = require('canvas')
npm i canvas
node .

Your Environment

  • Version of node-canvas (output of npm list canvas or yarn list canvas): canvas@2.7.0
  • Environment (e.g. node 4.2.0 on Mac OS X 10.8):
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"

ty image

Activity

wesleimarinho

wesleimarinho commented on May 10, 2021

@wesleimarinho

Downgrading to canvas 2.6.1 solves the problem while we don't get it fixed on newest version (2.7.0).

Commandtechno

Commandtechno commented on May 11, 2021

@Commandtechno
Author

I seem to be getting the same issue, am I doing something wrong?

node:internal/modules/cjs/loader:1161
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /home/username/project/node_modules/canvas/build/Release/canvas.node)
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1161:18)
    at Module.load (node:internal/modules/cjs/loader:967:32)
    at Function.Module._load (node:internal/modules/cjs/loader:807:14)
    at Module.require (node:internal/modules/cjs/loader:991:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (/home/username/project/node_modules/canvas/lib/bindings.js:3:18)
    at Module._compile (node:internal/modules/cjs/loader:1102:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
    at Module.load (node:internal/modules/cjs/loader:967:32)
    at Function.Module._load (node:internal/modules/cjs/loader:807:14) {
  code: 'ERR_DLOPEN_FAILED'
}

[server]$ npm ls canvas
project@1.0.0 /home/username/project
└── canvas@2.6.1
njh

njh commented on May 25, 2021

@njh

I have also experienced this problem on CentOS Linux release 7.6.1810 (Core).

I have worked around this by rebuilding the binary in my project after doing npm install:

npx node-pre-gyp rebuild -C ./node_modules/canvas

I'm not sure if there is a way of telling npm to install from source in my package.json?

sinbargit

sinbargit commented on Jun 3, 2021

@sinbargit

any update?

ABValois

ABValois commented on Jun 7, 2021

@ABValois

Seems like this problem is a similar to this issue on the VSCode repository (linked because it has loads of great discussion about the cause of the problem). I have spent a few hours today trying to fix this in a docker environment running CentOS Linux release 7.9.2009 (Core) and, like in the issue I linked, running the following reveals the missing CXXABI version (note the absence of 1.3.9, added in a version of gcc that CentOS 7 does not include):

$ strings /lib64/libstdc++.so.6 | grep CXXABI
CXXABI_1.3
CXXABI_1.3.1
CXXABI_1.3.2
CXXABI_1.3.3
CXXABI_1.3.4
CXXABI_1.3.5
CXXABI_1.3.6
CXXABI_1.3.7
CXXABI_TM_1
zbjornson

zbjornson commented on Jun 7, 2021

@zbjornson
Collaborator

I don't think this is something that any of the maintainers have capacity to work on unfortunately (I don't, at least). For Canvas 2.7.0 we had to upgrade the OS used for prebuilds to support the current versions of Node.js, which apparently used a newer CXXABI than CentOS 7 has. Using Canvas 2.6 should work, as should building from source following the steps in the readme.

I'm not sure if there is a way of telling npm to install from source in my package.json?

It should already be trying to build from source if it can't install a prebuild:

"install": "node-pre-gyp install --fallback-to-build",

njh

njh commented on Jun 7, 2021

@njh

It should already be trying to build from source if it can't install a prebuild

It does successfully download/install the binary.
But the binary doesn't work because of the ABI issues.
Would be really handy if there was a way of telling it not to use the binary for node-canvas and always compile from source, to work around this problem.

I am not in a hurry to upgrade to CentOS 8, because it reaches end-of-life before CentOS 7 😞

Gwynbleidd79

Gwynbleidd79 commented on Aug 20, 2021

@Gwynbleidd79

I'm getting this error too with 2.7.0 and 2.8.0, i can't use 2.6.1 couse node v16.6.1 don't support it

stringang

stringang commented on Sep 14, 2021

@stringang

Seems like this problem is a similar to this issue on the VSCode repository (linked because it has loads of great discussion about the cause of the problem). I have spent a few hours today trying to fix this in a docker environment running CentOS Linux release 7.9.2009 (Core) and, like in the issue I linked, running the following reveals the missing CXXABI version (note the absence of 1.3.9, added in a version of gcc that CentOS 7 does not include):

$ strings /lib64/libstdc++.so.6 | grep CXXABI
CXXABI_1.3
CXXABI_1.3.1
CXXABI_1.3.2
CXXABI_1.3.3
CXXABI_1.3.4
CXXABI_1.3.5
CXXABI_1.3.6
CXXABI_1.3.7
CXXABI_TM_1

Is the problem now solved?

stringang

stringang commented on Sep 17, 2021

@stringang

this is my solution in Centos7:

1. Manually upgrade the GCC version

yum -y update
yum -y install bzip2 wget gcc gcc-c++ gmp-devel mpfr-devel libmpc-devel
wget https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-8.2.0/gcc-8.2.0.tar.gz
tar zxf gcc-8.2.0.tar.gz
cd gcc-8.2.0
./contrib/download_prerequisites
./configure --disable-multilib --enable-languages=c,c++
make -j$(nproc)
make install 

2. Update libstdc++

Command

find / -name "libstdc++.so.6*"

Output

/usr/local/lib64/libstdc++.so.6
/usr/local/lib64/libstdc++.so.6.0.25
/usr/local/lib64/libstdc++.so.6.0.25-gdb.py
/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.py
/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.pyc
/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.pyo
/usr/lib64/libstdc++.so.6
/usr/lib64/libstdc++.so.6.0.19
/usr/lib64/libstdc++.so.6.0.25
/root/gcc-8.2.0/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6
/root/gcc-8.2.0/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.25
/root/gcc-8.2.0/stage1-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6
/root/gcc-8.2.0/stage1-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.25
/root/gcc-8.2.0/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6
/root/gcc-8.2.0/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.25

Command

cp /root/gcc-8.2.0/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.25 /lib64
rm -f /lib64/libstdc++.so.6
cd /lib64
ln -s /lib64/libstdc++.so.6.0.25 libstdc++.so.6

3. Installing node-canvas compilation dependencies

yum install gcc-c++ cairo-devel pango-devel libjpeg-turbo-devel giflib-devel

4. Installing node-canvas

npm install canvas
npx node-pre-gyp rebuild -C ./node_modules/canvas

Install canvas:2.8.0 successfully.

20 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @njh@gelinger777@zbjornson@mohamadpk@Jayafp

        Issue actions

          Cannot get canvas running on CentOS 7 · Issue #1796 · Automattic/node-canvas