Hi,

while emerging nano after the "--enable-overwrite" change for ncurses, I
had another very strange problem:

Even if "curses.h" was available in EPREFIX/usr/include, gcc
used /usr/include/curses.h (the system-one, without eprefix).

Playing with "gcc -v", I saw that the fixed system headers were always
included _before_ the EPREFIX/usr/include, even if "-I
EPREFIX/usr/include" was on the commandline (through CPPFLAGS from
profile.bashrc).

As a result, I filed a gcc bug for that:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29831

But after reading bug-summary, provided that EPREFIX is not a symlink
(mine was :-( ), you'd say: Hey, our gcc is neither moved nor symlinked!

Well, that's true, but gcc "thinks" it is moved, because we ./configure
it with "--bindir=/the/eprefix//usr/i386-sun-solaris2.10/gcc-bin/4.1.1".

The problem is the double slash in "eprefix//usr", which triggers that
bug. What happens here is: gcc uses the path of its argv[0] to detect
whether it is moved or not. And if the builtin "--bindir" is different
than physical dirname(argv[0]), gcc calculates relative pathnames for
its own include- and lib-dirs, passing an "-iprefix" argument to "cc1",
which causes "cc1" to change the include path order.

Try it, and look at the include-path warnings from "cc1" - it's
unbeleavable!

Anyway, attached [toolchain-doubleslash.patch] avoids triggering this
bug if EPREFIX does not contain symlinks.

Found similar double slashes in toolchain-binutils.eclass.
Though I have not encountered a problem, I'd rather have them removed
[toolchain-binutils.patch]

Btw, [toolchain-local-prefix] passes correct local prefix to
"--with-local-prefix", as $EPREFIX is the wrong one (we don't have
$EPREFIX/include, and $EPREFIX/lib is special).

/haubi/
-- 
Michael Haubenwallner                    SALOMON Automation GmbH
Forschung & Entwicklung                  A-8114 Friesach bei Graz
mailto:[EMAIL PROTECTED]  http://www.salomon.at
No HTML/MIME please, see http://expita.com/nomime.html
Index: eclass/toolchain.eclass
===================================================================
--- eclass/toolchain.eclass	(revision 2334)
+++ eclass/toolchain.eclass	(working copy)
@@ -1210,13 +1210,13 @@
 
 	# Set configuration based on path variables
 	confgcc="${confgcc} \
-		--prefix=${EPREFIX}/${PREFIX} \
-		--bindir=${EPREFIX}/${BINPATH} \
-		--includedir=${EPREFIX}/${INCLUDEPATH} \
-		--datadir=${EPREFIX}/${DATAPATH} \
-		--mandir=${EPREFIX}/${DATAPATH}/man \
-		--infodir=${EPREFIX}/${DATAPATH}/info \
-		--with-gxx-include-dir=${EPREFIX}/${STDCXX_INCDIR}"
+		--prefix=${EPREFIX}${PREFIX} \
+		--bindir=${EPREFIX}${BINPATH} \
+		--includedir=${EPREFIX}${INCLUDEPATH} \
+		--datadir=${EPREFIX}${DATAPATH} \
+		--mandir=${EPREFIX}${DATAPATH}/man \
+		--infodir=${EPREFIX}${DATAPATH}/info \
+		--with-gxx-include-dir=${EPREFIX}${STDCXX_INCDIR}"
 
 	# All our cross-compile logic goes here !  woo !
 	confgcc="${confgcc} --host=${CHOST}"
Index: eclass/toolchain-binutils.eclass
===================================================================
--- eclass/toolchain-binutils.eclass	(revision 2334)
+++ eclass/toolchain-binutils.eclass	(working copy)
@@ -182,13 +182,13 @@
 	myconf="--prefix=${EPREFIX}/usr \
 		--host=${CHOST} \
 		--target=${CTARGET} \
-		--datadir=${EPREFIX}/${DATAPATH} \
-		--infodir=${EPREFIX}/${DATAPATH}/info \
-		--mandir=${EPREFIX}/${DATAPATH}/man \
-		--bindir=${EPREFIX}/${BINPATH} \
-		--libdir=${EPREFIX}/${LIBPATH} \
-		--libexecdir=${EPREFIX}/${LIBPATH} \
-		--includedir=${EPREFIX}/${INCPATH} \
+		--datadir=${EPREFIX}${DATAPATH} \
+		--infodir=${EPREFIX}${DATAPATH}/info \
+		--mandir=${EPREFIX}${DATAPATH}/man \
+		--bindir=${EPREFIX}${BINPATH} \
+		--libdir=${EPREFIX}${LIBPATH} \
+		--libexecdir=${EPREFIX}${LIBPATH} \
+		--includedir=${EPREFIX}${INCPATH} \
 		--enable-64-bit-bfd \
 		--enable-shared \
 		--disable-werror \
Index: eclass/toolchain.eclass
===================================================================
--- eclass/toolchain.eclass	(revision 2334)
+++ eclass/toolchain.eclass	(working copy)
@@ -1292,7 +1292,7 @@
 		fi
 
 		if [[ ${EPREFIX%/} != "" ]] ; then
-			confgcc="${confgcc} --with-local-prefix=${EPREFIX}"
+			confgcc="${confgcc} --with-local-prefix=${EPREFIX}/usr"
 		fi
 	fi
 	# __cxa_atexit is "essential for fully standards-compliant handling of

Reply via email to