Issues between OpenJDK 11 and libstdc++

General support questions
Post Reply
saotoquio
Posts: 4
Joined: 2023/04/27 08:49:20

Issues between OpenJDK 11 and libstdc++

Post by saotoquio » 2023/04/27 08:57:15

Hello. I have been using OpenJDK 11 with no problems to run my Tomcat servers, however, an user of this system made some changes recently and I am now completely unable to start Tomcat and I am not able to run Java packages either. When I try to check my Java version, this is what happens:

$ java --version
Error: dl failure on line 606
Error: failed /usr/lib/jvm/java-11-openjdk-11.0.19.0.7-1.el7_9.x86_64/lib/server/libjvm.so, because /lib64/libstdc++.so.6: undefined symbol: __cxa_thread_atexit_impl

I am completely lost on what to do. At first I thought it was something related to Java, so I tried reinstalling, but nothing changed. I realize that it is related to the libstdc++ libraries instead. I have very little experience with c++ libraries and after searching about this error for days I did not reach any conclusions.
Can someone please shed me some light on what could be the issue?

Thank you!

User avatar
TrevorH
Site Admin
Posts: 32772
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Issues between OpenJDK 11 and libstdc++

Post by TrevorH » 2023/04/27 09:12:25

Is your system fully up to date? If you run yum update are you offered any updates?
CentOS 8 died a premature death at the end of 2021 - migrate to Rocky/Alma/OEL/Springdale ASAP.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are dead, do not use them.
Use the FAQ Luke

saotoquio
Posts: 4
Joined: 2023/04/27 08:49:20

Re: Issues between OpenJDK 11 and libstdc++

Post by saotoquio » 2023/04/28 06:04:26

Thank you for your reply, I did run the update command and there were several updates offered which I did, but the error still persists. I found the cause of it, I checked the history of one of our users and found out he did some changes to the system and I need some help figuring out if there is a way of undoing it. Here is the history:

Code: Select all

sudo yum -y install gcc
sudo yum -y install gcc-c++
sudo yum -y install gcc-gfortran
strings /usr/lib64/libstdc++.so.6 | grep GLIBC
gcc --version
cd /usr/local/gcc/lib64
sudo find /-name "libstdc++.so*"
sudo find / -name "libstdc++.so*"
sudo ln -sf /usr/lib64/libstdc++.so.6.0.19
ifort -v
sudo ln -sf /usr/lib64/libstdc++.so.6.0.19 /usr/lib64/libstdc++.so.6
strings /usr/lib64/libstdc++.so.6 | grep GLIBC
sudo yum -y install centos-release-scl
sudo yum -y install devtoolset-7-gcc devtoolset-7-gcc-c++ devtoolset-7-binutils
scl enable devtoolset-7 bash
sudo source ~/.bashrc
sudo echo "source /opt/rh/devtoolset-7/enable">>/etc/profile
ifort -v
strings /lib64/libstdc++.so.6 | grep GLIBC
strings /lib64/libstdc++.so.6.0.19 | grep GLIBC
find / -name "libstdc++.so*"
sudo cp /home/user/matlab/sys/os/glnxa64/libstdc++.so.6.0.28 /lib64
cd /lib64
sudo rm -f libstdc++.so.6
sudo ln -s libstdc++.so.6.0.28 libstdc++.so.6
strings /lib64/libstdc++.so.6 | grep GLIBC
It seems that he replaced my libstdc++.so.6 with libstdc++.so.0.28 and deleted the original one. Is there a way of fixing it? I am not familiar with c++ packages but it is affecting my Java libraries. Any help would be appreciated. Thank you!

User avatar
TrevorH
Site Admin
Posts: 32772
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Issues between OpenJDK 11 and libstdc++

Post by TrevorH » 2023/04/28 12:19:02

Code: Select all

[root@centos7 ~]# rpm -qf /lib64/libstdc++.so.6
libstdc++-4.8.5-44.el7.x86_64
That shows that the real /lib64/libstdc++.so.6 should be provided by the libstdc++-4.8.5-44.el7.x86_64. To fix that you could just yum reinstall
libstdc++
and that would overwrite the change made to that file and restore the correct one.

I suspect you should also remove this user's ability to run sudo!
CentOS 8 died a premature death at the end of 2021 - migrate to Rocky/Alma/OEL/Springdale ASAP.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are dead, do not use them.
Use the FAQ Luke

saotoquio
Posts: 4
Joined: 2023/04/27 08:49:20

Re: Issues between OpenJDK 11 and libstdc++

Post by saotoquio » 2023/05/23 02:03:13

Thank you very much for your reply! I have tried reinstalling libstdc++ but it seems that the issue is still persisting, I tried it twice and also restarted the machine but when I run:

Code: Select all

$ javac --version
Error: dl failure on line 606
Error: failed /usr/lib/jvm/java-11-openjdk-11.0.19.0.7-1.el7_9.x86_64/lib/server/libjvm.so, because /lib64/libstdc++.so.6: undefined symbol: __cxa_thread_atexit_impl
It looks like the file is still corrupted, do you have any suggestions on what can be done? Is it possible to manually replace the libstdc++.so.6 file in a safe way?

Thank you!

Whoever
Posts: 1335
Joined: 2013/09/06 03:12:10

Re: Issues between OpenJDK 11 and libstdc++

Post by Whoever » 2023/05/23 03:33:25

What does the following command return:

Code: Select all

 
rpm -V libstdc++
 
It may return nothing.

You might want to clean up /etc/profile, removing the changes the user made.

saotoquio
Posts: 4
Joined: 2023/04/27 08:49:20

Re: Issues between OpenJDK 11 and libstdc++

Post by saotoquio » 2023/05/24 04:15:54

The command returns this:

Code: Select all

$ rpm -V libstdc++
....L....    /usr/lib64/libstdc++.so.6
Does it mean that when one of the Java libraries I use call for libstdc++, it is pointed towards /usr/lib64/libstdc++.so.6 instead of /lib64/libstdc++.so.6 ? I am trying to understand what the user has done, I never cleaned up changes before but looking at this previous commands he did try to source things to ~/.bashrc multiple times.

User avatar
TrevorH
Site Admin
Posts: 32772
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Issues between OpenJDK 11 and libstdc++

Post by TrevorH » 2023/05/24 09:14:35

$ rpm -V libstdc++
....L.... /usr/lib64/libstdc++.so.6
The symlink is still wrong. And you should run rpm -V as root so that it has access to everything that it needs to read to verify that it is correct.
CentOS 8 died a premature death at the end of 2021 - migrate to Rocky/Alma/OEL/Springdale ASAP.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are dead, do not use them.
Use the FAQ Luke

Post Reply