modulesを使って複数バージョンのGCCを切り替える環境の構築
GCCはインストールされているものとする。
環境
CentOS Linux release 7.5.1804 (Core)
実装方法
• modulesのインストール
# sudo yum install environment-modules
• modulesの設定ファイル
# cat /etc/modulefiles/gcc/7.3.0
#%Module1.0
##
## gcc
##
# GCC 7.3.0
proc ModulesHelp { } {
puts stderr “GCC 7.3.0 gcc g++ and gfortran\n”
}
module-whatis “GCC 7.3.0 Install Path /usr/local/gcc/7.3.0”
conflict gcc
prepend-path PATH /usr/local/gcc/7.3.0/bin
prepend-path LD_LIBRARY_PATH /usr/local/gcc/7.3.0/lib64
prepend-path MANPATH /usr/local/gcc/7.3.0/share/man
# cat /etc/modulefiles/gcc/8.2.0
#%Module1.0
##
## gcc
##
# GCC 8.2.0
proc ModulesHelp { } {
puts stderr “GCC 8.2.0 gcc g++ and gfortran\n”
}
module-whatis “GCC 8.2.0 Install Path /usr/local/gcc/8.2.0”
conflict gcc
prepend-path PATH /usr/local/gcc/8.2.0/bin
prepend-path LD_LIBRARY_PATH /usr/local/gcc/8.2.0/lib64
prepend-path MANPATH /usr/local/gcc/8.2.0/share/man