This article is a summary of the problems encountered by Uncle Biao in building the Node online environment. Please do not hesitate to correct any mistakes.

Declare that the article uses some scheme or method source related blog in the article indicated the source of the article, if not marked, welcome to point out.

background

Build an online Node environment based on the online ODP environment. The ODP environment is GCC 4.4.7,centos 6.5 GLIC 2.12, git version 1.x. This article is mainly recorded in the establishment of node environment, encountered a series of problems, summary, hope to help students who have similar experience later.

List of questions:

  • GCC GCC GCC GCC GCC GCC GCC GCC GCC GCC GCC GCC GCC GCC GCC GCC GCC GCC GCC GCC GCC GCC GCC GCC When compiling XXX (an internal module) in node 11 extension, I found that the main reason for compiling XXX is the low version of GCC (GCC is not required to compile node extension environment).
  • Some node extensions require glibc 2.14 and upgrade the GLIC
  • Install NVM (gitL/SSL/curl)

What is the GCC

GCC (GNU Compiler Collection) can simply be thought of as a Compiler for C * modules

View the version of the existing environment

Cat/etc/redhat - release view the centos version of GCC - version | head 1Copy the code

How do I upgrade GCC

The GCC version is relatively easy to upgrade, this article refers to the compilation of this article we only need to upgrade to 4.9, I on one of our online services directly to upgrade 6.x can complete the compilation of the Node extension

Upgrade to GCC4.9:

wget https://copr.fedoraproject.org/coprs/rhscl/devtoolset-3/repo/epel-6/rhscl-devtoolset-3-epel-6.repo -O /etc/yum.repos.d/devtoolset-3.repo
yum -y install devtoolset-3-gcc devtoolset-3-gcc-c++ devtoolset-3-binutils
scl enable devtoolset-3 bash
Copy the code

Note that the SCL command is only temporarily enabled, and the original system GCC version will be restored by exiting the shell or restarting it. SCL enable devToolset -3 bash if you need to compile it again, you can read the above article in detail

Install the NVM environment

The curl - o - https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bashCopy the code

