Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 14144 - /usr/bin/cpp is an endless loop
Summary: /usr/bin/cpp is an endless loop
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GCC Porting (show other bugs)
Hardware: All Linux
: High major
Assignee: Martin Schlemmer (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-01-18 10:47 UTC by nichao
Modified: 2003-01-21 16:02 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nichao 2003-01-18 10:47:06 UTC
On gcc-3.2.1-r7 and gcc-config-1.3.0, /usr/bin/gcc is an endless loop when being
called. /usr/i686-pc-linux-gnu/gcc-bin/3.2/cpp has exactly the same problem. It
shows when various programs are checking for X during their configure and never
seem to get further and of course, when calling the binary itself.

-rwxr-xr-x    1 root     root        95364 Jan 18 12:24 cpp
-rwxr-xr-x    2 root     root        94948 Jan 18 12:24 g++
Should they actually not be of the same size?

An easy workaround is to symlink /usr/bin/cpp to /usr/bin/g++ respectively
/usr/i686-pc-linux-gnu/gcc-bin/3.2/g++.

The output of "emerge info" is:
root@byteparanoia:/home/metal# emerge info
Portage 2.0.46-r9 (default-x86-1.4, gcc-3.2.1, glibc-2.3.1-r3)
=================================================================
System uname: 2.4.20-ck2 i686 AMD Duron(tm) processor
GENTOO_MIRRORS="http://gentoo.linux.no
http://www.ibiblio.org/pub/Linux/distributions/gentoo"
CONFIG_PROTECT="/etc /var/qmail/control /usr/share/config
/usr/kde/2/share/config /usr/kde/3/share/config /usr/X11R6/lib/X11/xkb"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
PORTDIR="/usr/portage"
DISTDIR="/usr/portage/distfiles"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR_OVERLAY="/usr/portage.local"
USE="x86 oss libg++ libwww ncurses readline tcltk gpm mozilla cdr mmx 3dnow
apache2 -dvd -matrox mysql php perl python ssl nls -apm -arts -avi -berkdb -cups
-encode -gdbm -gif -gtk -imlib -java -jpeg -kde -gnome -mikmod -motif -mpeg
-oggvorbis -opengl -lame pam -pdflib -png -qt -qtmt -quicktime slang -sdl -spell
-svga -truetype -X -xml2 -xmms -xv -tcpd crypt zlib"
COMPILER="gcc3"
CHOST="i686-pc-linux-gnu"
CFLAGS="-s -march=athlon-xp -m3dnow -mmmx -msse -pipe -fforce-addr
-frerun-cse-after-loop -frerun-loop-opt -mfpmath=sse -fPIC -O2
-fomit-frame-pointer -maccumulate-outgoing-args"
CXXFLAGS="-s -march=athlon-xp -m3dnow -mmmx -msse -pipe -fforce-addr
-frerun-cse-after-loop -frerun-loop-opt -mfpmath=sse -fPIC -O2
-fomit-frame-pointer -maccumulate-outgoing-args"
ACCEPT_KEYWORDS="x86 ~x86"
MAKEOPTS="-j2"
AUTOCLEAN="yes"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
FEATURES="sandbox ccache"
Comment 1 Martin Schlemmer (RETIRED) gentoo-dev 2003-01-19 18:34:31 UTC
Try gcc-config-1.3.1 with files/wrapper at version 1.5:

-----------------------------------
$ grep Header files/wrapper.c    
 * $Header: /home/cvsroot/gentoo-x86/sys-devel/gcc-config/files/wrapper.c,v 1.5
2003/01/19 23:39:05 azarah Exp $
azarah@nosferatu gcc-config $ 
Comment 2 nichao 2003-01-20 05:57:06 UTC
No, it doesn't work with gcc-config-1.3.1 either. I noticed it could be
gcc-2.3.1-r7 being the problem.

Upon running the problematic "cpp", "ps -e | grep cpp" shows:
22944 pts/1    00:00:00 cpp
22945 pts/1    00:00:00 cpp0

If I remove my /usr/i686-pc-linux-gnu/gcc-bin/3.2/cpp, the wrapper script says
"Could not run/locate cpp!". If I symlink cpp to g++ in the same dir or copy it,
it works just fine.

I'm wondering why cpp isn't just a symlink to g++ (like cc -> gcc) or a copy
(like g++ to c++) in the real gcc bin dir...
Comment 3 Martin Schlemmer (RETIRED) gentoo-dev 2003-01-20 22:48:58 UTC
ls /usr/i686-pc-linux-gnu/gcc-bin/3.2/ -l

and include output.  By default /usr/i686-pc-linux-gnu/gcc-bin/3.2/cpp should
be a ~97k binary ...

Comment 4 nichao 2003-01-21 06:50:28 UTC
total 612
-rwxr-xr-x    2 root     root        94948 Jan 21 12:58 c++
-rwxr-xr-x    1 root     root        71260 Jan 21 12:58 c++filt
-rwxr-xr-x    1 root     root        95364 Jan 21 12:58 cpp
-rwxr-xr-x    2 root     root        94948 Jan 21 12:58 g++
-rwxr-xr-x    1 root     root        98268 Jan 21 12:58 g77
-rwxr-xr-x    1 root     root        94116 Jan 21 12:58 gcc
-rwxr-xr-x    1 root     root        16312 Jan 21 12:58 gccbug
-rwxr-xr-x    1 root     root        21872 Jan 21 12:58 gcov
lrwxrwxrwx    1 root     root            3 Jan 21 12:58 i686-pc-linux-gnu-c++ -> g++
lrwxrwxrwx    1 root     root            3 Jan 21 12:58 i686-pc-linux-gnu-g++ -> g++
lrwxrwxrwx    1 root     root            3 Jan 21 12:58 i686-pc-linux-gnu-g77 -> g77
lrwxrwxrwx    1 root     root            3 Jan 21 12:58 i686-pc-linux-gnu-gcc -> gcc
Comment 5 Martin Schlemmer (RETIRED) gentoo-dev 2003-01-21 08:49:09 UTC
Is the /usr/bin/cpp giving problems ?  Please 'ls -l /usr/bin/cpp'.  Also,
do a short strace of running /usr/bin/cpp.  Sorry for this confusion.
Comment 6 nichao 2003-01-21 09:22:23 UTC
-rwxr-xr-x    1 root     root         5560 Jan 21 13:46 /usr/bin/cpp
-rwxr-xr-x    1 root     root         5560 Jan 21 13:46 /lib/cpp

I assume it's not the gcc-config wrapper script. I should've made that clear 
before.

A strace on /usr/i686-pc-linux-gnu/gcc-bin/3.2/cpp gives:

execve("./cpp", ["./cpp"], [/* 38 vars */]) = 0
uname({sys="Linux", node="byteparanoia", ...}) = 0
brk(0)                                  = 0x805fe34
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x40000000
open("/etc/ld.so.preload", O_RDONLY)    = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
close(3)                                = 0
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=31667, ...}) = 0
mmap2(NULL, 31667, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40001000
close(3)                                = 0
open("/lib/libc.so.6", O_RDONLY)        = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0 \313\376"..., 1024) = 
1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=1447220, ...}) = 0
mmap2(0x47fd7000, 1229988, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x47fd7000
mprotect(0x480fc000, 29860, PROT_NONE)  = 0
mmap2(0x480fc000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x124) 
= 0x480fc000
mmap2(0x480ff000, 17572, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x480ff000
close(3)                                = 0
munmap(0x40001000, 31667)               = 0
brk(0)                                  = 0x805fe34
brk(0x8060e34)                          = 0x8060e34
brk(0x8061000)                          = 0x8061000
rt_sigaction(SIGINT, {SIG_IGN}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGINT, {0x8053946, [INT], SA_RESTART|0x4000000}, {SIG_IGN}, 8) = 0
rt_sigaction(SIGHUP, {SIG_IGN}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGHUP, {0x8053946, [HUP], SA_RESTART|0x4000000}, {SIG_IGN}, 8) = 0
rt_sigaction(SIGTERM, {SIG_IGN}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGTERM, {0x8053946, [TERM], SA_RESTART|0x4000000}, {SIG_IGN}, 8) 
= 0
rt_sigaction(SIGPIPE, {SIG_IGN}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGPIPE, {0x8053946, [PIPE], SA_RESTART|0x4000000}, {SIG_IGN}, 8) 
= 0
rt_sigaction(SIGCHLD, {SIG_DFL}, {SIG_DFL}, 8) = 0
brk(0x8062000)                          = 0x8062000
brk(0x8063000)                          = 0x8063000
brk(0x8064000)                          = 0x8064000
access("./", X_OK)                      = 0
access("./", X_OK)                      = 0
access("./", X_OK)                      = 0
access("./", X_OK)                      = 0
access("/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/", X_OK) = 0
access("/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/", X_OK) = 0
access("./../../lib/gcc-lib/i686-pc-linux-gnu/3.2.1/specs", R_OK) = -1 ENOENT 
(No such file or directory)
access("./../../lib/gcc-lib/specs", R_OK) = -1 ENOENT (No such file or 
directory)
access("/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/specs", R_OK) = 0
open("/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/specs", O_RDONLY) = 3
stat64("/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/specs", {st_mode=S_IFREG|0644, 
st_size=6841, ...}) = 0
brk(0x8066000)                          = 0x8066000
read(3, "*asm:\n%{v:-V} %{Qy:} %{!Qn:-Qy} "..., 6841) = 6841
close(3)                                = 0
brk(0x8067000)                          = 0x8067000
brk(0x8068000)                          = 0x8068000
brk(0x8069000)                          = 0x8069000
access("/usr/lib/gcc-lib/i686-pc-linux-gnu/specs", R_OK) = -1 ENOENT (No such 
file or directory)
access("./", X_OK)                      = 0
access("/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/", X_OK) = 0
brk(0x806a000)                          = 0x806a000
stat64("./../../lib/gcc-lib/i686-pc-linux-gnu/3.2.1/cpp0", 0xbffff6d0) = -1 
ENOENT (No such file or directory)
stat64("./../../lib/gcc-lib/cpp0", 0xbffff6d0) = -1 ENOENT (No such file or 
directory)
stat64("/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/cpp0", {st_mode=S_IFREG|0755, 
st_size=108668, ...}) = 0
access("/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/cpp0", X_OK) = 0
fork()                                  = 9466
wait4(-1,

That's the end of the output.
Comment 7 Martin Schlemmer (RETIRED) gentoo-dev 2003-01-21 11:32:59 UTC
Err, seems like it.  Lets just quickly get one or two things straight:

1)  If you just run:  cpp

    It will sit there doing nothing (while waiting for data to preprocess ...)

2)  If you do: cpp --help

    You should get:

------------------
 $ cpp --help
Usage: cpp [options] file...
Options:
  -pass-exit-codes         Exit with highest error code from a phase
  --help                   Display this information
  --target-help            Display target specific command line options
  (Use '-v --help' to display command line options of sub-processes)
....
-------------------------------------

It do not display the help, but always just hangs, or do we have a 
misunderstanding ?
Comment 8 nichao 2003-01-21 12:09:22 UTC
Oh, damn, my bad - I was thinking 'cpp' were an acronym for 'c plus plus' :-/
I'm very sorry to have consumed your time for an invalid bug report...

(Changed the resolution to INVALID.)
Comment 9 Martin Schlemmer (RETIRED) gentoo-dev 2003-01-21 16:02:53 UTC
NP :)  Glad we got it figured out!