Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 234076 - 'gcc -m32 -print-file-name=include' reports wrong path
Summary: 'gcc -m32 -print-file-name=include' reports wrong path
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: rawhide
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-03-26 21:31 UTC by Bernie Innocenti
Modified: 2007-11-30 22:12 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-03-27 19:51:24 UTC


Attachments (Terms of Use)
output of gcc -m32 -print-file-name=include (deleted)
2007-03-27 19:38 UTC, Bernie Innocenti
no flags Details
output of strace gcc -print-file-name=include (deleted)
2007-03-27 19:39 UTC, Bernie Innocenti
no flags Details

Description Bernie Innocenti 2007-03-26 21:31:29 UTC
This works fine:
 # gcc -print-file-name=include
 /usr/lib/gcc/x86_64-redhat-linux/4.1.2/include

But with -m32 it prints nonsense:
 # gcc -print-file-name=include -m32
 /lib/../lib/include

gcc-HEAD works:
 # gcc-HEAD -m32 -print-file-name=include
 /usr/local/src/gcc/x86_64-linux-HEAD-install/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/include

Version info:
 # gcc --version
 gcc (GCC) 4.1.2 20070317 (Red Hat 4.1.2-5)

Comment 1 Jakub Jelinek 2007-03-27 15:37:39 UTC
Can't reproduce:
gcc --version; gcc -print-file-name=include; gcc -m32 -print-file-name=include;
gcc -print-file-name=include -m32
gcc (GCC) 4.1.2 20070317 (Red Hat 4.1.2-5)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/include

(nor can I reproduce this with FC6 or RHEL5 gcc).

Comment 2 Bernie Innocenti 2007-03-27 19:33:50 UTC
I'm puzzled... attaching strace output for:

  gcc -print-file-name=include
  gcc -m32 -print-file-name=include


Comment 3 Bernie Innocenti 2007-03-27 19:38:56 UTC
Created attachment 151071 [details]
output of gcc -m32 -print-file-name=include

Comment 4 Bernie Innocenti 2007-03-27 19:39:54 UTC
Created attachment 151073 [details]
output of strace gcc -print-file-name=include

Comment 5 Bernie Innocenti 2007-03-27 19:46:56 UTC
Diffing the two traces, I see gcc is looking for
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/32/include, which doesn't exist.  Then it
tries all kinds of fancy paths and eventually finds that silly result.


Comment 6 Jakub Jelinek 2007-03-27 19:51:24 UTC
You have /lib/../lib/include file or directory, that isn't supposed to exist
and in that case it would soon find what you expect.  The GCC file search
algorithm is quite complicated, but /lib is one of the tool dirs and
../lib is the -m32 on x86_64 multi-os-directory.
Not sure if you have /lib as a symlink or have /include file/directory, in
any case this isn't a gcc bug.

Comment 7 Bernie Innocenti 2007-03-27 19:51:55 UTC
Oh, gosh!

The problem is that I really *had* /lib/include in my system since 1999.
That's why you couldn't reproduce it.

But I'd still consider it a bug: gcc built from svn trunk doesn't fall
in the trap.  Maybe it's RedHat specific, maybe not.

Maybe it has something to do with --prefix=/usr ? I read somewhare that
/usr is special in some packages such as glibc because it also implies /
as a search path.


Comment 8 Jakub Jelinek 2007-03-27 20:02:40 UTC
Yes, --prefix=/usr is special, this is nothing Red Hat specific.

Comment 9 Bernie Innocenti 2007-03-27 20:24:08 UTC
I think we can leave this alone, then.

For the record, the 4.3 search path appears very different:

bender:/# gcc -m32 -print-search-dirs 
install: /usr/lib/gcc/x86_64-redhat-linux/4.1.2/
programs:
=/usr/libexec/gcc/x86_64-redhat-linux/4.1.2/:/usr/libexec/gcc/x86_64-redhat-linux/4.1.2/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.1.2/:/usr/lib/gcc/x86_64-redhat-linux/:/usr/libexec/gcc/x86_64-redhat-linux/4.1.2/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.1.2/:/usr/lib/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../x86_64-redhat-linux/bin/x86_64-redhat-linux/4.1.2/:/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../x86_64-redhat-linux/bin/
libraries:
=/usr/lib/gcc/x86_64-redhat-linux/4.1.2/:/usr/lib/gcc/x86_64-redhat-linux/4.1.2/:/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../x86_64-redhat-linux/lib/x86_64-redhat-linux/4.1.2/:/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../x86_64-redhat-linux/lib/:/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../x86_64-redhat-linux/4.1.2/:/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../:/lib/x86_64-redhat-linux/4.1.2/:/lib/:/usr/lib/x86_64-redhat-linux/4.1.2/:/usr/lib/

bender:# /usr/local/src/gcc/x86_64-linux-HEAD-install/bin/gcc -m32
-print-search-dirs
install:
/usr/local/src/gcc/x86_64-linux-HEAD-install/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/
programs:
=/usr/local/src/gcc/x86_64-linux-HEAD-install/libexec/gcc/x86_64-unknown-linux-gnu/4.3.0/:/usr/local/src/gcc/x86_64-linux-HEAD-install/libexec/gcc/x86_64-unknown-linux-gnu/4.3.0/:/usr/local/src/gcc/x86_64-linux-HEAD-install/libexec/gcc/x86_64-unknown-linux-gnu/:/usr/local/src/gcc/x86_64-linux-HEAD-install/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/:/usr/local/src/gcc/x86_64-linux-HEAD-install/lib/gcc/x86_64-unknown-linux-gnu/:/usr/libexec/gcc/x86_64-unknown-linux-gnu/4.3.0/:/usr/libexec/gcc/x86_64-unknown-linux-gnu/:/usr/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/:/usr/lib/gcc/x86_64-unknown-linux-gnu/:/usr/local/src/gcc/x86_64-linux-HEAD-install/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/../../../../x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu/4.3.0/:/usr/local/src/gcc/x86_64-linux-HEAD-install/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/../../../../x86_64-unknown-linux-gnu/bin/
libraries:
=/usr/local/src/gcc/x86_64-linux-HEAD-install/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/:/usr/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/:/usr/local/src/gcc/x86_64-linux-HEAD-install/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/../../../../x86_64-unknown-linux-gnu/lib/x86_64-unknown-linux-gnu/4.3.0/:/usr/local/src/gcc/x86_64-linux-HEAD-install/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/../../../../x86_64-unknown-linux-gnu/lib/../lib/:/usr/local/src/gcc/x86_64-linux-HEAD-install/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/../../../x86_64-unknown-linux-gnu/4.3.0/:/usr/local/src/gcc/x86_64-linux-HEAD-install/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/../../../../lib/:/lib/x86_64-unknown-linux-gnu/4.3.0/:/lib/../lib/:/usr/lib/x86_64-unknown-linux-gnu/4.3.0/:/usr/lib/../lib/:/usr/local/src/gcc/x86_64-linux-HEAD-install/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/../../../../x86_64-unknown-linux-gnu/lib/:/usr/local/src/gcc/x86_64-linux-HEAD-install/lib/gcc/x86_64-unknown-linux-gnu/4.3.0/../../../:/lib/:/usr/lib/



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