安装pcre时出现configure: error: C compiler cannot create executables错误
这种编译不通过问题,大致是两方面造成的:
一方面可能是gcc的问题,一般是gcc缺少(链接不对)或者版本不对(过低或过高)。有可能是在装其他软件时候gcc被无意破坏过,或者系统是mini版的,相关配置不全等造成的。这时候如果可以,最好重装对应版本的gcc即可解决。
另一方面可能是要安装的软件缺少相关依赖包,导致编译不通过。这时候要先安装缺少的依赖,全部依赖包或者依赖软件安装完后,执行configure一般就没问题了。
错误结果一样,但可能导致问题的原因不同,还得具体问题具体分析。但是大家遇到类似问题,一般朝以上两方面考虑即可。
下边是我遇到的问题及解决过程,希望对遇到类似问题的小伙伴有帮助
1、./configure时出现以下错误:C compiler cannot create executables
[root@insight pcre-8.39]# ./configure
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 make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/opt/software/pcre-8.39':
configure: error: C compiler cannot create executables
See `config.log' for more details
2、于是查看日志config.log,发现第7行开始报错处:/usr/bin/ld: cannot find -lgcc_s,就是编译时在/usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so找不到lgcc_s,说明libgcc_s.so有问题。
gcc: no input files
configure:3809: $? = 1
configure:3829: checking whether the C compiler works
configure:3851: gcc conftest.c >&5
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status
configure:3855: $? = 1
configure:3893: result: no
configure: failed program was:
|................
| int
| main ()
| {
| ;
| return 0;
| }
configure:3898: error: in `/opt/software/pcre-8.39':
configure:3900: error: C compiler cannot create executables
See `config.log' for more details
3、查看报错的机器 $ ls -l /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so,显示如下
[root@insight pcre-8.39]# ls -l /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so
-rwxr-xr-x. 1 root root 24 May 18 2018 /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so
而去另一台完好的机器查看 $ ls -l /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so,显示如下
[root@node02 ~]# ls -l /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so
lrwxrwxrwx. 1 root root 24 May 18 2018 /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so -> /usr/lib64/libgcc_s.so.1
即发现libgcc_s.so是一个链接文件,对应的真实路径在 /usr/lib64/libgcc_s.so.1,需要为libgcc_s.so添加链接指向
4、于是在报错的机器查找 $ find / -name libgcc_s.so1,可以看到就在/usr/lib64/libgcc_s.so.1下(64位机)
[root@insight pcre-8.39]# find / -name libgcc_s.so.1
/opt/oracle/app/oracle/product/11.2.0/dbhome_1/lib/stubs/libgcc_s.so.1
/root/libgcc_s.so.1
/lib/libgcc_s.so.1
/usr/lib/vmware-tools/lib32/libgcc_s.so.1
/usr/lib/vmware-tools/lib32/libgcc_s.so.1/libgcc_s.so.1
/usr/lib/vmware-tools/lib64/libgcc_s.so.1
/usr/lib/vmware-tools/lib64/libgcc_s.so.1/libgcc_s.so.1
/usr/lib64/libgcc_s.so.1
/lib64/libgcc_s.so.1
没错,就是因为某种原因我们无意破换了libgcc_s.so链接指向,因此需要为libgcc_s.so重新指向对应路径
$ ln -sf /usr/lib64/libgcc_s.so.1 /usr/lib/gcc/x86_64-redhat-linux/4.4.7/libgcc_s.so
好了,再次$ ./configure下,刚才的错误没有了,问题解决
pcre-8.39 configuration summary:
Install prefix .................. : /usr/local
C preprocessor .................. : gcc -E
C compiler ...................... : gcc
C++ preprocessor ................ : g++ -E
C++ compiler .................... : g++
Linker .......................... : /usr/bin/ld -m elf_x86_64
C preprocessor flags ............ :
C compiler flags ................ : -g -O2 -fvisibility=hidden
C++ compiler flags .............. : -O2 -fvisibility=hidden -fvisibility-inlines-hidden
Linker flags .................... :
Extra libraries ................. :
...................................
Buffer size for pcregrep ........ : 20480
Link pcregrep with libz ......... : no
Link pcregrep with libbz2 ....... : no
Link pcretest with libedit ...... : no
Link pcretest with libreadline .. : no
Valgrind support ................ : no
Code coverage ................... : no
相关文章
- linux Python-安装sasl包的错误
- CentOS7+CDH5.14.0安装CDH错误排查: HiveServer2 该角色的进程已退出。该角色的预期状态为已启动
- CentOS7+CDH6.3安装CDH错误排查: HiveServer2 该角色的进程已退出。该角色的预期状态为已启动
- 【Vue】 错误:Already included file name ‘××ב differs from file name ‘××ב only in casing的解决方法
- com.apple.installer.pagecontroller 错误 -1 pkg安装错误
- ubuntu 下安装 VIM 依赖vim-common错误
- win11安装更新错误0x800f081f怎么解决?
- PHP 编程中 10 个最常见的错误,你犯过几个?
- oracle数据库11g(11.2.0.1)安装报错:提示ins_ctx.mk编译错误。
- 安装Apollo8.0可能会遇到的错误
- django之异常错误3(Student matching query does not exist.)
- 【HarmonyOS】【FAQ】使用hdc命令安装hap包时,出现以下错误: failed to install bundle. error: operation time out.
- JDK8安装时错误1335的解决
- 《MySQL排错指南》——1.5 追踪数据中的错误
- 计算机图形学(第2版 于万波 于硕 编著)第45页的Bresenham算法有错误
- [LINUX]VMWARE_TOOLS安装- CD-ROM锁定错误
- 安装Tidb数据库出现SSD硬盘IOPS不到40000的错误
- 安装LINUX X86-64的10201出现链接ins_ctx.mk错误
- delphi vlc 安装bug 处理编译错误"0" is an invalid value for the "DebugInformation" parameter of the "DCC"
- 【Maven】Project configuration is not up-to-date with pom.xml错误解决方法
- 【sql server安装错误】sql server安装错误提示重启失败
- (5.11)mysql复制错误
- Linux下安装redis常见错误server.c:3318:16: error: ‘struct redisServer‘ has no member named ‘loading‘
- linux下无法执行PHP命令,错误 php: command not found