This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


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

Bill's script and glibc-2.2.2. Updated patch.


Looks like Bill's Wiki page gets a few things right that
his script doesn't when it comes to building linux
toolchains (as Bill freely admits, the script's linux
targets are a bit off).

http://billgatliff.com/twiki/bin/view/Crossgcc/BuildGlibC
correctly documents how to fix libc.so.
Bill's script misses this, but Karim's gets it.

Bill's script uses the following line to make/install glibc:
make all install info install-info 2>&1 | tee make.log
but his wiki page uses
make install_root=${PREFIX}/${TARGET} prefix="" install

One problem with the script's line is that it tries to build info,
which fails without the patch
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/manual/stdio.texi.diff?r1=1.126&r2=1.127&cvsroot=glibc

A second problem shared by both is that they fail to install
<gnu/stubs.h>, which causes the 2nd compile of gcc to fail.
This can be fixed by adding the phony target install-other,
or more directly by adding the real target  ${PREFIX}/${TARGET}/include/gnu/stubs.h
(or whatever the path is).

I'm attaching a patch that illustrates the above and corrects
some thinkos I made in my earlier patch.  I *still*
haven't gotten it to run all the way through with target powerpc-linux,
but I'm getting close...
- Dan

--
Dan Kegel
http://www.kegel.com
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045
--- build-crossgcc.sh.old	Mon May 19 17:54:52 2003
+++ build-crossgcc.sh	Mon May 19 19:30:11 2003
@@ -1,4 +1,5 @@
 #!/bin/bash
+set -ex
 #
 # build-crossgcc.sh
 #
@@ -126,6 +127,10 @@
 
 fi
 
+# Make prefix and tardir absolute
+PREFIX=`cd $PREFIX; pwd`
+TARDIR=`cd $TARDIR; pwd`
+
 # test that we have write permissions to the install dir
 mkdir -p ${PREFIX}/${TARGET}
 touch ${PREFIX}/${TARGET}/test-if-write
@@ -213,6 +218,7 @@
 	mkdir -p ${PREFIX}/${TARGET}/include
 	cp -r include/linux ${PREFIX}/${TARGET}/include/linux
 	cp -r include/asm-${ARCH} ${PREFIX}/${TARGET}/include/asm
+	cp -r include/asm-generic ${PREFIX}/${TARGET}/include/asm-generic
 	cd ..
 
 	;;
@@ -238,6 +244,7 @@
 	mkdir -p ${PREFIX}/${TARGET}/include
 	cp -r include/linux ${PREFIX}/${TARGET}/include
 	cp -r include/asm-${ARCH} ${PREFIX}/${TARGET}/include/asm
+	cp -r include/asm-generic ${PREFIX}/${TARGET}/include/asm-generic
 	cd ..
 
 	;;
@@ -283,7 +290,7 @@
 
     # for these targets, gcc's libgcc2 assumes the presence of some
     # header files that we won't have until after glibc or newlib are
-    # built.  When we throw in --without-headers --without-newlib, the
+    # built.  When we throw in --without-headers --with-newlib, the
     # configure process throws in a:
     #
     # TARGET_LIBGCC2_CFLAGS=-Dinhibit_libc
@@ -359,15 +366,28 @@
 
     gunzip -c ${TARDIR}/${GLIBCDISTO}.tar.gz | tar $TARFLAGS - 
     cd ${GLIBCDISTO}
+
+    # Fix build problem in glibc-2.2.2; patch not needed as of glibc-2.2.5
+    #patch -p1 < ${TARDIR}/glibc-manual-stdin.texi-1.127.patch || /bin/true
+
     gunzip -c ${TARDIR}/${GLIBCTHREADSDISTO}.tar.gz | tar $TARFLAGS - 
     cd ..
     mkdir build-glibc; cd build-glibc
 
+    # Configure with --prefix the way we want it on the target...
     CC=${TARGET}-gcc AR=${TARGET}-ar RANLIB=${TARGET}-ranlib \
-	../${GLIBCDISTO}/configure --host=$TARGET --prefix=${PREFIX}/${TARGET} \
+	../${GLIBCDISTO}/configure --host=$TARGET --prefix=/usr \
 	--enable-add-ons=linuxthreads --with-headers=${PREFIX}/${TARGET}/include \
-	2>&1 | tee configure.log ;;
+	2>&1 | tee configure.log 
 
+    # but override prefix when installing so it goes to the right place on the host.
+    make all install ${PREFIX}/${TARGET}/usr/include/gnu/stubs.h install_root=${PREFIX}/${TARGET} 2>&1 | tee make.log
+
+    # Remove absolute paths from libc.so.
+    # FIXME: ought to use sed instead of just assuming we know what's in libc.so
+    mv ${PREFIX}/${TARGET}/usr/lib/libc.so ${PREFIX}/${TARGET}/usr/lib/libc.so.orig
+    echo "GROUP ( libc.so.6 libc_nonshared.a )" > ${PREFIX}/${TARGET}/usr/lib/libc.so
+    ;;
 
     # these targets use newlib
     arm-elf | h8300-coff | h8300-hitachi-hms | m68k-coff | m68k-elf | powerpc-eabi | sh-elf | sh-hms)
@@ -380,14 +400,14 @@
     ../${NEWLIBDISTO}/configure --target=$TARGET --prefix=$PREFIX \
 	2>&1 | tee configure.log
 
+    make all install info install-info 2>&1 | tee make.log
 esac
 
 
-make all install info install-info 2>&1 | tee make.log
 cd ..
 
 # test to see if this step passed
-if [ ! -f ${PREFIX}/${TARGET}/lib/libc.a ]; then
+if [ ! -f ${PREFIX}/${TARGET}/usr/lib/libc.a ]; then
     echo Building libc failed && exit 1
 fi
 
@@ -404,6 +424,7 @@
 mkdir build-gcc; cd build-gcc
 ../${GCCDISTO}/configure --target=$TARGET --prefix=$PREFIX \
     --enable-languages=c,c++ --with-local-prefix=${PREFIX}/${TARGET} \
+    --with-headers=${PREFIX}/${TARGET}/usr/include \
     2>&1 | tee configure.log
 
 

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com

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