5

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.

Kacy
  • 3,330
  • 4
  • 29
  • 57
  • Please edit your post to show RHEL version : `cat /etc/redhat-release` . – Knud Larsen Jul 03 '16 at 09:54
  • @KnudLarsen I actually made a small mistake in assuming it was a redhat instance because it uses `yum` (compared to `apt-get`). It's just an Amazon Linux instance, not redhat. Edited my post. The command `cat /etc/system-release` results in `Amazon Linux AMI release 2016.03`. – Kacy Jul 03 '16 at 10:18
  • 1
    Amazon Linux AMI release 2016.03 : OK, glibc-2.17 , gcc-4.8.3 , yum , kernel-4.4.11 : That's close to CentOS 7 (RHEL7) .... I will try if libstc++-5.1.1 or similar will fit : To have the object GLIBCXX_3.4.21 available. And also make a test build of `libzmq`, preferably to `libzmq-4.2.0-1.el7-x86_64.rpm` ... – Knud Larsen Jul 03 '16 at 10:45

3 Answers3

1

Replacing libstdc++(.so.6) with a later version will prevent the c++ compiler from working. But no issues by running applications depending on a later version of libstdc++.so.6 . Example : libstdc++.so.6.0.21 https://drive.google.com/file/d/0B7S255p3kFXNNTIzU2thRlZmYVE/view?usp=sharing

Or as package, libstdc++-5.1.0-1.el7.x86_64.rpm https://drive.google.com/file/d/0B7S255p3kFXNVFljeEFXV3d6RlU/view?usp=sharing ( # rpm -Uvh --force --nodeps [package] ) Note : You will need to do rpm -Uvh --force libstdc++-4.8.5-4.el7.x86_64.rpm to replace the alien package with the default one http://mirror.centos.org/centos/7.2.1511/os/x86_64/Packages/libstdc++-4.8.5-4.el7.x86_64.rpm

Suggest : Build your applications, libraries with the default libstdc++.


EDIT : I just remembered the right solution for starting applications with a later version of a library. Say you have the new library as /opt/libcxx/{libstdc++-so.6 -> libstdc++.so.6.0.21}

Then you can do export LD_LIBRARY_PATH=/opt/libcxx:$LD_LIBRARY_PATH && [executeable] , and /opt/libcxx/ will come first in the LD_LIBRARY_PATH. You can create a start script with the above command. Just like later versions of firefox was started in CentOS 4.



libzmq : # yum install autoconf automake libtool asciidoc xmlto libunwind-devel

Your version of libzmq ( version = 4.2.0 → $ sh version.sh >> VERSION ) has a bug.

However, "v4.1.6" is OK : git clone https://github.com/zeromq/zeromq4-1.git

Packages, from the edited libzmq/packaging/redhat/libzmq.spec : zeromq-4.1.6-1.el7.centos.x86_64.rpm https://drive.google.com/file/d/0B7S255p3kFXNYllfbUhjd0c5Qm8/view?usp=sharing ... and zeromq-devel-4.1.6-1.el7.centos.x86_64.rpm https://drive.google.com/file/d/0B7S255p3kFXNNExVMkpxQzlxcWc/view?usp=sharing

The packages provide /usr/bin/curve_keygen, /usr/lib64/{libzmq.so.5 -> libzmq.so.5.0.1 <- libzmq.so, libzmq.a}


EDIT : Building zerorpc : git clone https://github.com/0rpc/zerorpc-python.git

# yum install python-devel python-setuptools ... cd zerorpc-python/; # python(27) setup.py install

Knud Larsen
  • 5,753
  • 2
  • 14
  • 19
  • Thank you for the quick response and all the information, but it's still a little unclear to me on exactly what I should do. Could you maybe number the steps I should take so it's more clear? Also, I'm using the node.js version of zerorpc and not python. – Kacy Jul 03 '16 at 17:31
  • 1
    » the steps I should take « : For which library ? About libzmq : Just install the downloaded packages : `cd Downloads/` ; # `yum install zeromq-*.rpm` – Knud Larsen Jul 03 '16 at 18:09
  • I uninstalled everything I did before, downloaded the rpm packages and ran the `yum install` command on them, cloned v4.1.6 and performed the same instructions I did on the other version to install it, and I still receive the error GLIBCXX_3.4.21 not found. Did I miss a step? – Kacy Jul 04 '16 at 00:39
  • » and I still receive the error GLIBCXX_3.4.21 not found « : ?Which command will cause the error ? . – Knud Larsen Jul 04 '16 at 09:03
  • I receive the error when I run zerorpc's full example for the server: https://github.com/0rpc/zerorpc-node So for me, the command is: `node server.js` – Kacy Jul 04 '16 at 09:53
  • You can add libstdc++.so.6.0.21 to /usr/lib64/, delete the link libstdc++.so.6, and do # `ln -s libstdc++.so.6.0.21 libstdc++.so.6`, then your application should work ... **But** : The c++ compiler g++ can then not be used. ( But you can always change the link to point to libstdc++.so.6.19 again.) – Knud Larsen Jul 04 '16 at 22:04
  • That seems a little dangerous. I can't imagine what would happen if I forgot to change file back and restarted the machine at some point. It's too bad there's not a repo you can add to `yum` to get a more up to date version of the compiler/library. – Kacy Jul 05 '16 at 04:49
1

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.

Community
  • 1
  • 1
Kacy
  • 3,330
  • 4
  • 29
  • 57
0

I leave here my solution. Even the problem came from a different "framework", maybe my solution could give you some idea.

My Matlab was linking against its libstdc++.so.6 library, in its root path, instead of the system one. And it was old version for the task I was doing using gstream lib. So, I have renamed the Matlab's .so file, for forcing to Matlab link against the system version.

I guess this topic is solved, but I write here my experience, just in case it can help other people.

Arritmic
  • 474
  • 2
  • 12