This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bugs in sysroot patches resulting in $(local_include)/include always searched, ../-expansion broken


On Thu, Feb 20, 2003 at 01:49:39PM -0500, Daniel Jacobowitz wrote:
> On Thu, Feb 20, 2003 at 05:24:43PM +0100, Hans-Peter Nilsson wrote:
> > > Date: Thu, 20 Feb 2003 10:16:01 -0500
> > > From: Daniel Jacobowitz <drow at mvista dot com>
> > > On Thu, Feb 20, 2003 at 04:09:41PM +0100, Hans-Peter Nilsson wrote:
> > > > Clues?  Patches?  Request for better report?  I may eventually
> > > > find the bug, but clues to speed up the process are welcome and
> > > > my testing suffers in the meantime.
> > > 
> > > Better report.  Could you give me the output of gcc -v for 3.3-branch
> 
> I think I see the problem.
> 
> > Compiling fixunsdfsi is where it fails, so I'll show that.
> > First for 3.3 (beware, cutnpaste, with most trailing \\n edited
> > out I hope):
> > 
> > Command:
> > /mnt/misca2/builds/gcc33/bug2/gcc/xgcc -B/mnt/misca2/builds/gcc33/bug2/gcc/ -B/home/hp/work/axis/build/gcc3testprefix/cris-linux/bin/ -B/home/hp/work/axis/build/gcc3testprefix/cris-linux/lib/ -isystem /home/hp/work/axis/build/gcc3testprefix/cris-linux/include -O2  -DIN_GCC -DCROSS_COMPILE   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -isystem ./include   -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -I. -I. -I/home/hp/cvs_areas/combined/cvs_write33/gcc -I/home/hp/cvs_areas/combined/cvs_write33/gcc/. -I/home/hp/cvs_areas/combined/cvs_write33/gcc/config -I/home/hp/cvs_areas/combined/cvs_write33/gcc/../include  -DL_fixunsdfsi -c /home/hp/cvs_areas/combined/cvs_write33/gcc/libgcc2.c -o libgcc/./_fixunsdfsi.o -v
> > 
> > Output:
> 
> >  /home/hp/work/axis/build/gcc3testprefix/lib/gcc-lib/cris-linux/3.3/../../../../cris-linux/sys-include
> 
> Look at the command and the resulting search directory.  The directory
> is relative to $prefix, that is, the final installation directory.  But
> the compiler isn't there now.  One part of my changes, which I
> consider a strict correctness change, is that if we would search a
> relocated copy of a directory (based on where the gcc binary is) then
> we should not search the unrelocated copy (based on $prefix, which
> doesn't apply, because we aren't there right now).
> 
> Now we do:
> 
> > Command: /mnt/miscb3/builds2/bug2/gcc/xgcc
> > -B/mnt/miscb3/builds2/bug2/gcc/
> > -B/home/hp/work/axis/build/gcc3testprefix/cris-linux/bin/
> > -B/home/hp/work/axis/build/gcc3testprefix/cris-linux/lib/ -isystem
> > /home/hp/work/axis/build/gcc3testprefix/cris-linux/include -O2
> > -DIN_GCC -DCROSS_COMPILE -W -Wall -Wwrite-strings
> > -Wstrict-prototypes -Wmissing-prototypes -isystem ./include -fPIC
> > -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED
> > -Dinhibit_libc -I. -I. -I/home/hp/cvs_areas/combined/cvs_write/gcc
> > -I/home/hp/cvs_areas/combined/cvs_write/gcc/.
> > -I/home/hp/cvs_areas/combined/cvs_write/gcc/config
> > -I/home/hp/cvs_areas/combined/cvs_write/gcc/../include
> > -DL_fixunsdfsi -c
> > /home/hp/cvs_areas/combined/cvs_write/gcc/libgcc2.c -o
> > libgcc/./_fixunsdfsi.o -v
> > 
> > Output, in which you see the failure mode:
> > ignoring nonexistent directory "/mnt/miscb3/builds2/bug2/lib/gcc-lib/cris-linux/3.4/include"
> > ignoring nonexistent directory "/mnt/miscb3/builds2/bug2/lib/gcc-lib/cris-linux/3.4/../../../../cris-linux/sys-include"
> 
> We see that the binary is in the build dir, so we're searching in the
> build dir for $prefix/cris-linux/sys-include.

I was looking this over today, because I wanted to fix it before I
checked in a fix to the other problem.  I couldn't reproduce it at
first.  You get three -B options and one -isystem at the beginning of
your command line building libgcc; but when I configure in the same
way, I get:

 -B./ -B/big/fsf/local/cross-test/prefix/mipsel-linux/bin/
 -isystem /big/fsf/local/cross-test/prefix/mipsel-linux/include
 -isystem /big/fsf/local/cross-test/prefix/mipsel-linux/sys-include

That's from GCC_FOR_TARGET.  It turns out that I was impatient, so I
just ran make in the gcc directory; but GCC_FOR_TARGET is _different_
in the GCC makefile from in the toplevel makefile.  I bet that if you
(cd gcc; make) after the error above, it'll build OK.  I think just
fixing the toplevel GCC_FOR_TARGET is in order; here's a minimalist
solution.

DJ or Alex, is this patch OK?

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

./
2003-03-03  Daniel Jacobowitz  <drow at mvista dot com>

	* configure.in: Include $(build_tooldir)/sys-include in
	FLAGS_FOR_TARGET.
	* configure: Regenerated.

gcc/
2003-03-03  Daniel Jacobowitz  <drow at mvista dot com>

	* configure.in: Don't always define TARGET_SYSTEM_ROOT.
	* configure: Regenerated.
	* gcc.c: Check whether TARGET_SYSTEM_ROOT is defined.

Index: configure
===================================================================
RCS file: /big/fsf/rsync/gcc-cvs/gcc/configure,v
retrieving revision 1.76
diff -u -p -r1.76 configure
--- configure	16 Feb 2003 01:09:27 -0000	1.76
+++ configure	3 Mar 2003 16:53:36 -0000
@@ -2594,7 +2594,7 @@ esac
 # being built; programs in there won't even run.
 if test "${build}" = "${host}" && test -d ${srcdir}/gcc; then
   # Search for pre-installed headers if nothing else fits.
-  FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include'
+  FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include'
 fi
 
 if test "x${use_gnu_ld}" = x &&
Index: configure.in
===================================================================
RCS file: /big/fsf/rsync/gcc-cvs/gcc/configure.in,v
retrieving revision 1.220
diff -u -p -r1.220 configure.in
--- configure.in	16 Feb 2003 01:09:27 -0000	1.220
+++ configure.in	3 Mar 2003 16:52:52 -0000
@@ -1936,7 +1936,7 @@ esac
 # being built; programs in there won't even run.
 if test "${build}" = "${host}" && test -d ${srcdir}/gcc; then
   # Search for pre-installed headers if nothing else fits.
-  FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include'
+  FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include'
 fi
 
 if test "x${use_gnu_ld}" = x &&
Index: gcc/configure
===================================================================
RCS file: /big/fsf/rsync/gcc-cvs/gcc/gcc/configure,v
retrieving revision 1.658
diff -u -p -r1.658 configure
--- gcc/configure	14 Feb 2003 17:28:54 -0000	1.658
+++ gcc/configure	3 Mar 2003 16:12:16 -0000
@@ -2299,7 +2299,7 @@ if test "${with_sysroot+set}" = set; the
 else
   
  TARGET_SYSTEM_ROOT=
- TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=0'
+ TARGET_SYSTEM_ROOT_DEFINE=
  CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
 
 fi
Index: gcc/configure.in
===================================================================
RCS file: /big/fsf/rsync/gcc-cvs/gcc/gcc/configure.in,v
retrieving revision 1.643
diff -u -p -r1.643 configure.in
--- gcc/configure.in	14 Feb 2003 17:28:55 -0000	1.643
+++ gcc/configure.in	3 Mar 2003 16:12:16 -0000
@@ -514,7 +514,7 @@ AC_ARG_WITH(sysroot,
  esac
 ], [
  TARGET_SYSTEM_ROOT=
- TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=0'
+ TARGET_SYSTEM_ROOT_DEFINE=
  CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include'
 ])
 AC_SUBST(TARGET_SYSTEM_ROOT)
Index: gcc/gcc.c
===================================================================
RCS file: /big/fsf/rsync/gcc-cvs/gcc/gcc/gcc.c,v
retrieving revision 1.361
diff -u -p -r1.361 gcc.c
--- gcc/gcc.c	13 Feb 2003 17:23:56 -0000	1.361
+++ gcc/gcc.c	3 Mar 2003 16:12:16 -0000
@@ -202,7 +202,11 @@ static int report_times;
 /* Nonzero means place this string before uses of /, so that include
    and library files can be found in an alternate location.  */
 
+#ifdef TARGET_SYSTEM_ROOT
 static const char *target_system_root = TARGET_SYSTEM_ROOT;
+#else
+static const char *target_system_root = 0;
+#endif
 
 /* Nonzero means pass the updated target_system_root to the compiler.  */
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]