zoukankan      html  css  js  c++  java
  • 安装node,linux升级gcc

    1 : 下载node包
    Node 官网已经把 linux 下载版本更改为已编译好的版本了,我们可以直接下载解压后使用:
    # wget https://nodejs.org/dist/v10.9.0/node-v10.9.0-linux-x64.tar.xz // 下载
    解压node-v10.9.0-linux-x64.tar.xz需要先安装xz
    (Linux下安装xz的方法
    1. cd /usr/local/pkg
    2. wget https://tukaani.org/xz/xz-5.2.3.tar.gz //下载到/usr/local/pkg目录下
    3. tar xvf xz-5.2.3.tar.gz
    4. cd xz-5.2.3
    5. ./configure --prefix=/usr/local/xz //将xz软件安装到/usr/local/xz目录下
    此处,如果出现如下错误:
    configure: error: in `/usr/local/xz’:
    configure: error: no acceptable C compiler found in $PATH
    See `config.log’ for more details
    说明缺少GCC软件套件
    执行:yum install gcc
    安装完成后 ,执行:./configure --prefix=/usr/local/xz
    1. make
    2. make install
    3. vi /etc/profile
    设置环境变量,添加如下内容:
    export XZ_HOME=/usr/local/xz
    export PATH=$XZ_HOME/bin:$PATH
    1. source /etc/profile //使修改生效)
    至此, XZ 的安装配置就完成了. # tar xf node-v10.9.0-linux-x64.tar // 解压 # cd node-v10.9.0-linux-x64/ // 进入解压目录 # node -v // 执行node命令 查看版本
    报错
    /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found错误的解决
    (解决方法
    下载最新版本gcc-10.1.0.tar.gz
    缺少GLIBCXX_3.4.15版本,或是更高的版本。
    为了核实版本问题:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    [root@localhost cmake-2.8.12.2]# strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX
    GLIBCXX_3.4
    GLIBCXX_3.4.1
    GLIBCXX_3.4.2
    GLIBCXX_3.4.3
    GLIBCXX_3.4.4
    GLIBCXX_3.4.5
    GLIBCXX_3.4.6
    GLIBCXX_3.4.7
    GLIBCXX_3.4.8
    GLIBCXX_3.4.9
    GLIBCXX_3.4.10
    GLIBCXX_3.4.11
    GLIBCXX_3.4.12
    GLIBCXX_3.4.13
    GLIBCXX_FORCE_NEW
    GLIBCXX_DEBUG_MESSAGE_LENGTH
     
    • 解压
    tar -jxvf gcc-10.1.0.tar.bz2
    下载供便利需要的依赖项
    cd gcc-10.1.0 ./contrib/download_prerequisites 
    建立一个目录供编译出的文件存放
    mkdir build cd build
    生成Makefile文件
    ../configure -enable-checking=release -enable-languages=c,c++ -disable-multilib
    编译安装
    make -j4
    • -j4选项是make对多核处理器的优化,如果不成功请使用 make,这里我使用的make
    • (注意:此步骤如果能正常运营,运行一个小时左右。如果有错误的话,一般最多一两分钟就停下来了
    • PS:如果提示还缺少其它包,请下载错误提示中包后,重新编译
    比如在这个过程中,我又执行了如下两个命令安装相关依赖 yum install m4 yum install gcc-c++
    • 再次 make
    • make install
    • 重启 ,执行 gcc -v查看版本 已经10.1.0,可以使用了
    • 查看node版本 node -v
    替换老版本gcc动态库
    • 源码编译升级安装了gcc后,编译程序或运行其它程序时,有时会出现类似/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found的问题。这是因为升级gcc时,生成的动态库没有替换老版本gcc的动态库导致的,将gcc最新版本的动态库替换系统中老版本的动态库即可解决。
    find / -name "libstdc++.so*"
    • 结果如下:
    /usr/lib/gcc/x86_64-redhat-linux/4.8.2/32/libstdc++.so /usr/lib/gcc/x86_64-redhat-linux/4.8.2/libstdc++.so /usr/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6.0.19 /usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.py /usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.pyc /usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.19-gdb.pyo /usr/local/lib64/libstdc++.so.6.0.22 /usr/local/lib64/libstdc++.so.6 /usr/local/lib64/libstdc++.so /usr/local/lib64/libstdc++.so.6.0.22-gdb.py
    • 删除并备份原文件 (注意:每个人的文件路径可能稍有差异,但文件名是一样的 )
    mv /usr/lib64/libstdc++.so.6 /home/usr_lib64_libstdc++.so.6
    • 将新版本gcc动态库导入
    ln -s /usr/local/lib/libstdc++.so.6.0.22 /usr/lib64/libstdc++.so.6
     
    make -j4 报错的   缺少autoconf或版本太低
    # wget ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.gz # tar zxvf autoconf-2.68.tar.gz # cd autoconf-2.68 # ./configure --prefix=/usr/ # make && make install
     
    # autoconf -V autoconf (GNU Autoconf) 2.68 Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+/Autoconf: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>, <http://gnu.org/licenses/exceptions.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by David J. MacKenzie and Akim Demaille.
  • 相关阅读:
    Oracle设置某张表为只读
    greenplum不能下载问题解决方法(转)
    MyBatis学习-入门
    Oracle-数据泵使用
    oracle锁表
    linux查看文件大小
    Apache日志分割
    nginx日志切割
    zookeeper 事务日志查看
    zookeeper连接 org.apache.curator.framework.imps.CuratorFrameworkImpl Background exception was not retry-able or retry gave up [main-EventThread]
  • 原文地址:https://www.cnblogs.com/xy51/p/14293560.html
Copyright © 2011-2022 走看看