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. 关于MQ的几件小事(五)如何保证消息按顺序执行

    1.为什么要保证顺序 消息队列中的若干消息如果是对同一个数据进行操作,这些操作具有前后的关系,必须要按前后的顺序执行,否则就会造成数据异常.举例: 比如通过mysql binlog进行两个数据库的数据 ...

  2. 让image居中对齐,网页自适应

    <div class="page4_content"> <div class="page4_box"> <div class=&q ...

  3. jmeter学习笔记(三)配置元件之HTTP信息头管理

    使用jmeter模拟发送http请求时,有些请求是需要带上HTTP请求头里面的信息.比如页面需要登录信息的,那个就需要用户登录信息authorization.这个时候是需要使用到HTTP信息头管理器. ...

  4. webstorm编写react native,代码修改后,重新编译运行没有变化的问题

    w我是拷贝一份react native代码到另一台电脑,发现修改代码运行之后不显示修改后的效果,即仍然与原来的效果一样,暂时不知道什么原因, 后来我运行了npm install 就可以了,不知道是不是 ...

  5. nginx 作为静态资源web服务

    Nginx作为静态资源web服务 静态资源web服务-CDN场景 Nginx资源存储中心会把静态资源分发给“北京Nginx”,“湖南Nginx”,“山东Nginx”. 然后北京User发送静态资源请求 ...

  6. JAVA笔记整理(二),下载安装JDK

    Windows平台 1.登录Oracle官方网站(http://www.oracle.com/index.html),找到下载 2.选择要下载的版本,点击JDK DOWNLOAD 3.下载文件,先勾选 ...

  7. Hadoop读写mysql

    需求 两张表,一张click表记录某广告某一天的点击量,另一张total_click表记录某广告的总点击量 建表 CREATE TABLE `click` ( `id` ) NOT NULL AUTO ...

  8. 团队第六次作业-Beta冲刺及发布说明

    1.相关信息 Q A 作业所属课程 https://edu.cnblogs.com/campus/xnsy/2019autumnsystemanalysisanddesign/ 作业要求 https: ...

  9. PowerMockito单元测试中的Invalid use of argument matchers问题详解

    首先,简单说说PowerMockito进行单元测试的三部曲: 打桩,即为非测试目标方法设置返回值,这些返回值在测试目标方法中被使用.执行测试,调用测试目标方法.验证测试结果,如测试方法是否被执行,测试 ...

  10. HDU 6187 Destroy Walls (思维,最大生成树)

    HDU 6187 Destroy Walls (思维,最大生成树) Destroy Walls *Time Limit: 8000/4000 MS (Java/Others) Memory Limit ...