Bug 758528 - gcc can not compile a program
Summary: gcc can not compile a program
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 16
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-11-30 00:32 UTC by George R. Goffe
Modified: 2011-12-08 23:06 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-11-30 07:54:05 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
output of requested strace command compiling tst.c (35.29 KB, application/octet-stream)
2011-12-08 03:47 UTC, George R. Goffe
no flags Details

Description George R. Goffe 2011-11-30 00:32:37 UTC
Description of problem:

This is a recently upgraded system from FC14 x86_64 to FC16 x86_64. Trying to build ktorrent which has been building on FC14, I get this message and others.

The C compiler "/usr/bin/gcc" is not able to compile a simple test program.

The ktorrent bug is at bugs.kde.org, Bug 287827 - unable to build ktorrent after re-clo... 

Additionally, I ran "yum re-install gcc\*" and retried the build with the same results.

Version-Release number of selected component (if applicable):


How reproducible:

Always.

Steps to Reproduce:
1.erase ktorrent and libktorrent from tools/ktorrent and get fresh copies from the git repository

run git clone git://anongit.kde.org/libktorrent 
and git clone git://anongit.kde.org/ktorrent

2.try the build process (see log from failed build attempt below).
3.
  
Actual results:


Expected results:


Additional info:

remove ktorrent and libktorrent directories
run git clone git://anongit.kde.org/libktorrent 
and git clone git://anongit.kde.org/ktorrent
 cd libktorrent/build
 cmake -DLIB_SUFFIX=64 -DLIB_INSTALL_DIR:PATH=/usr/lib64
-DCMAKE_INSTALL_PREFIX=/usr/lsd/$osname ..




First build attempt after a system upgrade of FC14 x86_64 system to FC16
x86_64)

#!/bin/bash -xv

 cd /tools/ktorrent
+ cd /tools/ktorrent

 which automoc4
+ which automoc4
/usr/bin/automoc4

 automoc4 --version
+ automoc4 --version
automoc4 0.9.88

 ./updkt
+ ./updkt
module () {  eval `/usr/bin/modulecmd bash $*`
}
#!/bin/bash -xv

 cd /tools/ktorrent
+ cd /tools/ktorrent

 cd  libktorrent
+ cd libktorrent
 git pull --verbose
+ git pull --verbose
From git://anongit.kde.org/libktorrent
 = [up to date]      1.0        -> origin/1.0
 = [up to date]      1.1        -> origin/1.1
 = [up to date]      master     -> origin/master
Already up-to-date.

 cd  ../ktorrent
+ cd ../ktorrent
 git pull --verbose
+ git pull --verbose
From git://anongit.kde.org/ktorrent
 = [up to date]      1.0        -> origin/1.0
 = [up to date]      1.1        -> origin/1.1
 = [up to date]      1.2        -> origin/1.2
 = [up to date]      2.0        -> origin/2.0
 = [up to date]      2.1        -> origin/2.1
 = [up to date]      3.0        -> origin/3.0
 = [up to date]      3.1        -> origin/3.1
 = [up to date]      3.2        -> origin/3.2
 = [up to date]      3.3        -> origin/3.3
 = [up to date]      4.0        -> origin/4.0
 = [up to date]      4.1        -> origin/4.1
 = [up to date]      master     -> origin/master
Already up-to-date.

 exit 0
+ exit 0

 mkdir  libktorrent/build 2>/dev/null
+ mkdir libktorrent/build
 cd  libktorrent/build
+ cd libktorrent/build
 cmake -DLIB_SUFFIX=64 -DLIB_INSTALL_DIR:PATH=/usr/lib64
-DCMAKE_INSTALL_PREFIX=/usr/lsd/$osname ..
+ cmake -DLIB_SUFFIX=64 -DLIB_INSTALL_DIR:PATH=/usr/lib64
-DCMAKE_INSTALL_PREFIX=/usr/lsd/Linux ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- broken
CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
  The C compiler "/usr/bin/gcc" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: /tools/ktorrent/libktorrent/build/CMakeFiles/CMakeTmp



  Run Build Command:/usr/bin/gmake "cmTryCompileExec/fast"

  /usr/bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make
  CMakeFiles/cmTryCompileExec.dir/build

  gmake[1]: Entering directory
 
