---
title: GNU 9.1编译安装
description: "1. 使用PuTTY工具，以root用户登录服务器。"
url: https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpcindapp/instg-osc/kunpenggnu_009.html
sourcePath: /source/zh/kunpenghpcs/hpcindapp/instg-osc/kunpenggnu_009.html
indexId: 85a15b2cada087387c36d4511d1bbffc97334abfd21b293a7227dc3765a7dd6162
---
# GNU 9.1编译安装

#### 操作步骤

1. 使用PuTTY工具，以root用户登录服务器。
2. 执行以下命令解压安装包。
  tar -vxf gcc-9.1.0.tar.xz

3. 执行以下命令进入解压文件路径。
  cd gcc-9.1.0/

4. 执行以下命令创建“obj”目录。
  mkdir obj

5. 执行以下命令进入“obj”目录。
  cd obj

6. 执行以下命令进行编译安装。
  ../configure --disable-multilib --enable-languages="c,c++,fortran" --prefix=/path/to/GNU --disable-static --enable-shared --with-gmp=/path/to/GMP/gmp-6.1.0 --with-mpfr=/path/to/MPFR/mpfr-3.1.4 --with-mpc=/path/to/MPC/mpc-1.0.3

  make

  make install

7. 执行以下命令加载环境变量。
  export PATH=/path/to/GNU/bin:$PATH

  export LD_LIBRARY_PATH=/path/to/GNU/lib64:$LD_LIBRARY_PATH

  编译安装成功如下图所示。
