linux编译配置报错:configure: error: C compiler cannot create executables

血红的双手。 提交于 2020-05-08 14:02:11

  编译配置源码时提示:

[wlf@wlf185 otp_src_21.3]$ ./configure --prefix=/home/wlf/erlang
Ignoring the --cache-file argument since it can cause the system to be erroneously configured
Disabling caching
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/home/wlf/otp_src_21.3':
configure: error: C compiler cannot create executables
See `config.log' for more details

 

  看下config.log:

configure:2576: $? = 0
configure:2565: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)
configure:2576: $? = 0
configure:2565: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:2576: $? = 4
configure:2565: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:2576: $? = 4
configure:2596: checking whether the C compiler works
configure:2618: gcc    conftest.c  >&5
collect2: fatal error: cannot find 'ld'
compilation terminated.
configure:2622: $? = 1
configure:2660: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:2665: error: in `/home/wlf/otp_src_21.3':
configure:2667: error: C compiler cannot create executables
See `config.log' for more details

 

  提示找不到ld,我们确认下:

[wlf@wlf185 otp_src_21.3]$ which ld
/usr/bin/which: no ld in (/usr/local/mongodb/bin:/opt/jdk/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/wlf/.local/bin:/home/wlf/bin)

 

  确实没有ld这个,难道没装ld?那就切换到root装一下吧:

[root@wlf185 bin]# yum install binutils
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Package binutils-2.25.1-22.base.el7.x86_64 already installed and latest version
Nothing to do
[root@wlf185 bin]# ld -v
-bash: ld: command not found

 

  见了鬼了,ld装着呢,就是没法用。重装吧:

[root@wlf185 bin]# yum reinstall binutils
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package binutils.x86_64 0:2.25.1-22.base.el7 will be reinstalled
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
 Package                                Arch                                 Version                                            Repository                         Size
========================================================================================================================================================================
Reinstalling:
 binutils                               x86_64                               2.25.1-22.base.el7                                 DVD                               5.4 M

Transaction Summary
========================================================================================================================================================================
Reinstall  1 Package

Total download size: 5.4 M
Installed size: 22 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : binutils-2.25.1-22.base.el7.x86_64                                                                                                                   1/1 
failed to read link /usr/bin/ld: No such file or directory
  Verifying  : binutils-2.25.1-22.base.el7.x86_64                                                                                                                   1/1 

Installed:
  binutils.x86_64 0:2.25.1-22.base.el7                                                                                                                                  

Complete!
[root@wlf185 bin]# ld -v
GNU ld version 2.25.1-22.base.el7

 

  好了,切回wlf用户重新编译配置。

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!