dyarbrough
dyarbrough

Reputation: 871

Docker compose libstdc++.so.6 GLIBCXX_3.4.21 not found

When running docker-compose up in my node directory, I get

/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /app/node_modules/bcrypt/lib/binding/bcrypt_lib.node)

But I definitely have the glib:

strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX_3.4.2
GLIBCXX_3.4.2
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22

I tried doing

sudo add-apt-repository ppa:ubuntu-toolchain-r/test 
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

as per https://askubuntu.com/questions/164296/glibcxx-3-4-15-not-found but I get the same error. I have no idea how to resolve this and can't find a solution anywhere else.

This is on Ubuntu 16.04 if it matters.

Upvotes: 3

Views: 3592

Answers (1)

mscdex
mscdex

Reputation: 106736

Some node addons on npm use node-pre-gyp to provide the ability to download pre-compiled addon binaries so that you don't need a compiler installed to use it (mainly useful on Windows, where it is usually more difficult to get a build environment set up).

For these kinds of addons, you can specify a --build-from-source command line option to tell node-pre-gyp to always compile locally instead of downloading one of the pre-compiled addon binaries.

By installing the addon with this flag, you can avoid such errors when the pre-compiled addon binaries are compiled on older/newer machines that utilize different glibc ABIs.

Upvotes: 2

Related Questions