Fix the error: CXXABI 1.3.9 not found on CentOS 7 running DirectAdmin

 https://azdigi.com/blog/en/webserver-panel-en/directadmin-en/fix-the-error-cxxabi-1-3-9-not-found-on-centos-7-running-directadmin/

In this article, AZDIGI will guide how to solve CXXABI 1.3.9 not found error and how to upgrade GCC on CentOS 7.

1. Overview

In the process of administering VPS/Server, you will sometimes encounter argon2 errors, Bcrypt errors on Nodejs, which are caused by the lack of CXXABI 1.3.9 on the server. The system will display the following error message:

  
AZDIGI Tutorial
ImportError: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by ......)
    

So I decided to learn how to install and everything worked fine on the DirectAdmin server.

2. SSH into your DirectAdmin system

To handle the error CXXABI 1.3.9 not found, first we need to SSH or access your VPS or server with root privileges first. If you do not know how to SSH into your VPS/Server, you can refer to the following tutorial:

After successfully SSHing, we continue with the next step to check what versions your CXXABI library has.

3. Check the installed versions of CXXABI

To check the installed versions of CXXABI, we use the following command:

  
AZDIGI Tutorial
strings /usr/lib64/libstdc++.so.6 | grep CXXABI
    

Here are my results:

CXXABI 1.3.9 not found

My highest version of CXXABI is only 1.3.7, to have new versions you need to upgrade GCC on your server. We continue with the following steps to install newer GCC to help CXXABI have newer versions.

4. Install GCC from the source

Default CentOS 7 server latest GCC version when installing from the library yum just a copy4.8.5 only, a very old version released in 2015. To check the GCC version you can use the commandgcc --version . Even if you use the command yum -y install gcc gcc-c++ then the latest version will also be 4.8.5 .

To install a higher version of GCC, you need to compile from the source, follow these steps:

Step 1: Create a screen before proceeding to install GCC from the source

Because the installation process takes quite a while, you need to go to a screen so that you can continue watching when you miss the SSH connection. To create a screen we use the following command:

  
AZDIGI Tutorial
screen -U -S gcc
    

If you are not familiar with using or installing screen, you can refer to the following article:

Step 2: Commands to install GCC from the source

Note: Before performing this step, you shouldcd Go to a partition with more than 6Gb of free space, because the compilation process will create a data volume that weighs nearly 6Gb.

The installation process from the source may take a few hours of your time because the compilation process will be quite long, and it will take longer on VPS/Server with low CPU configuration. Here are the commands you will need to execute:

  
AZDIGI Tutorial
wget http://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-7.3.0/gcc-7.3.0.tar.gz
tar zxf gcc-7.3.0.tar.gz
cd gcc-7.3.0
yum -y install bzip2
./contrib/download_prerequisites
./configure --disable-multilib --enable-languages=c,c++
make -j 4
make install
    

Explanation of the above commands:

  • Command 1: Download the GCC source code version 7.3.0, you can replace it with another version if you want at the following link: http://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases /
  • Command 2: Extract the downloaded gcc-7.3.0.tar.gz file.
  • Command 3: Move to the newly extracted foldergcc-7.3.0 .
  • Command 4: Install the bzip2 library because it will be needed during the compilation process.
  • Command 5: Run the ‘download_prerequisites’ script to download some of the prerequisites that GCC needs. You must run this command from the root of the directorygcc-7.3.0 rather than the subdirectories inside it.
  • Command 6: Once the prerequisites are downloaded, execute this command to start configuring the GCC build environment.
  • Command 7: Compile GCC source code.
  • Command 8: Install GCC from the source.

Below are some pictures during the installation process:

Command 7: Compile GCC source code.
Command 8: Install GCC from the source.

In command 7 you can take up to several hours if your server has a low configuration. You can sleep and then wake up, don’t sit and wait 😄

After the installation is complete we use the commandgcc --version to check the newly installed version. Like here, I have the new version.

GCC

However, everything up to this point is not complete because using the following command results in no newer versions of CXXABI:

  
AZDIGI Tutorial
strings /usr/lib64/libstdc++.so.6 | grep CXXABI    

We see that the highest version is still only 1.3.7. The explanation for this problem occurs because whengcc upgraded, the generated dynamic library does not replace the old version’s dynamic librarygcc . We continue with the last step to replace the dynamic library of gcc .

Step 3: Replace the CXXAB library with GCC’s new version

To check the dynamic library of libstdc++ is available, you use the following command:

  
AZDIGI Tutorial
find / -name "libstdc++.so.*"
    

Here are my results:

CXXABI 1.3.9 not found

In this picture, you can see the version 6.0.24 of the libstdc++ is the new version installed after the update GCC 7.3 new.

We continue to use the following commands to replace the old version 6.0.19 present:

  
AZDIGI Tutorial
cp /usr/local/lib64/libstdc++.so.6.0.24 /usr/lib64/
cd /usr/lib64/
rm -rf libstdc++.so.6
ln -s libstdc++.so.6.0.24 libstdc++.so.6
    

Explanation of the above commands:

  • Command 1: Copy the library libstdc++.so.6.0.24 and go to the directory /usr/lib64/, maybe your server will have a different path than mine. So take a close look at this part.
  • Command 2: Move to the /usr/lib64/ directory.
  • Command 3: Remove the soft link to the old library.
  • Command 4: Contact the new library.

That’s all the steps are done. We can double-check the result with the old command:

  
AZDIGI Tutorial
strings /usr/lib64/libstdc++.so.6 | grep 'CXXABI'
    

Here are my results:

CXXABI 1.3.9 not found

It’s great, not only has it fixed the lack of a versionCXXABI_1.3.9, but we have a newer versionCXXABI_1.3.11.

5. Summary

Through this article, we can solve 2 problems that are errors: CXXABI 1.3.9 not found and upgrade GCC to a higher version when the yum library does not support upgrading to these versions. Although the above problems have nothing to do with DirectAdmin, because I use DirectAdmin, I will also mention it. You can completely do it on CentOS 7 systems or other control panels. Hope this article is helpful to you!

If you find the article useful, don’t forget to rate 5 stars.

Wishing you success.

Không có nhận xét nào:

StaticImage

  import React , { useEffect , useRef } from "react" import { StaticImage } from "gatsby-plugin-image" impor...