[Solved] Linux Error: configure: error: C compiler cannot create executables

Prompt when compiling and configuring source code:

[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

See 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

If LD can’t be found, let’s confirm:

[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)

There is no LD, isn’t it? Then switch to root and install it

[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

Seeing the ghost, I’m pretending, but I can’t use it. Come back

[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

OK, switch back to WLF user and recompile the configuration

Similar Posts: