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] |
When building gcc-3.3/glibc-2.3.2 cross toolchains, you have to do a bootstrap install of glibc headers, then build a bootstrap compiler, then build the real glibc, then build the real gcc.
That first step (a bootstrap install of glibc headers) is new as of gcc-3.3, and it's not quite clear yet what the best way to approach it is (or why it's needed, or if there's a way to avoid it totally, hope hope). I've been doing essentially
CC=gcc \ ${GLIBC_DIR}/configure --host=$TARGET --prefix=/usr \ --without-cvs --disable-sanity-checks --with-headers=${PREFIX}/${TARGET}/include if grep -q GLIBC_2.3 ${GLIBC_DIR}/ChangeLog; then make sysdeps/gnu/errlist.c mkdir -p stdio-common touch stdio-common/errlist-compat.c fi make cross-compiling=yes install_root=${PREFIX}/${TARGET} prefix="" install-headers mkdir -p ${PREFIX}/${TARGET}/include/gnu touch ${PREFIX}/${TARGET}/include/gnu/stubs.h cp ${GLIBC_DIR}/include/features.h ${PREFIX}/${TARGET}/include/features.h
There are five kludges there: 1. CC=gcc Unless you do this, configure tries to use $TARGET-gcc or something like that, which fails miserably, since you haven't built that yet. 2. if glibc_2.3 ... This hackery prevents glibc-2.3.x from generating errlist-compat.c, which would fail because it passes real target options to $(CC), which would fail because we haven't built a cc for the target yet. 3. cross-compiling=yes Can't recall why this is needed, but something nasty happens if you leave it out. 4. --disable-sanity-checks I guess building a cross-compiler is a bit on the insane side... 5. Manual install of stubs.h and features.h. Bleah.
Well, that wasn't complicated enough for the hppa guys, so they added another hoop to jump through. The above fails for hppa with checking for assembler line separator... *** You need a newer assembler to compile glibc This was discussed briefly at http://lists.parisc-linux.org/pipermail/parisc-linux/2001-February/011771.html and http://lists.parisc-linux.org/pipermail/parisc-linux/2001-February/011784.html without real resolution. It turns out there's a cheezy workaround; just pass --enable-hacker-mode to the bootstrap glibc configure. This disables the particular sanity check causing the problem (which, oddly, wasn't disabled by --disable-sanity-checks). It's reasonable for glibc to require this for the moment, since glibc doesn't officially support hppa yet, but it'd be nice if it wasn't needed someday.
I'm looking forward to the day when building a cross toolchain isn't such a Rube Goldberg process. - Dan
For completeness, here's the actual script fragment I am trying now to conditionally build and install bootstrap glibc headers. This should be up at http://kegel.com/crosstool tomorrow sometime.
if grep -q gcc-3 ${GCC_DIR}/ChangeLog && test '!' -f ${PREFIX}/${TARGET}/include/features.h; then mkdir -p build-glibc-headers; cd build-glibc-headers
if test '!' -f Makefile; then # The following three things have to be done to build glibc-2.3.x, but they don't hurt older versions. # 1. override CC to keep glibc's configure from using $TARGET-gcc. # 2. disable linuxthreads, which needs a real cross-compiler to generate tcb-offsets.h properly # 3. build with gcc 3.2 or later # Compare these options with the ones used when building glibc for real below - they're different. # As of glibc-2.3.2, to get this step to work for hppa-linux, you need --enable-hacker-mode # so when configure checks to make sure gcc has access to the assembler you just built... # Alternately, we could put ${PREFIX}/${TARGET}/bin on the path. CC=gcc \ ${GLIBC_DIR}/configure --host=$TARGET --prefix=/usr \ --without-cvs --disable-sanity-checks --with-headers=${PREFIX}/${TARGET}/include \ --enable-hacker-mode fi
if grep -q GLIBC_2.3 ${GLIBC_DIR}/ChangeLog; then # glibc-2.3.x passes cross options to $(CC) when generating errlist-compat.c, which fails without a real cross-compiler. # Fortunately, we don't need errlist-compat.c, since we just need .h files, # so work around this by creating a fake errlist-compat.c and satisfying its dependencies. # Another workaround might be to tell configure to not use any cross options to $(CC). # The real fix would be to get install-headers to not generate errlist-compat.c. make sysdeps/gnu/errlist.c mkdir -p stdio-common touch stdio-common/errlist-compat.c fi make cross-compiling=yes install_root=${PREFIX}/${TARGET} prefix="" install-headers
# Two headers -- stubs.h and features.h -- aren't installed by install-headers, # so do them by hand. We can tolerate an empty stubs.h for the moment. # See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html
mkdir -p ${PREFIX}/${TARGET}/include/gnu touch ${PREFIX}/${TARGET}/include/gnu/stubs.h cp ${GLIBC_DIR}/include/features.h ${PREFIX}/${TARGET}/include/features.h
cd .. fi -- Dan Kegel http://www.kegel.com http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045
------ 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] |