`/sdb1/clipper/export/home/tools/ktorrent/libktorrent/build/CMakeFiles/CMakeTmp'


  /usr/bin/cmake -E cmake_progress_report
  /tools/ktorrent/libktorrent/build/CMakeFiles/CMakeTmp/CMakeFiles 1

  Building C object CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o

  /usr/bin/gcc -o CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o -c
  /tools/ktorrent/libktorrent/build/CMakeFiles/CMakeTmp/testCCompiler.c

  Linking C executable cmTryCompileExec

  /usr/bin/cmake -E cmake_link_script
  CMakeFiles/cmTryCompileExec.dir/link.txt --verbose=1

  /usr/bin/gcc CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o -o
  cmTryCompileExec -rdynamic

  /usr/bin/ld: cannot find crt1.o: No such file or directory

  /usr/bin/ld: cannot find crti.o: No such file or directory

  collect2: ld returned 1 exit status

  gmake[1]: Leaving directory
 
`/sdb1/clipper/export/home/tools/ktorrent/libktorrent/build/CMakeFiles/CMakeTmp'


  gmake[1]: *** [cmTryCompileExec] Error 1

  gmake: *** [cmTryCompileExec/fast] Error 2





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)


CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 2.8)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!
 make clean
+ make clean
make: *** No rule to make target `clean'.  Stop.
 make depend
+ make depend
make: *** No rule to make target `depend'.  Stop.
 make
+ make
make: *** No targets specified and no makefile found.  Stop.
 make install
+ make install
make: *** No rule to make target `install'.  Stop.

 mkdir  ../../ktorrent/build 2>/dev/null
+ mkdir ../../ktorrent/build
 cd  ../../ktorrent/build
+ cd ../../ktorrent/build
 cmake -DLIB_SUFFIX=64 -DLIB_INSTALL_DIR:PATH=/usr/lib64
-DCMAKE_INSTALL_PREFIX=/usr/lsd/$osname ..
+ cmake -DLIB_SUFFIX=64 -DLIB_INSTALL_DIR:PATH=/usr/lib64
-DCMAKE_INSTALL_PREFIX=/usr/lsd/Linux ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- broken
CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
  The C compiler "/usr/bin/gcc" is not able to compile a simple test program.

  It fails with the following output:

   Change Dir: /tools/ktorrent/ktorrent/build/CMakeFiles/CMakeTmp



  Run Build Command:/usr/bin/gmake "cmTryCompileExec/fast"

  /usr/bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make
  CMakeFiles/cmTryCompileExec.dir/build

  gmake[1]: Entering directory
  `/sdb1/clipper/export/home/tools/ktorrent/ktorrent/build/CMakeFiles/CMakeTmp'


  /usr/bin/cmake -E cmake_progress_report
  /tools/ktorrent/ktorrent/build/CMakeFiles/CMakeTmp/CMakeFiles 1

  Building C object CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o

  /usr/bin/gcc -o CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o -c
  /tools/ktorrent/ktorrent/build/CMakeFiles/CMakeTmp/testCCompiler.c

  Linking C executable cmTryCompileExec

  /usr/bin/cmake -E cmake_link_script
  CMakeFiles/cmTryCompileExec.dir/link.txt --verbose=1

  /usr/bin/gcc CMakeFiles/cmTryCompileExec.dir/testCCompiler.c.o -o
  cmTryCompileExec -rdynamic

  /usr/bin/ld: cannot find crt1.o: No such file or directory

  /usr/bin/ld: cannot find crti.o: No such file or directory

  collect2: ld returned 1 exit status

  gmake[1]: Leaving directory
  `/sdb1/clipper/export/home/tools/ktorrent/ktorrent/build/CMakeFiles/CMakeTmp'


  gmake[1]: *** [cmTryCompileExec] Error 1

  gmake: *** [cmTryCompileExec/fast] Error 2





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)


CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 2.8)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!
 make clean
+ make clean
make: *** No rule to make target `clean'.  Stop.
 make depend
+ make depend
make: *** No rule to make target `depend'.  Stop.
 make
+ make
make: *** No targets specified and no makefile found.  Stop.
 make install
+ make install
make: *** No rule to make target `install'.  Stop.

 exit 0
+ exit 0

Comment 1 George R. Goffe 2011-11-30 07:05:32 UTC
Hi Jakub,

The plot thickens...

I tried building some other software which has failed just like this test program (see below). A web search talks about glibc-devel missing. Since this is an x86_64 system I expected to see the x86_64 version to be installed which it is, and the i686 version to NOT be installed, it is not.

This test program fails:

gcc tst.c 
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
collect2: ld returned 1 exit status

Is this an ld problem?

George...

Comment 2 George R. Goffe 2011-11-30 07:08:04 UTC
Jakub,

More informaton.

George...

tch.o linked.o mouse.o memory.o nonansi.o parser.o prefix.o print.o query.o query1.o query2.o regex.o reserved.o rexx.o scroll.o show.o single.o sort.o target.o the.o mygetopt.o util.o  -o nthe -g  -m64 -L/usr/lib64 -lncurses -L/usr/lsd/Linux/lib64 -lregina  -lcrypt -ldl   -lm
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
collect2: ld returned 1 exit status
make: *** [nthe] Error 1
clipper bash-4.2 /tools/the/THE-3.3RC1# which ld
/usr/bin/ld
clipper bash-4.2 /tools/the/THE-3.3RC1# ld --version
GNU ld version 2.21.53.0.1-2.fc16 20110716
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

Comment 3 Jakub Jelinek 2011-11-30 07:54:05 UTC
Much more interesting is what
rpm -q glibc-devel glibc-headers libgcc gcc
prints.  In order to link 64-bit you need at least:
glibc-devel-2.14.90-19.x86_64
glibc-headers-2.14.90-19.x86_64
libgcc-4.6.2-1.fc16.x86_64
gcc-4.6.2-1.fc16.x86_64

and if you want to additionally 

glibc-devel-2.14.90-19.i686
libgcc-4.6.2-1.fc16.i686

as well.  Note that gcc has dependencies on glibc-devel, glibc-headers etc., so it must be some user error if you are missing them.

Comment 4 George R. Goffe 2011-11-30 18:42:24 UTC
Jakub,

Thanks for your hard work on this.

This system has recently been upgraded from FC14 x86_64 (where I built code frequently without problems) to FC16 via the preupgrade process. This upgrade had problems in glibc cleanup with a grub rpm. I have NO idea how to determine if the subsequent reboot which continued the process actually produced a viable system. My assumption was yes which may be in error.

I have not added or removed rpm's from this system since it's upgrade. I have run "yum update" several times though. Could the upgrade process have problems?

I'll run your commands above when I get home tonight from work and post the results here.

Thanks,

George...

Comment 5 George R. Goffe 2011-12-01 04:44:51 UTC
Jakub,

Here's what my system says about your rpm -q command:

rpm -q glibc-devel glibc-headers libgcc gcc
glibc-devel-2.14.90-19.x86_64
glibc-headers-2.14.90-19.x86_64
libgcc-4.6.2-1.fc16.x86_64
libgcc-4.6.2-1.fc16.i686
gcc-4.6.2-1.fc16.x86_64

Any thoughts about this?

George...

Comment 6 Ian Collier 2011-12-02 11:19:17 UTC
What does "gcc -v tst.c" say?  Here, that would contain the line:

LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.6.2/:/usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../../:/lib/:/usr/lib/

