Bug 758528
Summary: | gcc can not compile a program | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | George R. Goffe <grgoffe> | ||||
Component: | gcc | Assignee: | Jakub Jelinek <jakub> | ||||
Status: | CLOSED WORKSFORME | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
Severity: | high | Docs Contact: | |||||
Priority: | unspecified | ||||||
Version: | 16 | CC: | imc, jakub | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | x86_64 | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2011-11-30 07:54:05 UTC | Type: | --- | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
George R. Goffe
2011-11-30 00:32:37 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... 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. 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. 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... 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... 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. 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 Ian, I also tried installing glibc-devel.i686 but got complaints about architecture being x86 vs x86_64. George... 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/ 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 This is really very weird. Can you please run strace -s 1024 -v -o /tmp/gcc.strace /usr/bin/gcc -v tst.c 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 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 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... 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. 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... |