romgrk / node-gtk

GTK+ bindings for NodeJS (via GObject introspection)
MIT License
493 stars 41 forks source link

v0.11.0: `Error: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found` #337

Closed chfritz closed 5 months ago

chfritz commented 1 year ago

I'm getting this error when trying to use the latest version (0.11.0), i.e., after npm i node-gtk:

> require('node-gtk')
Uncaught:
Error: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /tmp/x/node_modules/node-gtk/lib/binding/node-v93-linux-x64/node_gtk.node)
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1249:18)
    at Module.load (node:internal/modules/cjs/loader:1043:32)
    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1067:19)
    at require (node:internal/modules/cjs/helpers:103:18) {
  code: 'ERR_DLOPEN_FAILED'
}

It works when I install 0.10.x or directly from github (npm i romgrk/node-gtk).

Any idea what might be missing in the published package?

I'm on node 16:

> npm --versions
{
  npm: '8.19.3',
  node: '16.19.0',
  v8: '9.4.146.26-node.24',
  uv: '1.43.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '93',
  nghttp2: '1.47.0',
  napi: '8',
  llhttp: '6.0.10',
  openssl: '1.1.1s+quic',
  cldr: '41.0',
  icu: '71.1',
  tz: '2022f',
  unicode: '14.0',
  ngtcp2: '0.8.1',
  nghttp3: '0.7.0'
}
ten0s commented 1 year ago

The problem is the addon has been built against libstdc++ that is newer than you have installed.

What the below commands print on your machine?

$ cat /etc/os-release
$ ls -l /lib/x86_64-linux-gnu/libstdc++.so.6
chfritz commented 1 year ago
> cat /etc/os-release 
NAME="Ubuntu"
VERSION="20.04.5 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.5 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

> ls -l /lib/x86_64-linux-gnu/libstdc++.so.6
lrwxrwxrwx 1 root root 19 May 29  2021 /lib/x86_64-linux-gnu/libstdc++.so.6 -> libstdc++.so.6.0.28
ten0s commented 1 year ago

libstdc++.so.6.0.28 is GLIBCXX_3.4.28

chfritz commented 1 year ago

Thanks. Good to know!

What's the difference between the binary included in the 0.11 tarball and https://node-gtk-1.s3.amazonaws.com/node_gtk/v0.11.0/node_gtk-node-v93-linux-x64.tar.gz, which is what is downloaded during installation when no binary exists? Or better: why are they built against different libstdc++?

ten0s commented 1 year ago

Seems like the answer to your question somewhere is the below three commits:

Anyway, if you target Linux versions 0.10.0 and 0.11.0 are pretty much the same.

But I would suggest to use the last commit and build from source.

chfritz commented 1 year ago

It looks like the 0.10 package doesn't contain a pre-built binary. Would it make sense to publish 0.11(.1) without the pre-built binary in the tarball?

chfritz commented 1 year ago

Btw, thanks a lot for your help and for this library! It has helped me a lot in getting gstreamer's webrtcbin to work from node.js!

romgrk commented 1 year ago

It looks like the 0.10 package doesn't contain a pre-built binary. Would it make sense to publish 0.11(.1) without the pre-built binary in the tarball?

I'm not sure, the prebuilt binary is kinda nice to avoid users needing compilation dependencies. This will probably be ugly but I think we'd need to split prebuilt binaries for different libstdc++ in use, in addition to splitting by OS & arch. I guess this only applies for linux.

chfritz commented 1 year ago

oh, I agree that prebuilt binaries are nice. But shouldn't they be downloaded from s3 at install-time, like it is done in 0.10 and when using github as a dependency directly? It seemed to me that 0.11 containing a tarball happened by accident.

proehlen commented 1 year ago

I'm getting this error when trying to use the latest version (0.11.0), i.e., after npm i node-gtk:

I get the exact same error, except it's version 0.12.0 I think.

It works when I install 0.10.x or directly from github (npm i romgrk/node-gtk).

I don't know what I'd lose using 0.10.x so I haven't tried that but, unfortunately, I still get the exact same error when using npm i romgrk/node-gtk.

proehlen commented 1 year ago

Unfortunately, I still get the exact same error when using npm i romgrk/node-gtk.

I was using nodejs installed from a snap package. I removed that and installed it via the NodeSource PPA and then was able to create and run node-gtk projects by using npm i romgrk/node-gtk.