I apologize if this isn't the right place for this, but after 2 days of dealing with the same error, I'm hoping someone will have an answer.
I am trying to use the node module zerorpc, which uses zmq, however, when trying to run a small example, I get the following error:
Error: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by myFilepath/node_modules/zmq/build/Release/zmq.node)
I'm using an amazon linux instance provided by AWS (amazon web services). After performing a sudo yum update
, the latest version available is GLIBCXX_3.4.19. I checked using the following commands:
strings /usr/lib64/libstdc++.so.6.19 | grep GLIBCXX
strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX
Initially, I got this error using brew install zmq
, so I uninstalled it and tried installing zmq following the zeromq site's instructions:
git clone https://github.com/zeromq/libzmq
./autogen.sh && ./configure && make -j 4
make check && make install && sudo ldconfig
The only difference I made to these instructions was that I ran them individually instead of using &&
, and I added sudo in front of each one.
I also executed export LD_LIBRARY_PATH=/usr/local/lib
before running these.
I then did npm install zerorpc --save
.
Of course, I received the same error, so I uninstalled zerorpc, did a make clean
, and started all the steps over, except this time I changed the configure instruction to sudo ./configure CXX=/usr/bin/g++ CC=/usr/bin/gcc
. And again, I received the same error.
Hopefully someone has a suggestion. I really don't want to attempt to compile a newer gcc version from source as I know that will just be a new round of headaches.
I didn't necessarily "fix" the problem, but I did find a solution. Since I'm using AWS, I launched an Ubuntu instance (compared to the Amazon Linux instance I was using originally), and moved the project over.
The reason for doing this is because Ubuntu uses a different package manager. After updating and installing all the basic things to run the project, I actually encountered the exact same error again.
I then ran the following commands, and the error went away:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
These commands were suggested in another stackoverflow post.
I won't mark this as the accepted answer since moving to a different distribution probably isn't a viable solution for most people.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With