where crt1.o is found in the second of those (taking into account all the dots, that's really just /usr/lib64).  Yours is being found in the fifth one (/usr/lib) which means either the path is wrong or crt1.o is missing or malformed.

Comment 7 George R. Goffe 2011-12-02 17:33:11 UTC
Ian,

Thanks for your response. Here's the answer to your question.

I have "yum reinstalled" gcc (et. al.), binutils, coreutils, ccache, glibc-devel.. Did I miss any?

George...

[root@clipper ~]# gcc -v tst.c
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.6.2/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 --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.6.2 20111027 (Red Hat 4.6.2-1) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/4.6.2/cc1 -quiet -v tst.c -quiet -dumpbase tst.c -mtune=generic -march=x86-64 -auxbase tst -version -o /tmp/ccLDPDVD.s
GNU C (GCC) version 4.6.2 20111027 (Red Hat 4.6.2-1) (x86_64-redhat-linux)
        compiled by GNU C version 4.6.2 20111027 (Red Hat 4.6.2-1), GMP version 4.3.2, MPFR version 3.0.0, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.6.2/include-fixed"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-redhat-linux/4.6.2/include
 /usr/local/include
 /usr/include
End of search list.
GNU C (GCC) version 4.6.2 20111027 (Red Hat 4.6.2-1) (x86_64-redhat-linux)
        compiled by GNU C version 4.6.2 20111027 (Red Hat 4.6.2-1), GMP version 4.3.2, MPFR version 3.0.0, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: d0509cacf8e2dc8d8d001fecf2ae324f
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
 as --64 -o /tmp/ccRlSohw.o /tmp/ccLDPDVD.s
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.6.2/:/usr/libexec/gcc/x86_64-redhat-linux/4.6.2/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.6.2/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.6.2/:/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/4.6.2/collect2 --build-id --no-add-needed --eh-frame-hdr -m elf_x86_64 --hash-style=gnu -dynamic-linker /lib64/ld-linux-x86-64.so.2 crt1.o crti.o /usr/lib/gcc/x86_64-redhat-linux/4.6.2/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.6.2 -L/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../.. /tmp/ccRlSohw.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/4.6.2/crtend.o crtn.o
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
collect2: ld returned 1 exit status

Comment 8 George R. Goffe 2011-12-02 17:34:16 UTC
Ian,

I also tried installing glibc-devel.i686 but got complaints about architecture being x86 vs x86_64.

George...

Comment 9 Jakub Jelinek 2011-12-02 17:43:50 UTC
Can you
ls -ld /usr/lib64 /usr/lib64/*crt*
ls -ld /usr/lib/gcc /usr/lib/gcc/x86_64-redhat-linux /usr/lib/gcc/x86_64-redhat-linux/4.6.2
?  Also, please run /usr/bin/gcc to make sure ccache isn't messing stuff.
The above LIBRARY_PATH= in the output is definitely unexpected,
it should be:
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.6.2/:/usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../../:/lib/:/usr/lib/

Comment 10 George R. Goffe 2011-12-03 03:43:13 UTC
clipper bash-4.2 ~# ls -ld /usr/lib64 /usr/lib64/*crt*
dr-xr-xr-x. 351 root root 278528 Dec  2 00:09 /usr/lib64
-rw-r--r--    1 root root   1648 Nov 20 20:44 /usr/lib64/crt1.o
-rw-r--r--    1 root root   1504 Nov 20 20:44 /usr/lib64/crti.o
-rw-r--r--    1 root root    760 Nov 20 20:44 /usr/lib64/crtn.o
-rw-r--r--    1 root root   2400 Nov 20 20:44 /usr/lib64/gcrt1.o
-rw-r--r--    1 root root    616 Nov 20 20:44 /usr/lib64/Mcrt1.o
-rw-r--r--    1 root root   1696 Nov 20 20:44 /usr/lib64/Scrt1.o
clipper bash-4.2 ~# 
clipper bash-4.2 ~# 
clipper bash-4.2 ~# ls -ld /usr/lib/gcc /usr/lib/gcc/x86_64-redhat-linux /usr/lib/gcc/x86_64-redhat-linux/4.6.2
drwxr-xr-x. 5 root root 4096 Oct 27 04:37 /usr/lib/gcc
drwxr-xr-x. 4 root root 4096 Oct 27 04:37 /usr/lib/gcc/x86_64-redhat-linux
drwxr-xr-x. 5 root root 4096 Nov 29 03:12 /usr/lib/gcc/x86_64-redhat-linux/4.6.2




clipper bash-4.2 ~# /usr/bin/gcc -v tst.c
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.6.2/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 --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.6.2 20111027 (Red Hat 4.6.2-1) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/4.6.2/cc1 -quiet -v tst.c -quiet -dumpbase tst.c -mtune=generic -march=x86-64 -auxbase tst -version -o /tmp/ccohNEI1.s
GNU C (GCC) version 4.6.2 20111027 (Red Hat 4.6.2-1) (x86_64-redhat-linux)
        compiled by GNU C version 4.6.2 20111027 (Red Hat 4.6.2-1), GMP version 4.3.2, MPFR version 3.0.0, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.6.2/include-fixed"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-redhat-linux/4.6.2/include
 /usr/local/include
 /usr/include
End of search list.
GNU C (GCC) version 4.6.2 20111027 (Red Hat 4.6.2-1) (x86_64-redhat-linux)
        compiled by GNU C version 4.6.2 20111027 (Red Hat 4.6.2-1), GMP version 4.3.2, MPFR version 3.0.0, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: d0509cacf8e2dc8d8d001fecf2ae324f
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
 as --64 -o /tmp/ccOVzgTu.o /tmp/ccohNEI1.s
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.6.2/:/usr/libexec/gcc/x86_64-redhat-linux/4.6.2/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.6.2/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.6.2/:/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/4.6.2/collect2 --build-id --no-add-needed --eh-frame-hdr -m elf_x86_64 --hash-style=gnu -dynamic-linker /lib64/ld-linux-x86-64.so.2 crt1.o crti.o /usr/lib/gcc/x86_64-redhat-linux/4.6.2/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.6.2 -L/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../.. /tmp/ccOVzgTu.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/4.6.2/crtend.o crtn.o
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
collect2: ld returned 1 exit status

Comment 11 Jakub Jelinek 2011-12-07 07:56:58 UTC
This is really very weird.  Can you please run
strace -s 1024 -v -o /tmp/gcc.strace /usr/bin/gcc -v tst.c

Comment 12 George R. Goffe 2011-12-08 03:47:52 UTC
Created attachment 542351 [details]
output of requested strace command compiling tst.c

Jakub,

Here you go. Your help is REALLY appreciated.

THANKS!

George...

Here's the stdout from this command:

clipper bash-4.2 ~# strace -s1024 -v -o gcc.strace /usr/bin/gcc -v tst.c
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.6.2/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 --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.6.2 20111027 (Red Hat 4.6.2-1) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/4.6.2/cc1 -quiet -v tst.c -quiet -dumpbase tst.c -mtune=generic -march=x86-64 -auxbase tst -version -o /tmp/cc7Ak7e2.s
GNU C (GCC) version 4.6.2 20111027 (Red Hat 4.6.2-1) (x86_64-redhat-linux)
        compiled by GNU C version 4.6.2 20111027 (Red Hat 4.6.2-1), GMP version 4.3.2, MPFR version 3.0.0, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.6.2/include-fixed"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-redhat-linux/4.6.2/include
 /usr/local/include
 /usr/include
End of search list.
GNU C (GCC) version 4.6.2 20111027 (Red Hat 4.6.2-1) (x86_64-redhat-linux)
        compiled by GNU C version 4.6.2 20111027 (Red Hat 4.6.2-1), GMP version 4.3.2, MPFR version 3.0.0, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: d0509cacf8e2dc8d8d001fecf2ae324f
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
 as --64 -o /tmp/ccD0cxNy.o /tmp/cc7Ak7e2.s
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/4.6.2/:/usr/libexec/gcc/x86_64-redhat-linux/4.6.2/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.6.2/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/4.6.2/:/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/4.6.2/collect2 --build-id --no-add-needed --eh-frame-hdr -m elf_x86_64 --hash-style=gnu -dynamic-linker /lib64/ld-linux-x86-64.so.2 crt1.o crti.o /usr/lib/gcc/x86_64-redhat-linux/4.6.2/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.6.2 -L/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../.. /tmp/ccD0cxNy.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/4.6.2/crtend.o crtn.o
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
collect2: ld returned 1 exit status

Comment 13 Ian Collier 2011-12-08 11:46:45 UTC
It seems to me the problem here is the non-existence of "/usr/lib/../lib64".  So:

- does /usr/lib exist?
- Is it a symlink to somewhere else?
- does /usr/lib/.. exist?
- if so, what does (cd /usr/lib/..; /bin/pwd) say?

(Supplementary question for gcc developers: why so much use of ".." and wouldn't it be better to name the paths properly?)

imc

Comment 14 George R. Goffe 2011-12-08 22:01:51 UTC
Ian,

As far as I know both /usr/lib and /usr/lib64 exist... /usr/lib might be a link though. I'll have to check to be sure. Currently this system is down for other reasons. If /usr/lib IS a link, it would have been copied elsewhere and then this command used to make the link. "ln -s /otherplace/lib ."

I am puzzled about links though and and how they work. I have always thought that a link was like a pointer that would be "automagically" followed by code looking for files or data... BUT if you cd into a link then cd .. You end up in a potentially different filesystem. Could this be the problem? If GCC is trying to look at /usr/lib/../lib64 but /usr/lib is a link they would certainly not find /home/lib64!

I'll check and post the results asap.

THANKS Ian.

George...

Comment 15 Jakub Jelinek 2011-12-08 22:16:30 UTC
If /usr/lib is a symlink somewhere (why?), and /usr/lib64 is not or is a symlink to somewhere else, you need to ensure ../lib64 from /usr/lib will get you to /usr/lib64.
So,
/usr/lib -> /foo/bar/lib
/usr/lib64 -> /foo/bar/lib64
is fine, but
/usr/lib -> /foo/baz/lib
/usr/lib64 -> /foo/foo/lib64
is fine only if there is
/foo/baz/lib64 -> /foo/foo/lib64
link and similarly, if /usr/lib64 is not a symlink and
/usr/lib -> /foo/baz/lib
you need
/foo/baz/lib64 -> /usr/lib64
No matter what, this is an admin error, not a gcc bug.

Comment 16 George R. Goffe 2011-12-08 23:06:43 UTC
Jakub,

I don't completely agree with you.

How am I or anyone else supposed to know what assumptions people write their code on?

It does look like gcc "assumed" that /usr/lib/../lib64 was valid. In my case it is NOT... So, who's in error?

Regards,

George...


Note You need to log in before you can comment on or make changes to this bug.