以前用的Ubuntu较多,最近刚刚接触CentOS,感觉两个版本的差别还是较大的。http://hxhg.gxu.edu.cn/lsq/?act=article&code=detail&cid=67&id=52 完全新手入门的角度,学习CentOS..版本centos 6.2 由于手头有CentOS 6.2的安装光盘,所以采用的是rpm包来安装gcc编译器,这样免去来下载安装包的步骤。。(其他的安装方法还有待学习) 1.a:将DVD光盘插入光驱, 2.a,b两种方式选一个,并cd到放置rpm软件包的目录下; 3.开始安装,命令如下,顺序一定不能出错: rpm -ivh kernel-headers-2.6.32-220.el6.x86_64.rpm rpm -ivh glibc-devel-2.12-1.47.el6.x86_64.rpm --force --nodeps rpm -ivh libgomp-4.4.6-3.el6.x86_64.rpm rpm -ivh ppl-0.10.2-11.el6.x86_64.rpm rpm -ivh cloog-ppl-0.15.7-1.2.el6.x86_64.rpm rpm -ivh gcc-4.4.6-3.el6.x86_64.rpm rpm -ivh gcc-c++-4.4.6-3.el6.x86_64.rpm rpm –ivh后面的就是需要的rpm软件包,英文字母应该是和我一样的,但是数字可能不容,因为版本号不一样 这样gcc编译器安装完成。 输入 gcc -v 会显示安装的版本 使用内建 specs。 目标:x86_64-redhat-linux 配置为:../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux 线程模型:posix gcc 版本 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC) 安装完成gcc后发现 gcc -v 和g++ -v都能显示,唯独gfortran -v时显示 gfortran命令没有找到,说明gfortran没有安装。 命令安装如下: (2)安装g++ 结果显示gcc-c++已被成功安装,所以这样运行安装gfortran应该也不会出现问题 运行gfortran -v 显示安装版本。。成功。。 补充g77的安装。。 依旧是在/media/CentOS_6.2_Final/Packages目录下: [root@TTWORKTEAM Packages]# yum search g77 结果显示: Loaded plugins: fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfile =============================== N/S Matched: g77 =============================== compat-gcc-34-g77.x86_64 : Fortran 77 support for compatibility compiler 可以看到有一个软件包compat-gcc-34-g77.x86_64为g77编译器 ,命令安装如下: [root@TTWORKTEAM Packages]# yum install compat-gcc-34-g77-3.4.6-19.el6.x86_64.rpm 过程显示:(一直选择Y,默认安装。。。) Loaded plugins: fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfile Setting up Install Process Examining compat-gcc-34-g77-3.4.6-19.el6.x86_64.rpm: compat-gcc-34-g77-3.4.6-19.el6.x86_64 Marking compat-gcc-34-g77-3.4.6-19.el6.x86_64.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package compat-gcc-34-g77.x86_64 0:3.4.6-19.el6 will be installed --> Processing Dependency: compat-gcc-34 = 3.4.6-19.el6 for package: compat-gcc-34-g77-3.4.6-19.el6.x86_64 --> Processing Dependency: compat-libf2c-34 = 3.4.6-19.el6 for package: compat-gcc-34-g77-3.4.6-19.el6.x86_64 --> Processing Dependency: libg2c.so.0()(64bit) for package: compat-gcc-34-g77-3.4.6-19.el6.x86_64 --> Running transaction check ---> Package compat-gcc-34.x86_64 0:3.4.6-19.el6 will be installed ---> Package compat-libf2c-34.x86_64 0:3.4.6-19.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ ================================================================================ Installing: Installing for dependencies: Transaction Summary ================================================================================ Install Total size: 9.6 M Total download size: 3.8 M Installed size: 19 M Is this ok [y/N]: y Downloading Packages: (1/2): compat-gcc-34-3.4.6-19.el6.x86_64.rpm (2/2): compat-libf2c-34-3.4.6-19.el6.x86_64.rpm -------------------------------------------------------------------------------- Total Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Warning: RPMDB altered outside of yum. Installed: Dependency Installed: Complete! 安装完成,用命令g77 -v检测安装是否成功和查看安装路径。 [root@TTWORKTEAM Packages]# g77 -v 从 /usr/lib/gcc/x86_64-redhat-linux/3.4.6/specs 读取 specs 配置为:../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++,f77 --disable-libgcj --host=x86_64-redhat-linux 线程模型:posix gcc version 3.4.6 20060404 (Red Hat 3.4.6-19.el6) (责任编辑:IT) |