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

            Bug ID: 116788
           Summary: Relative sysroot and -save-temps don't play nicely
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: driver
          Assignee: unassigned at gcc dot gnu.org
          Reporter: w.steinwender at freenet dot de
  Target Milestone: ---

GCC is configured with:
--prefix=/root/crossdev --sysroot=/root/crossdev/sysroot

--sysroot:
If the specified directory is a subdirectory of ${exec_prefix}, then it will be
found relative to the GCC binaries if the installation tree is moved.

Normal compilation with moved installation tree works. gcc --print-sysroot for
example:
/home/foo/crossdev/bin/../sysroot

But compilation with -save-temps on a system with /root directory mode 700
fails:
cc1: error: /root/crossdev/sysroot/usr/local/include: Permission denied
cc1: error: /root/crossdev/sysroot/usr/include: Permission denied

It seems that with -save-temps files are searched outside sysroot.

More information: cc1 -v 
cc1: error: /root/crossdev/lib/gcc/arm-none-linux-gnueabi/14.2.0/include:
Permission denied
cc1: error: /root/crossdev/sysroot/usr/local/include: Permission denied
cc1: error: /root/crossdev/lib/gcc/arm-none-linux-gnueabi/14.2.0/include-fixed:
Permission denied
cc1: error: /root/crossdev/arm-none-linux-gnueabi/include: Permission denied
cc1: error: /root/crossdev/sysroot/usr/include: Permission denied

Is it possible that with -save-temps relative sysroot is not communicated to
cc1?
But explicitly setting --sysroot for compilation doesn't help either.

This is somehow similar to:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54560

GCC configuration:
Configured with: ../gcc/configure --target=arm-none-linux-gnueabi
--prefix=/root/crossdev --with-sysroot=/root/crossdev/sysroot
--with-build-sysroot=/root/crossdev/sysroot --enable-threads
--enable-languages=c,c++ --enable-__cxa_atexit --disable-libstdcxx-pch
--disable-lto --disable-nls --with-arch=armv5te --with-float=soft
--enable-shared --disable-multilib

Same problem with gcc 13.2.

Reply via email to