1、编译nginx前, ./configure检查提示找不到C编译器

[root@test nginx-1.12.]# ./configure
checking for OS
+ Linux 3.10.-.el7.x86_64 x86_64
checking for C compiler ... not found

2、重装gcc编译器后,还是提示找不到C编译器

[root@test nginx-1.12.]# yum -y reinstall gcc gcc-c++ autoconf automake make
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors..com
Resolving Dependencies
--> Running transaction check
---> Package autoconf.noarch :2.69-.el7 will be reinstalled
---> Package automake.noarch :1.13.-.el7 will be reinstalled
---> Package gcc.x86_64 :4.8.-.el7_6. will be reinstalled
---> Package gcc-c++.x86_64 :4.8.-.el7_6. will be reinstalled
---> Package make.x86_64 :3.82-.el7 will be reinstalled
--> Finished Dependency Resolution
Installed:
autoconf.noarch :2.69-.el7 automake.noarch :1.13.-.el7 gcc.x86_64 :4.8.-.el7_6.
gcc-c++.x86_64 :4.8.-.el7_6. make.x86_64 :3.82-.el7 Complete!
[root@test nginx-1.12.]# ./configure
checking for OS
+ Linux 3.10.-.el7.x86_64 x86_64
checking for C compiler ... not found

3、网上找一个hello world C程序代码,尝试编译,提示 cannot find 'ld'

[root@test ~]# vim hello_world.c
---------------------------------------
#include <stdio.h>
void main()
{
printf("Hello World \n");
}
---------------------------------------
[root@test ~]# gcc hello_world.c
collect2: fatal error: cannot find 'ld'
compilation terminated.

4、到另一台可正常编译电脑,查找ld位置

[root@xdc tmp]# which ld
/usr/bin/ld

5、回到问题机器,发现/usr/bin/ld有这个文件,但是which ld,找不到该文件

[root@test]# ll /usr/bin/ld
lrwxrwxrwx. root root May : /usr/bin/ld -> /etc/alternatives/ld
[root@test nginx-1.12.]# which ld
/usr/bin/which: no ld in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)

6、ll /usr/bin/ld 发现该文件最终链接到/usr/bin/ld.bfd,但是,最终的源文件没有可执行权限

[root@test nginx-1.12.]# ll /usr/bin/ld
lrwxrwxrwx. root root May : /usr/bin/ld -> /etc/alternatives/ld
[root@test nginx-1.12.]# ll /etc/alternatives/ld
lrwxrwxrwx. root root May : /etc/alternatives/ld -> /usr/bin/ld.bfd
[root@test nginx-1.12.]# ll /usr/bin/ld.bfd
-rw-rw-rw-. root root Oct /usr/bin/ld.bfd

7、给/usr/bin/ld.bfd文件添加执行权限,编译helloworld成功,./configure 通过gcc环境检查

[root@test ~]# chmod +x /usr/bin/ld.bfd   //添加执行权限
[root@test ~]# which ld
/usr/bin/ld
[root@test ~]# gcc hello_world.c //编译成功
[root@test ~]# ./
a.out create.sh nginx-1.12./ .pki/ .ssh/
[root@test ~]# ./a.out
Hello World
[root@test ~]# cd nginx-1.12./
[root@test nginx-1.12.]# ./configure
checking for OS
+ Linux 3.10.-.el7.x86_64 x86_64
checking for C compiler ... found
+ using GNU C compiler
+ gcc version: 4.8. (Red Hat 4.8.-) (GCC)
checking for gcc -pipe switch ... found
checking for -Wl,-E switch ... found
checking for gcc builtin atomic operations ... found

8、如果gcc编译时,提示找不到下面其中一个或多个文件,也可通过 yum -y reinstall binutils 重新安装工具集

GNU Binutils


The GNU Binutils are a collection of binary tools. The main ones are:

  • ld - the GNU linker.
  • as - the GNU assembler.

But they also include:

  • addr2line - Converts addresses into filenames and line numbers.
  • ar - A utility for creating, modifying and extracting from archives.
  • c++filt - Filter to demangle encoded C++ symbols.
  • dlltool - Creates files for building and using DLLs.
  • gold - A new, faster, ELF only linker, still in beta test.
  • gprof - Displays profiling information.
  • nlmconv - Converts object code into an NLM.
  • nm - Lists symbols from object files.
  • objcopy - Copies and translates object files.
  • objdump - Displays information from object files.
  • ranlib - Generates an index to the contents of an archive.
  • readelf - Displays information from any ELF format object file.
  • size - Lists the section sizes of an object or archive file.
  • strings - Lists printable strings from files.
  • strip - Discards symbols.
  • windmc - A Windows compatible message compiler.
  • windres - A compiler for Windows resource files.