Error clone error: [root@localhost] [root@localhost] [root@localhost] [root@localhost] [root@localhost] [root@localhost] [root@localhost] [root@localhost] [root@localhost] [root@localhost

yum install http://opensource.wandisco.com/centos/6/git/x86_64/wandisco-git-release-6-1.noarch.rpm
yum install git
Copy the code

Git has also been updated to the new version, which should be no problem

Here comes a new mistake…

fatal: unable to access 'https://github.com/creationix/nvm.git/': SSL connect error
Failed to clone nvm repo. Please report this!
Copy the code

Soldiers will block the water, report what wrong to upgrade what

yum update -y nss curl libcurl
Copy the code

Now that NVM is installed, installing Node is easy. Let’s start testing the previously compiled Node extension and see the following errors

Libc.so. 6: version ‘glibc_2.14’ not found

Error =>libc.so.6: error =>libc.so.6: error =>libc.so.6: Version ‘glibc_2.14’ is not found. The version ‘glibc_2.14’ is not found. GCC glib is not the same as the GCC version. GCC is not the same as the GCC version. The following describes how to upgrade gliBC

View the glibc version

strings /lib64/libc.so.6 | grep GLIBC_ | head -20 
Copy the code

Take IPXXx. 53 after I upgrade as an example, see the current support up to 2.14

[[email protected] downloads]# strings /lib64/libc.so.6 | grep GLIBC_ | head -20Glibc2.2.5 glibc2.2.6 glibc2.3 glibc2.3.2 glibc2.3.3 glibc2.3.4 glibc2.4 glibc2.5 glibc2.6 glibc2.7 glibc2.8 9 glibc_2.10 glibc_2.11 glibc_2.12 glibc_2.13 glibc_2.14 GLIBC_PRIVATE ___sys_nerr_GLIBC_2_1 ___sys_nerr_GLIBC_2_4Copy the code
Strings/lib64 / libc. So. 6 | grep GLIBC_ | head - 20 in 14.53 after I upgrade, for example, see the support up to 2.14 [[email protected] downloads]# strings /lib64/libc.so.6 | grep GLIBC_ | head -20Glibc2.2.5 glibc2.2.6 glibc2.3 glibc2.3.2 glibc2.3.3 glibc2.3.4 glibc2.4 glibc2.5 glibc2.6 glibc2.7 glibc2.8 9 glibc_2.10 glibc_2.11 glibc_2.12 glibc_2.13 glibc_2.14 GLIBC_PRIVATE ___sys_nerr_GLIBC_2_1 ___sys_nerr_GLIBC_2_4Copy the code

Take a look at the soft link pointing of lib64 under liBC (this is after I upgraded)

[[email protected] downloads]# ll /lib64/libc**-rwxr-xr-x 1 root root 1924768 Apr 9 16:59 /lib64/libc-2.12.so lrwxr-xr-x 1 root root 32 May 27 13:49 /lib64/libc.so.6 -> /opt/glibc-2.14/lib/libc-2.14.so lrwxrwxrwx. 1 root root 18 Sep 1 2014 /lib64/libcap-ng.so.0 -> libcap-ng.so.0.0.0 -rwxr-xr-x. 1 root root 18672 Jun 25 2011 /lib64/libcap-ng.so.0.0.0 LRWXRWXRWXX. 1 root root 14 Sep 1 2014 2 -> libcap.so.2.16 -rwxr-xr-x. 1 root root 16600 Dec 7 2011 /lib64/libcap.so 1 -> libcgroup.so.1.0.40 -rwxr-xr-x. 1 root root 94408 Dec 9 2013 / lib64 / libcgroup. So. 1.0.40 - rwxr-xr-x mto 1 root root 201632 Apr 9 for/lib64 / libcidn - 2.12 so LRWXRWXRWX 1 root root 15 May 27 13:05 /lib64/libcidn.so.1 -> libcidn-2.12.so LRWXRWXRWX 1 root root 17 Aug 16 2016 /lib64/libcom_err.so.2 -> 2.1 -rwxr-xr-x 1 root root 14664 Jul 24 2015 /lib64/libcom_err.so.2.1 -rwxr-xr-x 1 root root 40872 Apr 9 1 root root 16 May 27 13:05 /lib64/libcrypt.so.1 -> libcrypt-2.12.so LRWXRWXRWX 1 root root 22 Dec 25 2014 / lib64 / libcryptsetup. So. 1 - > libcryptsetup. So the 1.1.0 - rwxr-xr-x mto 1 root root 94312 Jun 22, 2012 / lib64 / libcryptsetup. So. 1.1.0Copy the code

Upgrade glibc

The upgrade of glibc is very dangerous, it is recommended to do a good backup, because it is possible that your system will crash after the upgrade. First, go to the package glibc 214

Wget your_find_glibc-2.14.tar.xz_http_address tar -xvf glibc-2.14.tar.xzcdGlibc 2.14 mkdir buildcdbuild .. /configure --prefix=/opt/glibc-2.14 // Configure --prefix=/opt/glibc-2.14 //cd. Glibc-2.14: glibc-2.14: glibc-2.14: glibc-2.14: glibc-2.14: glibc-2.14: glibc-2.14: glibc-2.14: glibc-2.14: glibc-2.14 Rm -rf /lib64/libc.so.6 // delete libc.so.6 soft chain-s/opt/glibc-2.14/lib/libc-2.14.so /lib64/libc.so. LD_PRELOAD=/opt/glibc-2.14/lib/libc-2.14.so LD_PRELOAD=/opt/glibc-2.14/lib/libc-2.14.so-sLD_PRELOAD=/lib64/libc-2.12.so /opt/glibc-2.14/lib/libc-2.14.so /lib64/libc.so-sLib64 /libc-2.12.so /lib64/libc.so.6 // libc-2.12.so this item is the version before the system upgradeCopy the code

Configure does not make. The process of configure does not make. You can cat INSTALL to check the recommended or supported GCC version of this package. ,,,,insatll documentation indicates the recommended and supported versions. My GCC has been upgraded to 6.x, glibc.2.14. This requires GCC not to be too high. So I demoted GCC to 4.x, compiled it for a while, and finally it was ok. Now glbic is ok