LoginSignup
9
7

More than 5 years have passed since last update.

CentOS 7 gcc 7.3.0のソースファイルからのインストール

Last updated at Posted at 2018-03-25

動作確認環境

  • 仮想環境 VMware Workstation Player 14.1.1
  • OS Windows 10 Pro 64bit

仮想環境

  • OS CentOS 7.4 (1708) minimalインストール
  • メモリ 2GB
  • HDD 250GB

ダウンロード・展開

最新バージョンの確認
GCC, the GNU Compiler Collection - GNU Project - Free Software Foundation (FSF)

/usr/local/srcディレクトリに移動する。

cd /usr/local/src

ソースファイルをダウンロードする。

wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-7.3.0/gcc-7.3.0.tar.gz

ダウンロードしたファイルを展開する。

tar zxvf gcc-7.3.0.tar.gz

コンパイル・インストール

展開したディレクトリに移動する。

cd gcc-7.3.0

CとC++をコンパイル・インストール

./contrib/download_prerequisites
mkdir build
cd build
../configure --enable-languages=c,c++ --prefix=/usr/local --disable-bootstrap --disable-multilib
make
make install

エラー対策

libstdc++.so.6.0.24のエラーが発生する場合、以下のようにする。
libstdc++.so.6.0.24-gdb.pyのファイル名を変更する。(参考しないようにする)

mv /usr/local/lib64/libstdc++.so.6.0.24-gdb.py /usr/local/lib64/back.libstdc++.so.6.0.24-gdb.py

/usr/local/lib64ディレクトリを参照するよう/etc/ld.so.conf.d/に追加する。

echo '/usr/local/lib64' > /etc/ld.so.conf.d/local-lib64.conf

バージョン確認

gccのバージョン確認はgcc --versionで表示される。

gcc (GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

g++のバージョン確認はg++ --versionで表示される。

g++ (GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

参考

Cコンパイラーインストールメモ(Hishidama's C compiler install Memo)
Centos7 编译安装 Nginx Mariadb Asp.net Core2 (实测 笔记 Centos 7.3 + Openssl 1.1.0f + Mariadb 10.2.7 + Nginx 1.12.1 + Asp.net. Core 2 ) - vicowong - 博客园


目次

9
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
7