Linux 为什么configure在安装GCC时说没有找到C编译器?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18076157/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-07 00:28:42  来源:igfitidea点击:

Why does configure say no C compiler found when GCC is installed?

linuxgccterminalsphinxyum

提问by Garry Pettet

I am trying to make Sphinxfrom source on a 32-bit CentOS 6 VPS.

我正在尝试在 32 位 CentOS 6 VPS 上从源代码制作Sphinx

When I run this command:

当我运行此命令时:

./configure --prefix=/usr/local/sphinx

I get this error output:

我得到这个错误输出:

checking build environment
--------------------------

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no

checking for compiler programs
------------------------------

checking whether to compile debug version... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/home/gnotes/sphinx':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.

What I don't understand is that GCC is installed so why can't configure find an acceptable C compiler?

我不明白的是 GCC 已安装,为什么配置找不到可接受的 C 编译器?

Here's the output of yum:

这是 yum 的输出:

sudo yum install gcc

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.metrocast.net
 * extras: centos.mirror.constant.com
 * updates: mirror.lug.udel.edu
base                                                                                                                                                                      | 3.7 kB     00:00     
extras                                                                                                                                                                    | 3.5 kB     00:00     
updates                                                                                                                                                                   | 3.4 kB     00:00     
Setting up Install Process
Package gcc-4.4.7-3.el6.i686 already installed and latest version
Nothing to do

What gives?

是什么赋予了?

采纳答案by kds

try yum groupinstall "Development Tools"

尝试 yum groupinstall "Development Tools"

if the installation is success then you will have a full set of development tools. Such as gcc, g++, make, ld ect. After that you can try the compilation of Code Blocks again.

如果安装成功,那么您将拥有一整套开发工具。如 gcc、g++、make、ld 等。之后,您可以再次尝试编译代码块。

Since yumis deprecated you can use dnfinstead:

由于yum已弃用,您可以dnf改用:

dnf groupinstall "Development Tools"

回答by mti2935

Maybe gcc is not in your path? Try finding gcc using which gccand add it to your path if it's not already there.

也许 gcc 不在您的路径中?尝试使用 gcc 查找which gcc并将其添加到您的路径中(如果它还没有)。

回答by devnull

Try specifying CCwhile configuring:

尝试CC在配置时指定:

CC=/usr/bin/gcc ./configure --prefix=/usr/local/sphinx

Also check if your compiler produces executables. The following should produce an a.out:

还要检查您的编译器是否生成可执行文件。以下应该产生一个a.out

echo "int main(){0;}" | gcc -x c -

回答by Charlesliam

i have same problem at the moment. I just run yum install gcc

我目前有同样的问题。我只是跑yum install gcc

回答by Vinoth Sankar

Sometime gcc had created as /usr/bin/gcc32. so please create a ln -s /usr/bin/gcc32 /usr/bin/gccand then compile that ./configure.

有时 gcc 创建为/usr/bin/gcc32. 所以请创建一个ln -s /usr/bin/gcc32 /usr/bin/gcc然后编译它./configure

回答by lakshmikandan

The below packages are also helps you,

下面的包也可以帮助你,

yum install gcc glibc glibc-common gd gd-devel -y

回答by lakshmikandan

Install GCC in Ubuntu Debian Base

Ubuntu Debian Base 中安装 GCC

sudo apt-get install build-essential

回答by costerwellkhyriem

I had the same issue with mind. I tried using sudo apt-get install build-essential It still won't work. I simply created a hardlink to the gcc-x binary in the /usr/bin/ folder. sudo ls /usr/bin/gcc-x /usr/bin/gcc

我有同样的问题。我尝试使用 sudo apt-get install build-essential 它仍然不起作用。我只是在 /usr/bin/ 文件夹中创建了一个到 gcc-x 二进制文件的硬链接。须藤 ls /usr/bin/gcc-x /usr/bin/gcc

That worked for me!

那对我有用!