https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81829
--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> --- (In reply to Xi Ruoyao from comment #5) > (In reply to Martin Liška from comment #4) > > (In reply to Xi Ruoyao from comment #3) > > > marxin's patch: > > > > > > http://gcc.gnu.org/ml/gcc-patches/2017-08/msg01116.html > > > > > > But this patch doesn't work while /my_bin/bin contains a symlink. > > > > Can you please describe your set up is more detail? > > cd $BLDDIR > $SRCDIR/configure && make -j$CPUNUM > cd gcc > for i in ar nm ranlib; do ln -sv gcc-$i $i; done > export PATH=$PWD:$PATH > ar > (fork infinite processes) > > Since my BLDDIR is /home/xry111/build/gcc, and /home/xry111/build is linked > to > /mnt/mm1/xry111, remove_prefix failed to remove /home/xry111/build/gcc/gcc > from > the prefixes. If change to > > export PATH=$(realpath $PWD):$PATH > > It would be ok. Huh, so many beasts out there. What can you see with following patch: diff --git a/gcc/gcc-ar.c b/gcc/gcc-ar.c index 1155ba83e35..452ca87d2ce 100644 --- a/gcc/gcc-ar.c +++ b/gcc/gcc-ar.c @@ -199,6 +199,8 @@ main (int ac, char **av) /* If the exe_name points to the wrapper, remove folder of the wrapper from prefix and try search again. */ + fprintf (stderr, "exe_name: %s, wrapper_file: %s\n", exe_name, + wrapper_file); if (strcmp (exe_name, wrapper_file) == 0) { char *exe_folder = wrapper_file; It's probably related to lrealpath that does not follow links. Btw. is your link a mount? I'm tending to remove the whole smartness of gcc-ar that removes the prefix. Martin