Bug 52007 - configure: error: installation or configuration problem: C compiler cannot create executables
Summary: configure: error: installation or configuration problem: C compiler cannot cr...
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 4.2.4
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-26 10:22 UTC by chilaka
Modified: 2012-05-31 19:01 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-01-26 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description chilaka 2012-01-26 10:22:27 UTC
While installing gcc on a IA64 rhel5 box, I am facing the below problem.


/root/gcc/gcc-4.2.4
[root@colt102d gcc-4.2.4]# CC=gcc
[root@colt102d gcc-4.2.4]# export CC
[root@colt102d gcc-4.2.4]# ./configure 
loading cache ./config.cache
checking host system type... ia64-unknown-linux-gnu
checking target system type... ia64-unknown-linux-gnu
checking build system type... ia64-unknown-linux-gnu
checking for a BSD compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for gcc... gcc
checking whether the C compiler (gcc  ) works... no
configure: error: installation or configuration problem: C compiler cannot create executables.
[root@colt102d gcc-4.2.4]# uname -m
ia64
[root@colt102d gcc-4.2.4]# uname -a
Linux colt102d.fchst.usa.hp.com 2.6.18-274.el5 #1 SMP Fri Jul 8 17:41:07 EDT 2011 ia64 ia64 ia64 GNU/Linux

