Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Detailed explanation of source code compilation and installation under Linux environment (compiling CMake 3.15 and gcc 5.3.0 as an example)

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

one。 Detailed explanation of source code compilation and installation

(to be added)

two。 Install CMake 3.151. Check the operating system version [root@mysql80 local] # cat / etc/redhat-releaseCentOS Linux release 7.4.1708 (Core) 2. Download software

Download address: https://cmake.org/download/

Software location: / software/cmake-3.15.0-rc1.tar.gz

3. Create the installation directory mkdir / usr/local/cmake-3.15.04. Configuration and installation

(1) switch to the software directory and extract the software package.

[root@mysql80 cmake-3.15.0] # cd / software/ [root@mysql80 software] # ls-l | grep cmake-3.15.0-rc1.tar.gz-rw-r--r--. 1 root root 9249478 Jun 10 08:32 cmake-3.15.0-rc1.tar.gz [root@mysql80 software] # tar-zxvf cmake-3.15.0-rc1.tar.gz

(2) configuration

[root@mysql80 software] # cd cmake-3.15.0-rc1/ [root@mysql80 cmake-3.15.0-rc1] #. / configure-- prefix=/usr/local/cmake-3.15.0

To complete the configuration, prompt as follows:

-

-- Configuring done

-- Generating done

-- Build files have been written to: / software/cmake-3.15.0-rc1

-

CMake has bootstrapped. Now run gmake.

-

(3) compilation

Make

(4) installation

Make install

(5) check

[root@mysql80 bin] # type cmakecmake is / usr/local/bin/cmake [root@mysql80 bin] # cmake-- versioncmake version 3.15.0-rc1CMake suite maintained and supported by Kitware (kitware.com/cmake).

two。 Install gcc-5.3.0

When compiling and installing gcc-5.3.0, you need to pay attention to two points:

(1) gcc itself is a compilation tool, so what is the tool for compiling gcc? So you need to install the previous version of gcc through yum or rpm in advance.

Yum install gcc gcc-c++-y

(2) related dependency package: GMP4.3.2 MPFR2.4.2 MPC0.8.1, which needs to be installed in advance.

Gmp http://ftp.gnu.org/gnu/gmp/

Mpfr http://ftp.gnu.org/gnu/mpfr/

Mpc http://ftp.gnu.org/gnu/mpc/

1. Install GMP4.3.2 [root @ mysql80 software] # mkdir / usr/local/gmp-4.3.2 [root@mysql80 software] # cd / software [root@mysql80 software] # ls-l | grep gmp-rw-r--r--. 1 root root 1897483 Jun 10 09:37 gmp-4.3.2.tar.bz2 [root@mysql80 software] # tar-jxvf gmp-4.3.2.tar.bz2 [root@mysql80 software] # cd gmp-4.3.2/ [root@mysql80 gmp-4.3.2] #. / configure-- prefix=/usr/local/gmp-4.3.2 [root@mysql80 gmp-4.3.2] # make [root@mysql80 gmp-4.3.2] # make install

two。 Install MPFR 2.4.2 [root @ mysql80 software] # mkdir / usr/local/mpfr-2.4.2 [root@mysql80 software] # cd / software [root@mysql80 software] # ls-l | grep mpfr-rw-r--r--. 1 root root 1077886 Jun 10 09:38 mpfr-2.4.2.tar.bz2 [root@mysql80 software] # tar-jxvf mpfr-2.4.2.tar.bz2 [root@mysql80 software] # cd mpfr-2.4.2/ [root@mysql80 mpfr-2.4.2] #. / configure-- prefix=/usr/local/mpfr-2.4.2-- with-gmp=/usr/local/gmp-4.3.2 [root@mysql80 gmp-4.3.2] # Make [root@mysql80 gmp-4.3.2] # make install

3. Install MPC 0.8.1 [root @ mysql80 software] # mkdir / usr/local/mpc-0.8.1 [root@mysql80 software] # cd / software [root@mysql80 software] # ls-l | grep mpc-0.8.1.tar.gz-rw-r--r--. 1 root root 544950 Jun 10 09:38 mpc-0.8.1.tar.gz [root@mysql80 software] # tar-zxvf mpc-0.8.1.tar.gz [root@mysql80 software] # cd mpc-0.8.1 [root@mysql80 mpc-0.8.1] #. / configure-prefix=/usr/local/mpc-0.8.1-with-gmp=/usr/local/gmp-4.3.2-with-mpfr=/usr/local/mpfr- 2.4.2 [root@mysql80 gmp-4.3.2] # make [root@mysql80 gmp-4.3.2] # make install

-

4. Modify the environment variable vim etc/profile

Add the following line:

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mpc-0.8.1/lib:/usr/local/gmp-4.3.2/lib:/usr/local/mpfr-2.4.2/lib:/usr/local/gcc-5.3.0/lib:/usr/local/gcc-5.3.0/lib64

To bring it into effect:

Source etc/profile5. Install GCC 5.3.0 [root @ mysql80 software] # mkdir / usr/local/gcc-5.3.0 [root@mysql80 software] # cd / software [root@mysql80 software] # ls-l gcc-5.3.0.tar.gz-rw-r--r--. 1 root root 123036849 Jun 10 09:17 gcc-5.3.0.tar.gz [root@mysql80 software] # tar-zxvf gcc-5.3.0.tar.gz [root@mysql80 software] # cd gcc-5.3.0/ [root@mysql80 gcc-5.3.0] #. / configure-prefix=/usr/local/gcc-5.3.0-enable-threads=posix-disable-checking-disable-multilib-enable-languages=c C++-with-gmp=/usr/local/gmp-4.3.2-with-mpfr=/usr/local/mpfr-2.4.2-with-mpc=/usr/local/mpc-0.8.1 [root@mysql80 gmp-4.3.2] # make-j4 [root@mysql80 gmp-4.3.2] # make install

6. Create a soft connection cd / usr/bin rm gcc rm gathers + ln-s / usr/local/gcc-5.3.0/bin/g++ gathers + ln-s / usr/local/gcc-5.3.0/bin/gcc gcc

7. Check [root@mysql80 bin] # gcc-- versiongcc (GCC) 5.3.0Copyright (C) 2015 Free Software Foundation, Inc.This is free software; see the source for copying conditions. There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE [root@mysql80 bin] # 5.3.0Copyright +-versiong++ (GCC) 5.3.0Copyright (C) 2015 Free Software Foundation, Inc.This is free software; see the source for copying conditions. There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report