问题描述
我正在集群上运行centos 6.我安装了最新的gcc-8.2.0.并建立了一个链接"ln -sf/usr/bin/gcc-8.2 gcc".我对g ++和gfortran做了同样的事情.我想重新安装gcc-8.2.0并继续
I am running centos 6 on a cluster. I installed the latest gcc-8.2.0. and made a link "ln -sf /usr/bin/gcc-8.2 gcc".I did the same for g++ and gfortran.I wanted to reinstall gcc-8.2.0 and went ahead to
make clean
在gcc-8.2目录中的
.当我尝试
in the gcc-8.2 directory.When I try
./configure
我知道C编译器无法创建可执行文件我建立的链接已断开.找不到系统gcc-4.4.7
I get that C compiler cannot create executablesThe links I made are broken.The system gcc-4.4.7 cannot be found
which gcc
不提供gcc
sudo yum install gcc gcc-c++
已安装gcc.我试图安装一个rpm,但由于依赖关系而失败.我在/opt/pgi中安装了pg编译器当我使用
gives gcc is already installed.I tried to install an rpm, which fails because of dependencies.I have pg compilers installed in /opt/pgiWhen I configure with
CC=/path to/pgi/bin/pgcc FC=/path to/pgi/bin/pgfortran ./configure
我仍然得到C编译器无法创建可执行文件的信息我尝试了以下c ++程序
I still get C compiler cannot create executablesI tried the following c++ programm
#include <iostream>
using namespace std;
int main() {
cout << "Hello world!" << endl;
return 0;
}
使用命令
/opt/pgi/linux_86_64/12.08/bin/pgcpp hello.cpp -o hello
它给出了未找到float.h的编译错误.在另一台运行gcc的Linux PC上,该程序可以使用以下命令
It gives compilation error that float.h not found. On another linux PC with working gcc, the program works with the command
g++ hello.cpp -o hello
如果能找到systemgcc或使用pg编译器编译gcc的任何帮助,我将不胜感激
I will appreciate any assistance to either find the systemgcc or use pg compilers to compile gcc if possible
我承认这是一团糟,需要重新安装和重新配置操作系统.但是后来我做到了
I admit it is a big mess which will require OS reinstallation and reconfiguration. But then I did
sudo yum install compat-gcc-34
现在我有了gcc34并完成了gcc-8.2的配置,而没有"c编译器无法创建可执行文件". (请注意,先前文章中提到的./configure实际上是
Now I have gcc34 and configure of gcc-8.2 goes through without "c compiler cannot create executables". (Note that the ./configure referred to in earlier post was actually
../gcc_8_2_release/configure
在"gcc_8_2_release_build"内部,因此未在其源目录中构建gcc.我现在遇到的问题是make,它需要g ++,给出错误
inside "gcc_8_2_release_build, so gcc was not being built in its source directory.The problem I have now is with make, which needs g++, giving error
uint_t(64) or int_t(64) not found.
感谢所有耐心等待这篇文章的人.任何帮助将不胜感激.
Thanks all who have gone through this post, for your patience.Any assistance will be appreciated.
这是我摆脱困境的方式.使用以下两个命令
Here is how I got out of this mess.With the following two commands
sudo yum install compat-gcc-34-c++
sudo yum install compat-gcc-34-g77
我能够安装旧版本的gcc,c ++和g77.然后,我能够构建gcc-8.2.现在,我有了一个带有最新gcc的功能系统,是的,它可能需要重新安装/重新配置,但功能齐全.我学到了很多东西,非常感谢@Basile的评论和指南.但是,在某一时刻,他颇为消极和沮丧.但是由于我的信念和毅力,更重要的是浏览了其他人共享的知识,我才得以恢复原来的信念,认为这是一个失败的事业.谢谢大家.
I was able to install the older version of gcc, c++ and g77. Then I was able to build gcc-8.2.Now I have a functional system with the latest gcc, yes it may need re-installation/re-configuring but it is fully functional.I have learnt a lot and very much appreciate the comments and guidelines of @Basile. However, at one point he was rather negative and discouraging.But thanks to my belief and perseverance, and more importantly browsing the knowledge shared by others, I have been able to recover what I was beginning to be convinced was a lost cause.Thanks all.
推荐答案
与编程问题相比,这更是一个sysadmin问题.
This is more a sysadmin question than a programming one.
我的建议
-
不要弄乱您的
/usr/bin/
.让软件包管理器yum
填充它-切勿在没有yum
的情况下在其中添加任何内容;因此,请手动删除您在此处所做的任何符号链接(错误)
don't mess your
/usr/bin/
. Leave your package manageryum
to fill it -and never add anything inside it withoutyum
; so remove manually any symlinks you made there (by mistake)
重新安装旧系统gcc
4.4和g++
4.4(使用yum
)
reinstall the old system gcc
4.4 and g++
4.4 (using yum
)
从源代码开始重新构建GCC 8.使用--program-suffix=-8
(但没有--prefix
或--prefix=$HOME/soft/
(如果您没有root用户访问权限))对其进行配置.因此它将安装/usr/local/bin/gcc-8
和/usr/local/bin/g++-8
等...(或者,如果您给了--prefix=$HOME/soft/
,则是$HOME/soft/bin/gcc-8
等...)
rebuild your GCC 8 from scratch from its source code. Configure it with --program-suffix=-8
(but no --prefix
, or a --prefix=$HOME/soft/
if you don't have root access). So it will install /usr/local/bin/gcc-8
and /usr/local/bin/g++-8
etc... (or, if you have given --prefix=$HOME/soft/
, a $HOME/soft/bin/gcc-8
etc...)
如果您还没有一个,请创建一个$HOME/bin/
create a $HOME/bin/
if you don't have already one
请确保您的$HOME/bin/ early > $PATH
(在/usr/bin/
之前)
be sure to have $HOME/bin/
early in your $PATH
(before /usr/bin/
)
添加符号链接ln -sv /usr/local/bin/gcc-8 $HOME/bin/gcc
,同样添加g++
等.
add a symlink ln -sv /usr/local/bin/gcc-8 $HOME/bin/gcc
and likewise for g++
etc..
然后,当您键入gcc
时,您将获得指向/usr/local/bin/gcc-8
等的符号链接.
Then, when you type gcc
you are getting that symlink to /usr/local/bin/gcc-8
etc.
如果您无法写入/usr/local/
(例如,因为您没有root权限...),则可以将--prefix=$HOME/soft/
传递给GCC 8 .../configure
,然后将上面的/usr/local/
替换为$HOME/soft/
If you cannot write to /usr/local/
(e.g. because you don't have root permission...) you could pass --prefix=$HOME/soft/
to GCC 8 .../configure
then replace /usr/local/
above with $HOME/soft/
如果您是sysadmin,并且可以写/usr/local/
,并且必须为许多用户设置内容:添加符号链接ln -s /usr/local/bin/gcc-8 /usr/local/bin/gcc
等,并要求您的用户将/usr/local/bin/
放在他们的中$PATH
在/usr/bin/
If you are the sysadmin and can write to /usr/local/
and have to set up things for many users: add a symlink ln -s /usr/local/bin/gcc-8 /usr/local/bin/gcc
etc and ask your users to put /usr/local/bin/
in their $PATH
before /usr/bin/
BTW,请注意,明确地记录了需要在其源代码树的外部中构建GCC 8(或其他):在安装GCC ,您可以阅读:
BTW, notice that it is explicitly documented that GCC 8 (or others) need to be built outside of its source tree: in Installing GCC you can read:
(强烈推荐"是一种礼貌的方式,您绝对应该")
(the "highly recommend" should be considered as a polite way to say "you absolutely should")
所以您的./configure
是另一个错误.
So your ./configure
was another mistake.
您可能会以比您想象的更严重的方式弄乱系统(也许您需要重新安装或致电Redhat支持人员).
It could happen that you messed up your system more seriously than you thought (and perhaps you need to reinstall, or to call Redhat support).
PS.我不了解Redhat(仅在上个世纪才使用过).我最喜欢的发行版是Debian/testing或Debian/unstable(我的计算机是台式机,而不是群集).
PS. I don't know Redhat (used it only in the previous century). My favorite distro is Debian/testing or Debian/unstable (and my computers are desktops, not clusters).
这篇关于如何在centos 6上恢复系统gcc编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!