Thanks
Ravi
Comment 1 Andrew Pinski 2012-01-26 10:24:37 UTC
You should look into config.log to find out why it fails.  Also don't build in the source directory.  I bet you don't have all the right packages installed to use gcc.
Comment 2 chilaka 2012-01-26 10:28:52 UTC
(In reply to comment #1)
> You should look into config.log to find out why it fails.  Also don't build in
> the source directory.  I bet you don't have all the right packages installed to
> use gcc.

config.log content

configure:630: checking host system type
configure:651: checking target system type
configure:669: checking build system type
configure:724: checking for a BSD compatible install
configure:777: checking whether ln works
configure:801: checking whether ln -s works
configure:1866: checking for gcc
configure:1979: checking whether the C compiler (gcc  ) works
configure:1995: gcc -o conftest    conftest.c  1>&5
./configure: line 1994: gcc: command not found
configure: failed program was:

#line 1990 "configure"
#include "confdefs.h"
Comment 3 chilaka 2012-01-26 10:39:37 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > You should look into config.log to find out why it fails.  Also don't build in
> > the source directory.  I bet you don't have all the right packages installed to
> > use gcc.
> 
> config.log content
> 
> configure:630: checking host system type
> configure:651: checking target system type
> configure:669: checking build system type
> configure:724: checking for a BSD compatible install
> configure:777: checking whether ln works
> configure:801: checking whether ln -s works
> configure:1866: checking for gcc
> configure:1979: checking whether the C compiler (gcc  ) works
> configure:1995: gcc -o conftest    conftest.c  1>&5
> ./configure: line 1994: gcc: command not found
> configure: failed program was:
> 
> #line 1990 "configure"
> #include "confdefs.h"

Now I have ran autoconf and then ./configure. Here is content of config.log

#/usr/local/bin/autoconf -v
# ./configure 
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by configure, which was
generated by GNU Autoconf 2.59.  Invocation command line was

  $ ./configure 

## --------- ##
## Platform. ##
## --------- ##

hostname = colt102d.fchst.usa.hp.com
uname -m = ia64
uname -r = 2.6.18-274.el5
uname -s = Linux
uname -v = #1 SMP Fri Jul 8 17:41:07 EDT 2011

/usr/bin/uname -p = unknown
/bin/uname -X     = unknown

/bin/arch              = ia64
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
hostinfo               = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /usr/kerberos/sbin
PATH: /usr/kerberos/bin
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /sbin
PATH: /bin
PATH: /usr/sbin 
PATH: /usr/bin
PATH: /root/bin 


## ----------- ##
## Core tests. ##
## ----------- ##

configure:1330: checking build system type
configure:1348: result: ia64-unknown-linux-gnu
configure:1356: checking host system type
configure:1370: result: ia64-unknown-linux-gnu
configure:1378: checking target system type
configure:1392: result: ia64-unknown-linux-gnu
configure:1434: checking for a BSD-compatible install
configure:1489: result: /usr/bin/install -c
configure:1500: checking whether ln works
configure:1522: result: yes
configure:1526: checking whether ln -s works
configure:1530: result: yes
configure:2623: checking for gcc
configure:2649: result: gcc
configure:2893: checking for C compiler version
configure:2896: gcc --version </dev/null >&5
./configure: line 2897: gcc: command not found
configure:2899: $? = 127
configure:2901: gcc -v </dev/null >&5
./configure: line 2902: gcc: command not found
configure:2904: $? = 127
configure:2906: gcc -V </dev/null >&5
./configure: line 2907: gcc: command not found
configure:2909: $? = 127
configure:2932: checking for C compiler default output file name
configure:2935: gcc    conftest.c  >&5
./configure: line 2936: gcc: command not found
configure:2938: $? = 127
configure: failed program was:
| /* confdefs.h.  */
|
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:2977: error: C compiler cannot create executables
See `config.log' for more details.

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=ia64-unknown-linux-gnu
ac_cv_build_alias=ia64-unknown-linux-gnu
ac_cv_env_CC_set=set
ac_cv_env_CC_value=gcc
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_host=ia64-unknown-linux-gnu
ac_cv_host_alias=ia64-unknown-linux-gnu
ac_cv_path_install='/usr/bin/install -c'
ac_cv_prog_ac_ct_CC=gcc
ac_cv_target=ia64-unknown-linux-gnu
ac_cv_target_alias=ia64-unknown-linux-gnu
acx_cv_prog_LN=ln

## ----------------- ##
## Output variables. ##
## ----------------- ##

AR=''
AR_FOR_TARGET=''
AS=''
AS_FOR_TARGET=''
BISON=''
CC='gcc'
CC_FOR_BUILD='$(CC)'
CC_FOR_TARGET=''
CFLAGS=''
CFLAGS_FOR_BUILD=''
COMPILER_AS_FOR_TARGET=''
COMPILER_LD_FOR_TARGET=''
COMPILER_NM_FOR_TARGET=''
CONFIGURE_GDB_TK=''
CPPFLAGS=''
CXX=''
CXXFLAGS=''
CXX_FOR_TARGET=''
DEFS=''
DLLTOOL=''
DLLTOOL_FOR_TARGET=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EXEEXT=''
EXPECT=''
FLAGS_FOR_TARGET=''
FLEX=''
GCC_FOR_TARGET=''
GCJ_FOR_TARGET=''
GDB_TK=''
GFORTRAN_FOR_TARGET=''
GNATBIND=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_GDB_TK=''
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
LD=''
LDFLAGS=''
LD_FOR_TARGET=''
LEX=''
LIBOBJS=''
LIBS=''
LIPO=''
LIPO_FOR_TARGET=''
LN='ln'
LN_S='ln -s'
LTLIBOBJS=''
M4=''
MAINT=''
MAINTAINER_MODE_FALSE=''
MAINTAINER_MODE_TRUE=''
MAKEINFO=''
NM=''
NM_FOR_TARGET=''
OBJCOPY=''
OBJDUMP=''
OBJDUMP_FOR_TARGET=''
OBJEXT=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
RANLIB=''
RANLIB_FOR_TARGET=''
RAW_CXX_FOR_TARGET=''
RPATH_ENVVAR=''
RUNTEST=''
SHELL='/bin/sh'
STRIP=''
STRIP_FOR_TARGET=''
SYSROOT_CFLAGS_FOR_TARGET=''
TOPLEVEL_CONFIGURE_ARGUMENTS='./configure '
WINDRES=''
WINDRES_FOR_TARGET=''
YACC=''
ac_ct_CC='gcc'
ac_ct_GNATBIND=''
bindir='${exec_prefix}/bin'
build='ia64-unknown-linux-gnu'
build_alias=''
build_configargs=''
build_configdirs='build-libiberty build-texinfo build-byacc build-flex build-bison build-m4 build-fixincludes'
build_cpu='ia64'
build_libsubdir='build-ia64-unknown-linux-gnu'
build_os='linux-gnu'
build_subdir='build-ia64-unknown-linux-gnu'
build_tooldir=''
build_vendor='unknown'
config_shell='/bin/sh'
configdirs='intl mmalloc libiberty opcodes bfd readline tcl tk itcl libgui zlib libcpp libdecnumber texinfo byacc flex bison binutils gas ld fixincludes gcc sid sim gdb make patch prms send-pr gprof etc expect dejagnu ash bash bzip2 m4 autoconf automake libtool diff rcs fileutils shellutils time textutils wdiff find uudecode hello tar gzip indent recode release sed utils guile perl gawk findutils gettext zip fastjar gnattools'
datadir='${prefix}/share'
datarootdir=''
do_compare=''
docdir=''
exec_prefix='NONE'
gmpinc=''
gmplibs=''
host='ia64-unknown-linux-gnu'
host_alias=''
host_configargs=''
host_cpu='ia64'
host_os='linux-gnu'
host_subdir='host-ia64-unknown-linux-gnu'
host_vendor='unknown'
htmldir=''
includedir='${prefix}/include'
infodir='${prefix}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localstatedir='${prefix}/var'
mandir='${prefix}/man'
oldincludedir='/usr/include'
prefix='NONE'
program_transform_name='s,x,x,'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
stage1_cflags=''
stage1_checking=''
stage1_languages=''
stage2_werror_flag=''
sysconfdir='${prefix}/etc'
target='ia64-unknown-linux-gnu'
target_alias=''
target_configargs=''
target_cpu='ia64'
target_os='linux-gnu'
target_subdir='ia64-unknown-linux-gnu'
target_vendor='unknown'
tooldir=''

## ------------- ##
## Output files. ##
## ------------- ##

alphaieee_frag=''
host_makefile_frag='/dev/null'
ospace_frag=''
serialization_dependencies=''
target_makefile_frag=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

#define PACKAGE_BUGREPORT ""
#define PACKAGE_NAME ""
#define PACKAGE_STRING ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""

configure: exit 77
Comment 4 Jakub Jelinek 2012-01-26 10:40:52 UTC
gcc: command not found
is a user error, if you don't have a compiler installed, obviously you can't compile anything.  yum install gcc should cure it (but to build gcc you'll need some other packages too, like gmp-devel, mpfr-devel etc.).
Comment 5 Jonathan Wakely 2012-01-26 10:41:20 UTC
The problem you're facing is that you didn't read the documentation on installing GCC, starting at http://gcc.gnu.org/install/ and summarised at http://gcc.gnu.org/wiki/InstallingGCC

We can't really help you if you don't read the documentation.

The first prerequisite for compiling GCC is a working compiler.  You've told configure to use CC=gcc but apparently you don't have gcc installed.  That's not going to work.

If it's a rhel5 box then install the gcc rpm.
Comment 6 Jonathan Wakely 2012-01-26 10:44:35 UTC
(In reply to comment #3)
> 
> Now I have ran autoconf and then ./configure. Here is content of config.log
> 
> #/usr/local/bin/autoconf -v
> # ./configure 

Why have you done that?  Where in the GCC installation docs does it say to run autoconf?  It doesn't, and it explicitly tells you not to run ./configure, and Andrew also told you not to build in the source directory. Read the docs. Building a compiler is not like building other software, don't assume you know how to do it.
Comment 7 chilaka 2012-01-26 10:49:12 UTC
Thanks for the inputs.
Comment 8 chilaka 2012-01-27 12:17:44 UTC
I managed to generate a Makefile in objdir then issued a make command from that directory. After a 10 minute compilation it ended with the below error.

checking for suffix of object files... configure: error: cannot compute suffix of object files: cannot compile

Note: I don't have any IA64 files/binaries on my host machine where this cross
compilation is going, so I have not setup where to look for target files. Is this is the reason for this failure. 

[root@localhost objdir]# uname -a
Linux localhost.localdomain 2.6.25-14.fc9.i686 #1 SMP Thu May 1 06:28:41 EDT 2008 i686 i686 i386 GNU/Linux
[root@localhost objdir]# pwd
/opt/objdir
[root@localhost objdir]# ../gcc-4.3.0/configure --prefix=/opt/ia64gcc   --target=ia64-redhat-linux  
[root@localhost objdir]# make 
:
make[2]: Leaving directory `/opt/objdir/gcc'
Checking multilib configuration for libgcc...
mkdir -p -- ia64-redhat-linux/libgcc
Configuring in ia64-redhat-linux/libgcc
configure: creating cache ./config.cache
checking for --enable-version-specific-runtime-libs... no
checking for a BSD-compatible install... /usr/bin/install -c
checking for gawk... gawk
checking build system type... i686-pc-linux-gnu
checking host system type... ia64-redhat-linux-gnu
checking for ia64-redhat-linux-ar... ia64-redhat-linux-ar
checking for ia64-redhat-linux-lipo... ia64-redhat-linux-lipo
checking for ia64-redhat-linux-nm... /opt/objdir/./gcc/nm
checking for ia64-redhat-linux-ranlib... ia64-redhat-linux-ranlib
checking for ia64-redhat-linux-strip... ia64-redhat-linux-strip
checking whether ln -s works... yes
checking for ia64-redhat-linux-gcc... /opt/objdir/./gcc/xgcc -B/opt/objdir/./gcc/ -B/opt/ia64gcc/ia64-redhat-linux/bin/ -B/opt/ia64gcc/ia64-redhat-linux/lib/ -isystem /opt/ia64gcc/ia64-redhat-linux/include -isystem /opt/ia64gcc/ia64-redhat-linux/sys-include
checking for suffix of object files... configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[1]: *** [configure-target-libgcc] Error 1
make[1]: Leaving directory `/opt/objdir'
make: *** [all] Error 2

[root@localhost objdir]# tail -40  config.log
sharedstatedir='${prefix}/com'
stage1_cflags='-g -fkeep-inline-functions'
stage1_checking='--enable-checking=yes,types'
stage1_languages='c'
stage2_werror_flag=''
sysconfdir='${prefix}/etc'
target='ia64-redhat-linux-gnu'
target_alias='ia64-redhat-linux'
target_configargs='--cache-file=./config.cache --enable-multilib --with-cross-host=i686-pc-linux-gnu '--prefix=/opt/ia64gcc' '--enable-languages=c,c++,fortran,java,objc' --program-transform-name='s,^,ia64-redhat-linux-,''
target_cpu='ia64'
target_noncanonical='ia64-redhat-linux'
target_os='linux-gnu'
target_subdir='ia64-redhat-linux'
target_vendor='redhat'
tooldir='${exec_prefix}/ia64-redhat-linux'

## ------------- ##
## Output files. ##
## ------------- ##

alphaieee_frag='/dev/null'
host_makefile_frag='../gcc-4.3.0/config/mh-x86omitfp'
ospace_frag='/dev/null'
serialization_dependencies='serdep.tmp'
target_makefile_frag='../gcc-4.3.0/config/mt-gnu'

## ----------- ##
## confdefs.h. ##
## ----------- ##

#define PACKAGE_BUGREPORT ""
#define PACKAGE_NAME ""
#define PACKAGE_STRING ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#endif
#ifdef __cplusplus
extern "C" void exit (int) throw ();

configure: exit 0
Comment 9 chilaka 2012-01-28 04:03:49 UTC
Though this is not a bug, I want to reopen this case for your valuable assistance in resolving this issue.
If that is not feasible, I will close the case with out any second thought.

Thanks
Ravi
Comment 10 Andrew Pinski 2012-01-28 04:05:52 UTC
You need to have follow the directorions for building a cross sysroot or have a sysroot already built.
Comment 11 chilaka 2012-01-28 07:18:25 UTC
(In reply to comment #10)
> You need to have follow the directorions for building a cross sysroot or have a
> sysroot already built.


 ../gcc-4.3.0/configure --target=ia64-redhat-linux --prefix=/opt/ia64gcc/  --with-sysroot=/colt102d/

While configuring I see below message, I guess it should be yes. 
"checking whether we are cross compiling... no" 

colt102d directory contains target machine's /usr,/lib directories.
Comment 12 Benjamin Kosnik 2012-05-31 18:58:06 UTC
Author: bkoz
Date: Thu May 31 18:57:56 2012
New Revision: 188077

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188077
Log:
2012-05-31  Benjamin Kosnik  <bkoz@redhat.com>

        PR libstdc++/52007
        * configure.ac: Allow gnu, gnu* variants for --enable-symvers argument.
        * configure: Regenerated.


Modified:
    branches/gcc-4_7-branch/libquadmath/ChangeLog
    branches/gcc-4_7-branch/libquadmath/configure
    branches/gcc-4_7-branch/libquadmath/configure.ac
Comment 13 Benjamin Kosnik 2012-05-31 18:59:38 UTC
Author: bkoz
Date: Thu May 31 18:59:34 2012
New Revision: 188078

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188078
Log:
2012-05-31  Benjamin Kosnik  <bkoz@redhat.com>

        PR libstdc++/52007
        * configure.ac: Allow gnu, gnu* variants for --enable-symvers argument.
        * configure: Regenerated.

Modified:
    branches/gcc-4_7-branch/libssp/ChangeLog
    branches/gcc-4_7-branch/libssp/configure
    branches/gcc-4_7-branch/libssp/configure.ac
Comment 14 Benjamin Kosnik 2012-05-31 19:01:01 UTC
Author: bkoz
Date: Thu May 31 19:00:58 2012
New Revision: 188079

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188079
Log:
2012-05-31  Benjamin Kosnik  <bkoz@redhat.com>

        PR libstdc++/52007
        * configure.ac: Allow gnu, gnu* variants for --enable-symvers argument.
        * configure: Regenerated.


Modified:
    branches/gcc-4_7-branch/libgfortran/ChangeLog
    branches/gcc-4_7-branch/libgfortran/configure
    branches/gcc-4_7-branch/libgfortran/configure.ac