centos7 ./code-server: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found 解决方法

前言

最近听朋友说有个vscode(code-server github项目地址),只要在服务器上搭好,就可以随时用浏览器上去撸代码。
然后在虚拟机里试了试跑不起来。

问题

[root@localhost code-server1.939-vsc1.33.1-linux-x64]# ./code-server
./code-server: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./code-server)
./code-server: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./code-server)
./code-server: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by ./code-server)

环境:

  • 系统:Centos 7.5(1804)
  • GCC版本:4.8.5

第一步:

  • 检查本地是否有对应的运行库(libstdc++.so.6.0.21及以上)
    find / -name "libstdc++.so.6*"
    
  • 如果没有对应版本的运行库

    获取libstdc++.so.6.0.25版本库

    1. 方法一
      wget https://adbin.top/packages/lib64.tar.gz
      
    2. 方法二
      编译安装更新版本的gcc
      gcc8.2.0编译安装教程:地址

第二步:

cd /usr/lib64
cp libstdc++.so.6 libstdc++.so.6.bak
rm libstdc++.so.6
ln -s (对应路径)/libstdc++.so.6.0.25(对应版本即可,gcc8.2.0带的是libstdc++.so.6.0.25) libstdc++.so.6

检验是否成功,运行code-server:

[root@localhost code-server1.939-vsc1.33.1-linux-x64]# ./code-server
(node:11491) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
INFO  code-server v1.939-vsc1.33.1
INFO  Additional documentation: http://github.com/codercom/code-server
INFO  Initializing {"data-dir":"/root/.local/share/code-server","extensions-dir":"/root/.local/share/code-server/extensions","working-dir":"/home/test1/date/code-server1.939-vsc1.33.1-linux-x64","log-dir":"/root/.cache/code-server/logs/20190427090540573"}
INFO  Starting webserver... {"host":"0.0.0.0","port":8443}
WARN  No certificate specified. This could be insecure.
WARN  Documentation on securing your setup: https://github.com/codercom/code-server/blob/master/doc/security/ssl.md
INFO
INFO  Password: d58658e46d3a5b4adf6f8874
INFO
INFO  Started (click the link below to open):
INFO  http://localhost:8443/
INFO
INFO  Starting shared process [1/5]...
WARN  stderr {"data":"(node:11504) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.\n"}
INFO  Connected to shared process

运行成功!!!code-server
用浏览器登上去试试:
centos7 ./code-server: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found 解决方法_第1张图片

你可能感兴趣的:(linux)