已安装gcc编译器,但./configure还是提示找不到编译器(分析)的更多相关文章

  1. Debian/Ubuntu 已安装gcc/g++ 4.8.1

    gcc 4.8.1 是第一个全然支持C++11(C++14非常可能在gcc 4.9.0開始支持.)的编译器,Windows上能够安装mingw版的.在sourceforge 上有下载.安装也比較方便. ...

  2. linux查看是否已安装GCC及安装GCC

    输入:gcc -v;如果提示未找到命令即表示没有安装 使用:yum install gcc即可

  3. 安装了包,pycharm却提示找不到包

    这段时间,我爬虫爬到了一个论坛的数据,有个分析需要知道他的字符编码,因此使用到了 chardet,我在终端很顺利的安装了这个,但是在pycharm里使用的时候老是提示有错误,向下面这样: 其实这个是因 ...

  4. VMwareTools安装失败提示找不到C headers和gcc目录

    在VMware虚拟机上安装好linux系统后,发现往往不能全屏,也不能设置共享文件夹进行文件共享,这时候可以通过安装VMwareTools这个工具来实现文件拖拽.共享和全屏. 安装的过程不再赘述,关键 ...

  5. 编译安装pgbouncer-checking for OpenSSL... configure: error: not found

    花了一上午时间将pgbouncer的参数通读了一遍,对他有个大致的了解:1.配置分为连接池和pgbouncer两个部分[database]\[pgbouncer ].2.一条记录对应创建一个连接池,连 ...

  6. 【转载·】Linux yum 安装 gcc 、gcc-c++

      2017年09月29日 22:45:54 上善若水 阅读数:6653更多 个人分类: Linux学习 所属专栏: Linux学习杂技   版权声明:本文为博主原创文章,未经博主允许不得转载. ht ...

  7. Linux安装gcc编译器详解

    本人使用的是CentOS 6.5 64位系统,由于在安装系统的时候并没有勾选安装gcc编译器,因此需要自行安装gcc编译器. 使用yum安装gcc 对于配备了yum的Linux发行版而言,安装gcc编 ...

  8. Linux下安装gcc 、g++ 、gfortran编译器

    一.ubuntu下gcc/g++/gfortran的安装 1.安装 (1).gcc ubuntu下自带gcc编译器.可以通过“gcc -v”命令来查看是否安装. (2).g++ 安装g++编译器,可以 ...

  9. 子进程 已安装 post-installation 脚本 返回错误状态 1,dpkg: 处理软件包 python-crypto (--configure)时出错: 该软件包正处于非常不稳定的状态;

    这几天在学习redis的时候,装软件总是报错,两个问题都和dpkg有关,上网查阅了些解决办法,发现整体来说执行以下方法均可解决. 虽然每个人需要安装的包不同,但是出现此类问题的不同也只有安装包的名字, ...

随机推荐

  1. 善用#waring,#pragma mark 标记

    在项目开发中,我们不可能对着需求一口气将代码都写好.开发过程中肯定遇到诸如需求变动,业务逻辑沟通,运行环境的切换等这些问题.当项目大的时候,如果木有形成统一的代码规范,在项目交接和开发人员沟通上将会带 ...

  2. C语言中参数的传递

    普通情况: 调用函数参数的传递,是采取入栈的方式,先上图一张: Fun是被调用的函数,而为了演示其参数传递的过程,特意多设了几个参数,其传递参数的汇编代码如下: 可以看出,汇编代码中将这9个参数的前5 ...

  3. 【OF框架】使用IDbContextTransaction在框架中对多个实体进行事务操作

    准备 引用框架,按照规范建立数据库表及对应实体. 一.事务操作 关键代码 示例代码如下: //插入数据,使用数据库事务,不支持多连接. var dbContext = IoCHelper.Resolv ...

  4. SpringBoot之多数据源动态切换数据源

    原文:https://www.jianshu.com/p/cac4759b2684 实现 1.建库建表 首先,我们在本地新建三个数据库名分别为master,slave1,slave2,我们的目前就是写 ...

  5. 基于Java+Selenium的WebUI自动化测试框架(四)-----设置监听类

    基于上一篇的内容,这里我们开始写监听类Listener.我这里写监听类的思路是,继承TestListenerAdapter这个类,然后对其中的方法进行重写.网上也有很多资料,建议先学习一下,然后写出来 ...

  6. Git的撤销操作

    https://blog.csdn.net/qq_36431213/article/details/78858848 Git 初接触 (三) Git的撤销操作 git reset HEAD -- gi ...

  7. tomcat启动之后,Chrome浏览器可以访问,IE不行(IE无法访问8080 端口)

    方法简单粗暴,在windows中关闭IE服务,然后再重新安装服务. 请注意,在输入框输入:  http://localhost:8080/myproject 不要直接输入localhost:8080/ ...

  8. PL/SQL使用游标CURSOR

    一.使用游标 对于DML语句和单行select into ,oracle自动分配隐形游标.处理select返回多行语句,可以使用显式游标. 使用显示游标处理多行数据,也可使用SELECT..BULK ...

  9. Educational Codeforces Round 75 (Rated for Div. 2) D. Salary Changing

    链接: https://codeforces.com/contest/1251/problem/D 题意: You are the head of a large enterprise. n peop ...

  10. Vue动态创建注册component的实例代码

    https://segmentfault.com/a/1190000015698278