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

version `GLIBCXX_3.4.22' not found #2297

Closed
aminya opened this issue Jan 6, 2021 · 4 comments
Closed

version `GLIBCXX_3.4.22' not found #2297

aminya opened this issue Jan 6, 2021 · 4 comments

Comments

@aminya
Copy link

aminya commented Jan 6, 2021

  • Node Version: 12 (Electron: 6.1.12)
  • Platform: Ubuntu 20.04.1, Ubuntu 18.04.5
  • Compiler: Clang
  • Module: general question

Hi, I am a library writer, and I have written a node-addon that is pre-built and shipped to the users. However, the built binary apparently requires GLIBCXX_3.4.22 for some reason, although I have provided -std=c++17 and I expect the node addon to be built statically.

My Ubuntu users (especially those who use snaps) send me this kind of log:

Error: /snap/core/current/usr/lib/x86_64-linux-gnu/libstdc  .so.6: version `GLIBCXX_3.4.22' not found

How can I prevent this error? As I said, I specify the std like the following:
https://github.com/atom-community/zadeh/blob/master/binding.gyp#L16

          "cflags_cc": [ "-fno-exceptions", "-Ofast", "-std=c++17" ],

atom-community/ide-python#255:

Verbose output (from npm or node-gyp):

Error: /snap/core/current/usr/lib/x86_64-linux-gnu/libstdc  .so.6: version `GLIBCXX_3.4.22' not found (required by /home/kosma/.atom/packages/ide-python/node_modules/fuzzaldrin-plus-fast/build/Release/fuzzaldrinplusfast.node)
    at process.func (electron/js2c/asar.js:138:31)
    at process.func [as dlopen] (electron/js2c/asar.js:138:31)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:828:18)
    at Object.func (electron/js2c/asar.js:138:31)
    at Object.func [as .node] (electron/js2c/asar.js:138:31)
    at Module.load (internal/modules/cjs/loader.js:645:32)
    at Function.Module._load (internal/modules/cjs/loader.js:560:12)
    at Module.require (/app.asar/static/index.js:72:46)
    at require (/snap/atom/265/usr/share/atom/resources/app/static/<embedded>:11:146814)
    at /packages/ide-python/node_modules/fuzzaldrin-plus-fast/fuzzaldrin-dist.js:1:1650)
    at /packages/ide-python/node_modules/fuzzaldrin-plus-fast/fuzzaldrin-dist.js:1:3551)
    at /packages/ide-python/node_modules/fuzzaldrin-plus-fast/fuzzaldrin-dist.js:4:3)
    at Module.get_Module._compile (/snap/atom/265/usr/share/atom/resources/app/static/<embedded>:11:147498)
    at Object.value [as .js] (/snap/atom/265/usr/share/atom/resources/app/static/<embedded>:11:151046)
    at Module.load (internal/modules/cjs/loader.js:645:32)
    at Function.Module._load (internal/modules/cjs/loader.js:560:12)
    at Module.require (/app.asar/static/index.js:72:46)
    at require (/snap/atom/265/usr/share/atom/resources/app/static/<embedded>:11:146814)
    at /packages/ide-python/node_modules/atom-languageclient/build/lib/adapters/autocomplete-adapter.js:14:32)
    at /packages/ide-python/node_modules/atom-languageclient/build/lib/adapters/autocomplete-adapter.js:394:3)
    at Module.get_Module._compile (/snap/atom/265/usr/share/atom/resources/app/static/<embedded>:11:147498)
    at Object.value [as .js] (/snap/atom/265/usr/share/atom/resources/app/static/<embedded>:11:151046)
    at Module.load (internal/modules/cjs/loader.js:645:32)
    at Function.Module._load (internal/modules/cjs/loader.js:560:12)
    at Module.require (/app.asar/static/index.js:72:46)
    at require (/snap/atom/265/usr/share/atom/resources/app/static/<embedded>:11:146814)
    at /packages/ide-python/node_modules/atom-languageclient/build/lib/auto-languageclient.js:18:32)
    at /packages/ide-python/node_modules/atom-languageclient/build/lib/auto-languageclient.js:699:3)
    at Module.get_Module._compile (/snap/atom/265/usr/share/atom/resources/app/static/<embedded>:11:147498)
    at Object.value [as .js] (/snap/atom/265/usr/share/atom/resources/app/static/<embedded>:11:151046)
    at Module.load (internal/modules/cjs/loader.js:645:32)
    at Function.Module._load (internal/modules/cjs/loader.js:560:12)
    at Module.require (/app.asar/static/index.js:72:46)
    at require (/snap/atom/265/usr/share/atom/resources/app/static/<embedded>:11:146814)
    at /packages/ide-python/node_modules/atom-languageclient/build/lib/main.js:18:31)
    at /packages/ide-python/node_modules/atom-languageclient/build/lib/main.js:31:3)
@rvagg
Copy link
Member

rvagg commented Jan 6, 2021

Don't use Node.js from Snap to build this. It's probably using the 16.04 Snap Core which you can't really escape for building addons, it's got an older glibc and you can't upgrade it within the Snap, you have to rely on what's shipped in the base Snap. I suppose you're using an Electron Snap here, I don't know what base they're using, but it's probably going to be from 16.04 or 18.04. For the Node.js Snap, I think we have it pinned to 16.04 for v12.x. For C++17 you're probably going to have a bit of problem anywhere near Snap at all tbh, even for your users, so you might want to advise them on that.

@rvagg rvagg closed this as completed Jan 6, 2021
@aminya
Copy link
Author

aminya commented Jan 6, 2021

I build the node-addon using normal Node, but when used on a Snap, these problems happen. For now, I think I should update the base snap libraries.

@rvagg
Copy link
Member

rvagg commented Jan 6, 2021

you're going to have this trouble in general when making your addon usable on older systems

One option for you might be to build your addon on centos using the devtoolset that has the GCC version you need, the devtoolsets are designed to be backward compatible to older glibc versions for newer GCCs. That's how we build Node.js itself and make it maximally compatible with older systems. It's a bit annoying to set up but easy to do in Docker once you have the pieces in place and can script it.

@aminya
Copy link
Author

aminya commented Apr 18, 2021

@rvagg Returning back to this. Isn't it possible to build the code statically so it is self-contained and doesn't require anything from the environment? I am seeing people having this issue even without snaps.

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