金子邦彦研究室インストールUbuntu, WSL2gcc 10.1, g++ 10.1, gfortran 10.1, binutils 2.34, gdb 9.2 のインストール(Ubuntu 上)

gcc 10.1, g++ 10.1, gfortran 10.1, binutils 2.34, gdb 9.2 のインストール(Ubuntu 上)

前準備

Ubuntu のシステム更新

UbuntuUbuntu で OS のシステム更新を行うときは, 端末で,次のコマンドを実行する.

UbuntuUbuntu のインストールは別ページ »で説明

sudo apt -y update
sudo apt -yV upgrade
sudo /sbin/shutdown -r now

C/C++ コンパイラー,make,パッケージツール,その他のインストール

下記のソフトウェアをインストールする.

端末で,次のコマンドを実行する.

sudo apt -y update
sudo apt -y install build-essential gcc g++ make libtool texinfo dpkg-dev pkg-config
sudo apt -y install libgmp10 libgmp3-dev libmpfr-dev libmpc-dev libppl-dev curl -O

GNU コンパイラコレクション・バージョン10.1.0 のビルドとインストール

termcap のインストール

cd /tmp
curl -O https://ftp.gnu.org/gnu/termcap/termcap-1.3.1.tar.gz
rm -rf termcap-1.3.1
tar -xvzof termcap-1.3.1.tar.gz
cd termcap-1.3.1
CFLAGS="-fPIC" ./configure --prefix=/usr/local
make -j2 CFLAGS="-fPIC"
sudo make install

libiconv のインストール

cd /tmp
curl -O https://ftp.gnu.org/gnu/libiconv/libiconv-1.16.tar.gz
rm -rf libiconv-1.16
tar -xvzof libiconv-1.16.tar.gz
cd libiconv-1.16
mkdir build
cd build
../configure --with-mpfr --with-gmp --prefix=/usr/local --enable-static --enable-shared
make -j2
sudo make install

binutils のインストール

cd /tmp
curl -O https://ftp.gnu.org/gnu/binutils/binutils-2.34.tar.gz
rm -rf binutils-2.34
tar -xvzof binutils-2.34.tar.gz
cd binutils-2.34
mkdir build
cd build
../configure --with-mpfr --with-gmp --with-system-zlib --prefix=/usr/local 
make 
sudo make install

gdb のインストール

cd /tmp
curl -O https://ftp.gnu.org/gnu/gdb/gdb-9.2.tar.gz
rm -rf gdb-9.2
tar -xvzof gdb-9.2.tar.gz
cd gdb-9.2
mkdir build
cd build
../configure --with-mpfr --with-gmp --prefix=/usr/local 
make -j2
sudo make install

ld.so.confの設定

スーパーユーザで、下記を実行

  1. /etc/ld.so.confに以下の行を追加

    -------------ここから-----------
    /usr/local/lib
    --------------ここまで---------
    
    次のようになる

    [image]
  2. 「sudo /sbin/ldconfig」の実行

GNU コンパイラコレクション・バージョン10.1.0 のビルドとインストール

cd /tmp
curl -O https://ftp.gnu.org/gnu/gcc/gcc-10.1.0/gcc-10.1.0.tar.gz
rm -rf gcc-10.1.0
tar -xvzof gcc-10.1.0.tar.gz
cd gcc-10.1.0

# stage1
./configure --prefix=/usr/local --program-suffix=-10 \
--with-gmp= --with-mpfr --with-ppl \
--enable-bootstrap --enable-static --enable-shared --with-system-zlib \
--with-gnu-ld --with-gnu-as \
--enable-languages=c,c++,fortran --disable-libgcj --disable-multilib
make -j2 CFLAGS="-O2" LIBCFLAGS="-g -O2" LIBCXXFLAGS="-g -O2" 
sudo make install

(参考) 「make」結果の表示例 (ビルドが成功した例として載せています)

[image]