public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug driver/102803] New: Bug: -no-canonical-prefixes not working
@ 2021-10-17 16:38 carlosgalvezp at gmail dot com
  2021-10-17 19:53 ` [Bug driver/102803] " pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: carlosgalvezp at gmail dot com @ 2021-10-17 16:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102803

            Bug ID: 102803
           Summary: Bug: -no-canonical-prefixes not working
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: driver
          Assignee: unassigned at gcc dot gnu.org
          Reporter: carlosgalvezp at gmail dot com
  Target Milestone: ---

Hi,

GCC has the option "-no-canonical-prefixes" to avoid calling "realpath" on
default include search paths. This is needed when one wants to use GCC in
Bazel:

https://github.com/bazelbuild/bazel/issues/4605#issuecomment-364174051

Now, GCC as downloaded from here:

http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/pool/main/g/gcc-11/g++-11_11.1.0-1ubuntu1~18.04.1_amd64.deb

does *not* honor the -no-canonical-prefixes flag.

If one unpacks the above .deb file into e.g. /path/to/gcc, and runs gcc from
there like ./usr/bin/gcc-11 with the -no-canonical-prefixes option, then the
default search paths resolve all symlinks and "../", leading to a realpath:

/path/to/gcc# ./usr/bin/gcc-11 -no-canonical-prefixes
-fno-canonical-system-headers -xc++ -E -v -

ignoring nonexistent directory
"./usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/x86_64-linux-gnu/c++/11/x86_64-linux-gnu"
ignoring nonexistent directory
"./usr/bin/../lib/gcc/x86_64-linux-gnu/11/include"
ignoring nonexistent directory
"./usr/bin/../lib/gcc/x86_64-linux-gnu/11/include-fixed"
ignoring nonexistent directory
"./usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include"
ignoring duplicate directory "/path/to/gcc/usr/include/c++/11"
ignoring duplicate directory "/path/to/gcc/usr/include/x86_64-linux-gnu/c++/11"
ignoring duplicate directory "/path/to/gcc/usr/include/x86_64-linux-gnu/c++/11"
ignoring duplicate directory "/path/to/gcc/usr/include/c++/11/backward"
ignoring nonexistent directory
"./usr/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/11/include"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"./usr/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/11/include-fixed"
ignoring nonexistent directory
"./usr/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include"
ignoring nonexistent directory "/usr/include/x86_64-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
 /path/to/gcc/usr/include/c++/11
 /path/to/gcc/usr/include/x86_64-linux-gnu/c++/11
 /path/to/gcc/usr/include/c++/11/backward
 /usr/local/include
 /usr/include

I.e. the default search paths are:

 /path/to/gcc/usr/include/c++/11
 /path/to/gcc/usr/include/x86_64-linux-gnu/c++/11
 /path/to/gcc/usr/include/c++/11/backward

Instead of:

./usr/bin/../include/c++/11

This happens also on GCC 7.

Why is this happening? Can it be solved? This prevents GCC from being used in
Bazel in a sandboxed way (i.e. without having GCC installed in the system).

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-10-29  7:08 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-17 16:38 [Bug driver/102803] New: Bug: -no-canonical-prefixes not working carlosgalvezp at gmail dot com
2021-10-17 19:53 ` [Bug driver/102803] " pinskia at gcc dot gnu.org
2021-10-17 22:15 ` carlosgalvezp at gmail dot com
2021-10-18  6:50 ` rguenth at gcc dot gnu.org
2021-10-18  7:18 ` carlosgalvezp at gmail dot com
2021-10-18  7:46 ` pinskia at gcc dot gnu.org
2021-10-18  8:04 ` carlosgalvezp at gmail dot com
2021-10-18  8:09 ` pinskia at gcc dot gnu.org
2021-10-18  8:53 ` rguenth at gcc dot gnu.org
2021-10-29  7:08 ` carlosgalvezp at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).