• Centos6.4编译安装Node.js(已验证)


    1.准备源文件包

    [felix@MyTerminal Downloads]$ mv node-6.5.0 node

    [felix@MyTerminal Downloads]$ ls

    node node-v4.5.0-linux-x86.tar.xz
    [felix@MyTerminal Downloads]$ cd node
    [felix@MyTerminal node]$ ls
    android-configure BUILDING.md common.gypi doc Makefile src WORKING_GROUPS.md
    AUTHORS CHANGELOG.md configure GOVERNANCE.md node.gyp test
    benchmark CODE_OF_CONDUCT.md CONTRIBUTING.md lib README.md tools
    BSDmakefile COLLABORATOR_GUIDE.md deps LICENSE ROADMAP.md vcbuild.bat

    2.执行./configure

    [felix@MyTerminal node]$ ./configure
    WARNING: failed to autodetect C++ compiler version (CXX=g++)  //需要安装gcc
    creating ./icu_config.gypi
    * Using ICU in deps/icu-small
    creating ./icu_config.gypi
    { 'target_defaults': { 'cflags': [],
    'default_configuration': 'Release',
    'defines': [],
    'include_dirs': [],
    'libraries': []},
    'variables': { 'asan': 0,
    'debug_devtools': 'node',
    'force_dynamic_crt': 0,
    'gas_version': '2.20',
    'host_arch': 'ia32',
    'icu_data_file': 'icudt57l.dat',
    'icu_data_in': '../../deps/icu-small/source/data/in/icudt57l.dat',
    'icu_endianness': 'l',
    'icu_gyp_path': 'tools/icu/icu-generic.gyp',
    'icu_locales': 'en,root',
    'icu_path': 'deps/icu-small',
    'icu_small': 'true',
    'icu_ver_major': '57',
    'node_byteorder': 'little',
    'node_enable_d8': 'false',
    'node_enable_v8_vtunejit': 'false',
    'node_install_npm': 'true',
    'node_module_version': 48,
    'node_no_browser_globals': 'false',
    'node_prefix': '/usr/local',
    'node_release_urlbase': '',
    'node_shared': 'false',
    'node_shared_cares': 'false',
    'node_shared_http_parser': 'false',
    'node_shared_libuv': 'false',
    'node_shared_openssl': 'false',
    'node_shared_zlib': 'false',
    'node_tag': '',
    'node_use_bundled_v8': 'true',
    'node_use_dtrace': 'false',
    'node_use_etw': 'false',
    'node_use_lttng': 'false',
    'node_use_openssl': 'true',
    'node_use_perfctr': 'false',
    'node_use_v8_platform': 'true',
    'openssl_fips': '',
    'openssl_no_asm': 0,
    'shlib_suffix': 'so.48',
    'target_arch': 'ia32',
    'uv_parent_path': '/deps/uv/',
    'uv_use_dtrace': 'false',
    'v8_enable_gdbjit': 0,
    'v8_enable_i18n_support': 1,
    'v8_inspector': 'true',
    'v8_no_strict_aliasing': 1,
    'v8_optimized_debug': 0,
    'v8_random_seed': 0,
    'v8_use_snapshot': 'true',
    'want_separate_host_toolset': 0}}
    creating ./config.gypi
    creating ./config.mk
    WARNING: warnings were emitted in the configure phase

    [felix@MyTerminal node]$ sudo yum install gcc-c++   //安装gcc
    Loaded plugins: fastestmirror, refresh-packagekit, security
    Loading mirror speeds from cached hostfile
    * base: mirrors.163.com
    * extras: mirrors.aliyun.com
    * updates: mirrors.tuna.tsinghua.edu.cn
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package gcc-c++.i686 0:4.4.7-17.el6 will be installed
    --> Processing Dependency: libstdc++-devel = 4.4.7-17.el6 for package: gcc-c++-4.4.7-17.el6.i686
    --> Processing Dependency: libstdc++ = 4.4.7-17.el6 for package: gcc-c++-4.4.7-17.el6.i686
    --> Processing Dependency: gcc = 4.4.7-17.el6 for package: gcc-c++-4.4.7-17.el6.i686
    --> Running transaction check
    ---> Package gcc.i686 0:4.4.7-3.el6 will be updated
    ---> Package gcc.i686 0:4.4.7-17.el6 will be an update
    --> Processing Dependency: libgomp = 4.4.7-17.el6 for package: gcc-4.4.7-17.el6.i686
    --> Processing Dependency: cpp = 4.4.7-17.el6 for package: gcc-4.4.7-17.el6.i686
    --> Processing Dependency: libgcc >= 4.4.7-17.el6 for package: gcc-4.4.7-17.el6.i686
    ---> Package libstdc++.i686 0:4.4.7-3.el6 will be updated
    ---> Package libstdc++.i686 0:4.4.7-17.el6 will be an update
    ---> Package libstdc++-devel.i686 0:4.4.7-17.el6 will be installed
    --> Running transaction check
    ---> Package cpp.i686 0:4.4.7-3.el6 will be updated
    ---> Package cpp.i686 0:4.4.7-17.el6 will be an update
    ---> Package libgcc.i686 0:4.4.7-3.el6 will be updated
    ---> Package libgcc.i686 0:4.4.7-17.el6 will be an update
    ---> Package libgomp.i686 0:4.4.7-3.el6 will be updated
    ---> Package libgomp.i686 0:4.4.7-17.el6 will be an update
    --> Finished Dependency Resolution

    Dependencies Resolved

    ================================================================================
    Package Arch Version Repository Size
    ================================================================================
    Installing:
    gcc-c++ i686 4.4.7-17.el6 base 4.3 M
    Installing for dependencies:
    libstdc++-devel i686 4.4.7-17.el6 base 1.6 M
    Updating for dependencies:
    cpp i686 4.4.7-17.el6 base 3.4 M
    gcc i686 4.4.7-17.el6 base 8.2 M
    libgcc i686 4.4.7-17.el6 base 114 k
    libgomp i686 4.4.7-17.el6 base 136 k
    libstdc++ i686 4.4.7-17.el6 base 302 k

    Transaction Summary
    ================================================================================
    Install 2 Package(s)
    Upgrade 5 Package(s)

    Total download size: 18 M
    Is this ok [y/N]: y
    Downloading Packages:
    (1/7): cpp-4.4.7-17.el6.i686.rpm | 3.4 MB 00:07
    (2/7): gcc-4.4.7-17.el6.i686.rpm | 8.2 MB 00:25
    (3/7): gcc-c++-4.4.7-17.el6.i686.rpm | 4.3 MB 00:11
    (4/7): libgcc-4.4.7-17.el6.i686.rpm | 114 kB 00:00
    (5/7): libgomp-4.4.7-17.el6.i686.rpm | 136 kB 00:00
    (6/7): libstdc++-4.4.7-17.el6.i686.rpm | 302 kB 00:00
    (7/7): libstdc++-devel-4.4.7-17.el6.i686.rpm | 1.6 MB 00:03
    --------------------------------------------------------------------------------
    Total 301 kB/s | 18 MB 01:01
    warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
    Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
    Importing GPG key 0xC105B9DE:
    Userid : CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>
    Package: centos-release-6-4.el6.centos.10.i686 (@anaconda-CentOS-201303020136.i386/6.4)
    From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
    Is this ok [y/N]: y
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
    Updating : libgcc-4.4.7-17.el6.i686 1/12
    Updating : libstdc++-4.4.7-17.el6.i686 2/12
    Installing : libstdc++-devel-4.4.7-17.el6.i686 3/12
    Updating : libgomp-4.4.7-17.el6.i686 4/12
    Updating : cpp-4.4.7-17.el6.i686 5/12
    Updating : gcc-4.4.7-17.el6.i686 6/12
    Installing : gcc-c++-4.4.7-17.el6.i686 7/12
    Cleanup : gcc-4.4.7-3.el6.i686 8/12
    Cleanup : libstdc++-4.4.7-3.el6.i686 9/12
    Cleanup : libgcc-4.4.7-3.el6.i686 10/12
    Cleanup : cpp-4.4.7-3.el6.i686 11/12
    Cleanup : libgomp-4.4.7-3.el6.i686 12/12
    Verifying : libstdc++-devel-4.4.7-17.el6.i686 1/12
    Verifying : libgcc-4.4.7-17.el6.i686 2/12
    Verifying : cpp-4.4.7-17.el6.i686 3/12
    Verifying : libstdc++-4.4.7-17.el6.i686 4/12
    Verifying : gcc-4.4.7-17.el6.i686 5/12
    Verifying : libgomp-4.4.7-17.el6.i686 6/12
    Verifying : gcc-c++-4.4.7-17.el6.i686 7/12
    Verifying : libstdc++-4.4.7-3.el6.i686 8/12
    Verifying : cpp-4.4.7-3.el6.i686 9/12
    Verifying : libgcc-4.4.7-3.el6.i686 10/12
    Verifying : gcc-4.4.7-3.el6.i686 11/12
    Verifying : libgomp-4.4.7-3.el6.i686 12/12

    Installed:
    gcc-c++.i686 0:4.4.7-17.el6

    Dependency Installed:
    libstdc++-devel.i686 0:4.4.7-17.el6

    Dependency Updated:
    cpp.i686 0:4.4.7-17.el6 gcc.i686 0:4.4.7-17.el6
    libgcc.i686 0:4.4.7-17.el6 libgomp.i686 0:4.4.7-17.el6
    libstdc++.i686 0:4.4.7-17.el6

    Complete!

    [felix@MyTerminal node]$ ./configure
    WARNING: C++ compiler too old, need g++ 4.8 or clang++ 3.4 (CXX=g++)  //gcc版本太低,需要升级

    //具体升级操作见另一篇博客http://www.cnblogs.com/felixzh/p/5824466.html

    creating ./icu_config.gypi
    * Using ICU in deps/icu-small
    creating ./icu_config.gypi
    { 'target_defaults': { 'cflags': [],
    'default_configuration': 'Release',
    'defines': [],
    'include_dirs': [],
    'libraries': []},
    'variables': { 'asan': 0,
    'debug_devtools': 'node',
    'force_dynamic_crt': 0,
    'gas_version': '2.20',
    'host_arch': 'ia32',
    'icu_data_file': 'icudt57l.dat',
    'icu_data_in': '../../deps/icu-small/source/data/in/icudt57l.dat',
    'icu_endianness': 'l',
    'icu_gyp_path': 'tools/icu/icu-generic.gyp',
    'icu_locales': 'en,root',
    'icu_path': 'deps/icu-small',
    'icu_small': 'true',
    'icu_ver_major': '57',
    'node_byteorder': 'little',
    'node_enable_d8': 'false',
    'node_enable_v8_vtunejit': 'false',
    'node_install_npm': 'true',
    'node_module_version': 48,
    'node_no_browser_globals': 'false',
    'node_prefix': '/usr/local',
    'node_release_urlbase': '',
    'node_shared': 'false',
    'node_shared_cares': 'false',
    'node_shared_http_parser': 'false',
    'node_shared_libuv': 'false',
    'node_shared_openssl': 'false',
    'node_shared_zlib': 'false',
    'node_tag': '',
    'node_use_bundled_v8': 'true',
    'node_use_dtrace': 'false',
    'node_use_etw': 'false',
    'node_use_lttng': 'false',
    'node_use_openssl': 'true',
    'node_use_perfctr': 'false',
    'node_use_v8_platform': 'true',
    'openssl_fips': '',
    'openssl_no_asm': 0,
    'shlib_suffix': 'so.48',
    'target_arch': 'ia32',
    'uv_parent_path': '/deps/uv/',
    'uv_use_dtrace': 'false',
    'v8_enable_gdbjit': 0,
    'v8_enable_i18n_support': 1,
    'v8_inspector': 'true',
    'v8_no_strict_aliasing': 1,
    'v8_optimized_debug': 0,
    'v8_random_seed': 0,
    'v8_use_snapshot': 'true',
    'want_separate_host_toolset': 0}}
    creating ./config.gypi
    creating ./config.mk
    WARNING: warnings were emitted in the configure phase

    4.执行make

    $make  //出现问题/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found   

    意思是:缺少GLIBCXX_3.4.15版本。由于刚升级了gcc,理论上不会缺少GLIBCXX_3.4.15。

    [felix@MyTerminal node]$ strings /usr/lib/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
    [felix@MyTerminal node]$ strings /usr/local/lib/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_3.4.14
    GLIBCXX_3.4.15
    GLIBCXX_3.4.16
    GLIBCXX_3.4.17
    GLIBCXX_3.4.18
    GLIBCXX_3.4.19
    GLIBCXX_FORCE_NEW
    GLIBCXX_DEBUG_MESSAGE_LENGTH
    [felix@MyTerminal node]$ sudo cp /usr/local/lib/libstdc++.so.6 /usr/lib/

    5.执行make install

    如果不是root权限,需要sudo

    默认安装位置为/usr/local/bin

    6.至此,Centos编译安装Node.js结束。

  • 相关阅读:
    Cocostudio学习笔记(2) Button + CheckBox
    Oracle会话及连接数优化
    linux zip压缩和解压的各种操控
    Linux select 机制深入分析
    算法的时间复杂度
    findmaven的英文版本号上线了
    XML高速入门
    spring xml properties split with comma for list
    There is an error in invoking javac. A full JDK (not just JRE) is required
    [Swift]LeetCode134. 加油站 | Gas Station
  • 原文地址:https://www.cnblogs.com/felixzh/p/5822354.html
Copyright © 2020-2023  润新知