* RE: GCC 2.95.3 cross compiler build error looking for stubs.h
@ 2004-02-13 0:46 Lew Newby Jr.
0 siblings, 0 replies; 2+ messages in thread
From: Lew Newby Jr. @ 2004-02-13 0:46 UTC (permalink / raw)
To: Bob Beck, gcc-help
[-- Attachment #1: Type: text/plain, Size: 3245 bytes --]
I just went through this process for ia32 to ia64 cross.
I will attach a script that will possibly help you out. I found it on
the net and have heavily modified it. I am currently doing work with
gcc-3.2.3 but it has worked in the past for 2.95.
Also take a look at the CrossGCC FAQ
http://www.objsw.com/CrossGCC/FAQ.html
Lew Newby Jr.
Sr. Linux Architect
SACC Inc.
Office: (740)454-8778
Fax: (740)454-8778
Mobile: (740)819-1615
lnewby@cadence.com or gideon@neei.com
-----Original Message-----
From: Bob Beck [mailto:beck@assurtech.com]
Sent: Wednesday, February 11, 2004 11:40 PM
To: gcc-help@gcc.gnu.org
Subject: GCC 2.95.3 cross compiler build error looking for stubs.h
I am building GCC as a cross compiler for the PowerPC.
The instructions I am following are from O'Reilly's "Building Embedded
Systems" book. At a high level I have done the following.
o Configure the kernel (2.4.18) using make menuconfig
o Copy kernel header files to gcc build area
o Build binutils 2.10.1
o Build the bootstrap GCC compiler
../gcc-2.95.3/configure --target=powerpc --prefix=$HOME/tools \
--without-headers --with-newlib --enable-language=c
o Build C library with linux threads support
CC=powerpc-linux-gcc ../glibc-2.2.1/configure --host=powerpc
--prefix="/usr" --enable-add-ons
--with-headers=$HOME/tools/powerpc-linux
o Build Full GCC compiler
../gcc-2.95.3/configure --target=powerpc --prefix=$HOME/tools \
--enable-languages=c,c++
Now the error. It looks like a file has been generated by the configure
script that includes "features.h" in the glibc tree.
Since _LIBC is not defined, another include "gnu/stubs.h"
is attempted. However, since there is no file "stubs.h", the build
fails.
Does anybody have any suggestions ?
----------------------------------------------
Actual Error
----------------------------------------------
/home/bob/pathfinder-mp/build-tools/build-gcc/gcc/xgcc
-B/home/bob/pathfinder-mp/build-tools/build-gcc/gcc/
-B/home/bob/pathfinder-mp/tools/powerpc-linux/bin/
-I/home/bob/pathfinder-mp/tools/powerpc-linux/include -O2
-DCROSS_COMPILE -DIN_GCC -DHAIFA -g -O2 -I./include -fPIC -g1
-DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -mstrict-align -I.
-I../../gcc-2.95.3/gcc -I../../gcc-2.95.3/gcc/config
-I../../gcc-2.95.3/gcc/../include -c -DL${name} \
../../gcc-2.95.3/gcc/libgcc2.c -o ${name}.o; \
if [ $? -eq 0 ] ; then true; else exit 1; fi; \
powerpc-linux-ar rc tmplibgcc2.a ${name}.o; \
rm -f ${name}.o; \
done
_muldi3
In file included from
/home/bob/pathfinder-mp/tools/powerpc-linux/include/stdlib.h:25,
from ../../gcc-2.95.3/gcc/libgcc2.c:41:
/home/bob/pathfinder-mp/tools/powerpc-linux/include/features.h:311:
gnu/stubs.h: No such file or directory
make[3]: *** [libgcc2.a] Error 1
make[3]: Leaving directory
`/home/bob/pathfinder-mp/build-tools/build-gcc/gcc'
make[2]: *** [stmp-multilib-sub] Error 2
make[2]: Leaving directory
`/home/bob/pathfinder-mp/build-tools/build-gcc/gcc'
make[1]: *** [stmp-multilib] Error 1
make[1]: Leaving directory
`/home/bob/pathfinder-mp/build-tools/build-gcc/gcc'
make: *** [all-gcc] Error 2
[bob@budweiser build-gcc]$
[-- Attachment #2: build-crossgcc.sh --]
[-- Type: application/octet-stream, Size: 13968 bytes --]
#!/bin/bash
#
# build-crossgcc.sh
#
# Copyright (c) 2001 by Bill Gatliff, bgat@billgatliff.com All rights
# reserved. This script is provided under the terms of the GPL.
#
# $Id: build-crossgcc.sh,v 1.14 2002/03/21 03:03:32 bgat Exp $
#
# This script automates the tool build process for arm-linux,
# powerpc-linux, and other crosscompilers. Over time, it will be
# extended for lots of other configurations as well.
#
# To use this script, first download copies of the binutils, gcc,
# glibc and your Linux kernel tarballs into a single directory, say,
# ~/tars. See the declarations of LINUXDISTO, GCCDISTO, etc. below to
# know what versions of the files you need, or change them as
# appropriate.
#
# This script has been tested with the following versions:
#
# binutils-2.10.1 gcc-2.95.3 linux-2.4.3 glibc-2.2.2
# glibc-linuxthreads-2.2.2 newlib-1.9.0
#
#
# For the moment, you're on your own if you use different versions,
# although I would be interested in hearing both success and failure
# stories.
#
# Above all, THINK. Avoid just sending me an "it didn't work" email.
#
# You will need about 1GB of disk space to build a *-linux cross
# toolchain, and about 500MB for a non *-linux one.
#
# The first line in this script should point to your "bash"
# executable. usually, just !/bin/sh will do it; sometimes
# (especially if you're running GNU tools on a non-GNU host, like
# solaris8), you need to set it to something like
# !/usr/local/bin/bash.
#
# Some targets need a preconfigured kernel tree (as opposed to just a
# raw one). If the target you select falls into this category, then
# this script will dump you over to menuconfig, or manually configure
# a kernel itself at the appropriate time. If you end up in
# menuconfig, simply focus on the System Type configuration, because
# that's all we're interested in.
#
# <aside>
#
# When you do finally build your kernel (the script doesn't do this
# for you), you'll either have to hack the top-level Linux Makefile,
# or you'll need to do something like this:
#
# make ARCH=arm CROSS_COMPILE=arm-linux-
#
# If you're running a target-specific Linux kernel, this may already
# have been done for you.
#
# </aside>
#
# RUN THIS SCRIPT IN ITS OWN DIRECTORY. It makes lots of
# subdirectories, and isn't very smart about not clobbering something
# useful that may be in its way.
#
# DO NOT RUN THIS SCRIPT AS ROOT, because if you do and something goes
# wrong (a bug in the script, or an incorrect PREFIX definition), then
# you can really hose things up on your workstation. Instead, as root
# simply create a directory like /opt, chmod 777 it, and then return
# to non-root and aim PREFIX over to the new directory. At least then
# if the script really runs wild, you won't clobber important system
# stuff.
#
# Sample invocations:
#
# build-crossgcc.sh
#
# You can also pre-specify the information this script needs, like this:
#
# TARDIR=~/tars PREFIX=/home/me TARGET=arm-linux \
# build-crossgcc.sh 2>&1 | tee build.log
#
# TARDIR is the location of the tarballs, PREFIX is the installation
# location, and TARGET is the type of toolchain you want.
#
# For questions, comments or improvements see the crossgcc mailing
# list at http://sources.redhat.com/ml/crossgcc, or contact the
# author.
#
# TODO: error handling. If a step fails, we currently blindly continue.
# idea: test for the existence of the build products after each step.
# TODO: add capability to use a preexisting linux kernel source tree.
#
DEFAULT_TARDIR=./tars
DEFAULT_PREFIX=/opt/gnu/gcc-3.2.3-xcompile
REVISION="$Id: build-crossgcc.sh,v 1.14 2002/03/21 03:03:32 bgat Exp $"
TARGET_LIST="ia64-unknown-linux"
echo
echo Linux crosscompiler building script,
echo revision $REVISION
echo
# only prompt if we're missing information
if [ x${PREFIX} = x ] || [ x${TARGET} = x ] || [ x${TARDIR} = x ] || [ x${NUMPROC} = x ]; then
PS3="Please select a target: "
select TARGET in ${TARGET_LIST};
do echo; break; done
PREFIX=${DEFAULT_PREFIX}/${TARGET}
echo "Install the tools where?"
read -p "[${PREFIX}]: "
if [ x${REPLY} != x ]; then PREFIX=$REPLY; fi
echo
echo "Tarballs are where?"
TARDIR=${DEFAULT_TARDIR}
read -p "[${TARDIR}]: "
if [ x${REPLY} != x ]; then TARDIR=${REPLY}; fi
echo "Number of processors on build host?"
NUMPROC=${DEFAULT_NUMPROC}
read -p "[${NUMPROC}]: "
if [ x${REPLY} != x ]; then NUMPROC=${REPLY}; fi
fi
# test that we have write permissions to the install dir
mkdir -p ${PREFIX}/${TARGET}
touch ${PREFIX}/${TARGET}/test-if-write
if [ ! -f ${PREFIX}/${TARGET}/test-if-write ]; then
echo "You don't appear to have write permissions to ${PREFIX}/${TARGET}."
echo "You must fix that before continuing."
exit
fi
echo
echo Building for:
echo " --target=$TARGET"
echo " --prefix=$PREFIX"
echo " tarballs are at $TARDIR"
###
#
# Tweak these for the versions you will use. Their names must
# correspond to the base names of the tarballs they come from,
# i.e. if you define BINUTILSDISTO=my-binutils, then there should
# be a file my-binutils.tar.gz in $TARDIR.
#
BINUTILSDISTO=binutils-2.14
GCCDISTO=gcc-3.2.3
LINUXDISTO=linux-2.4.18-e.25
GLIBCDISTO=glibc-2.2.4
GLIBCTHREADSDISTO=glibc-linuxthreads-2.2.4
INCLUDEDISTRO=${TARGET}-include
LIBDISTRO=${TARGET}-lib
WORKINGDIR=`pwd`
#NEWLIBDISTO=newlib-1.9.0
# optionally, you can take out the 'v' here to quiet things down a bit.
#TARFLAGS=xvf
TARFLAGS=xf
###
#
# Don't modify anything below here, unless you're fixing bugs.
#
# make sure the build product's binaries are in the search path
export PATH=${PATH}:${PREFIX}/bin
# map TARGET to Linux equivalent, if applicable
case $TARGET in
powerpc-linux) ARCH=ppc ;;
arm-linux) ARCH=arm ;;
ia64-unknown-linux) ARCH=ia64 ;;
esac
#
# get Linux headers and libraries, if we need them
#
case $TARGET in
powerpc-linux | arm-linux | ia64-unknown-linux)
echo
echo "Configuring and installing linux headers."
mkdir -p ${PREFIX}/${TARGET}/include
gunzip -c ${TARDIR}/${INCLUDEDISTRO}.tar.gz | tar $TARFLAGS -
cp -r include/* ${PREFIX}/${TARGET}/include
rm -rf include
gunzip -c ${TARDIR}/${LINUXDISTO}.tar.gz | tar $TARFLAGS -
;;
esac
#
# some headers need tweaking before use, so tweak and install
#
case $TARGET in
powerpc-linux | ia64-unknown-linux)
# we don't need to do anything funky with the kernel first,
# so just grab the parts we need, and go
cd $LINUXDISTO
make -s ARCH=$ARCH symlinks include/linux/version.h
cp -r include/linux ${PREFIX}/${TARGET}/include/linux
cp -r include/asm-${ARCH} ${PREFIX}/${TARGET}/include/asm
cd ..
;;
arm-linux)
# we need target-specific and platform-specific headers, so
# that we can build the right libgcc2 and glibc.
echo "This target requires configured kernel headers."
echo "(actually, it just needs ARM processor and platform selections---"
echo "the rest you can do later, after the tools are built)"
read -p "Press ENTER to run menuconfig."
# don't try to combine these two, the dependencies in the makefile
# cause symlinks to get run before menuconfig, which is wrong here
# TODO: this is currently broken.
cd $LINUXDISTO
make -s ARCH=$ARCH menuconfig
make -s ARCH=$ARCH symlinks include/linux/version.h
mkdir -p ${PREFIX}/${TARGET}/include
cp -r include/linux ${PREFIX}/${TARGET}/include
cp -r include/asm-${ARCH} ${PREFIX}/${TARGET}/include/asm
cd ..
;;
esac
#
# build binutils
#
echo
echo Building binutils.
gunzip -c ${TARDIR}/${BINUTILSDISTO}.tar.gz | tar $TARFLAGS -
mkdir build-binutils; cd build-binutils
../${BINUTILSDISTO}/configure --quiet --target=$TARGET --prefix=$PREFIX \
--enable-shared \
2>&1 | tee configure.log
make -s -j$NUMPROC all install 2>&1 | tee make.log
cd ..
# test to see if this step passed
if [ ! -f ${PREFIX}/bin/${TARGET}-ld ]; then
echo Build failed during binutils && exit 1
fi
#
# build gcc-core
#
echo
echo Building gcc-core.
gunzip -c ${TARDIR}/${GCCDISTO}.tar.gz | tar $TARFLAGS -
mv ${GCCDISTO} ${GCCDISTO}-core
mkdir build-gcc-core; cd build-gcc-core
case $TARGET in
arm-elf | h8300-coff | h8300-hitachi-hms | m68k-coff | m68k-elf | powerpc-eabi | powerpc-linux | sh-elf | sh-hms )
# 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
# configure process throws in a:
#
# TARGET_LIBGCC2_CFLAGS=-Dinhibit_libc
#
# in the makefiles, to cut out pieces of libgcc code that need
# target-specific header files.
#
# the result is a compiler that *almost* works, that should only
# be used to build libraries and target-specific header files.
# After we we do that, we build a full-up gcc crosscompiler.
# first, configure
../${GCCDISTO}-core/configure --quiet --target=$TARGET --prefix=$PREFIX \
--enable-languages=c --with-local-prefix=${PREFIX}/${TARGET} \
--without-headers --with-newlib --disable-shared \
2>&1 | tee configure.log
;;
arm-linux)
# like the above, only we have to modify gcc/config/arm/t-linux,
# for reasons I can't entirely explain right now. One would
# *think* that the procedure above for powerpc-eabi et al would be
# fine...
# we add -D__gthr_posix_h and -Dinhibit_libc to
# TARGET_LIBGCC2_CFLAGS, so that libgcc2 will be built without
# needing "gthr" (gnu pthreads).
mv ../${GCCDISTO}-core/gcc/config/arm/t-linux \
../${GCCDISTO}-core/gcc/config/arm/t-linux-original
sed "s/TARGET_LIBGCC2_CFLAGS =/TARGET_LIBGCC2_CFLAGS = -D__gthr_posix_h -Dinhibit_libc/" \
< ../${GCCDISTO}-core/gcc/config/arm/t-linux-original \
> ../${GCCDISTO}-core/gcc/config/arm/t-linux
# now configure
../${GCCDISTO}-core/configure --quiet --target=$TARGET --prefix=$PREFIX \
--enable-languages=c --without-headers --with-newlib \
--with-local-prefix=${PREFIX}/${TARGET} \
2>&1 | tee configure.log
;;
ia64-unknown-linux)
# now configure
../${GCCDISTO}-core/configure --quiet --target=$TARGET --prefix=$PREFIX \
--enable-languages=c --with-local-prefix=${PREFIX}/${TARGET} \
--without-headers --with-newlib --disable-shared \
2>&1 | tee configure.log
;;
esac
# with that done, now we can make and install gcc-core
make -s -j$NUMPROC all-gcc install-gcc 2>&1 | tee make.log
cd ..
# test to see if this step passed
if [ ! -f ${PREFIX}/bin/${TARGET}-gcc ]; then
echo Build failed during gcc-core && exit 1
fi
#
# build glibc or newlib, as appropriate
#
case $TARGET in
# these targets use glibc
arm-linux | powerpc-linux | ia64-unknown-linux)
echo
echo Building glibc and linuxthreads.
gunzip -c ${TARDIR}/${GLIBCDISTO}.tar.gz | tar $TARFLAGS -
#cd ${GLIBCDISTO}
#gunzip -c ../${TARDIR}/${GLIBCTHREADSDISTO}.tar.gz | tar $TARFLAGS -
#cd ..
mkdir build-glibc; cd build-glibc
CC=${TARGET}-gcc AR=${TARGET}-ar RANLIB=${TARGET}-ranlib \
../${GLIBCDISTO}/configure --quiet --host=$TARGET --prefix=${PREFIX}/${TARGET} \
--enable-add-ons=linuxthreads --with-headers=${PREFIX}/${TARGET}/include \
--disable-sanity-checks 2>&1 | tee configure.log ;;
# these targets use newlib
arm-elf | h8300-coff | h8300-hitachi-hms | m68k-coff | m68k-elf | powerpc-eabi | sh-elf | sh-hms)
echo
echo Building newlib.
gunzip -c ${TARDIR}/${NEWLIBDISTO}.tar.gz | tar $TARFLAGS -
mkdir build-newlib; cd build-newlib
../${NEWLIBDISTO}/configure --quiet --target=$TARGET --prefix=$PREFIX \
2>&1 | tee configure.log
esac
make -s PARALLELMFLAGS=-j$NUMPROC 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
echo Building libc failed && exit 1
fi
#
# finally, build a full-up gcc c/c++ compiler
#
echo
echo Building gcc.
gunzip -c ${TARDIR}/${GCCDISTO}.tar.gz | tar $TARFLAGS -
mkdir build-gcc; cd build-gcc
../${GCCDISTO}/configure --quiet --target=$TARGET --prefix=$PREFIX \
--enable-languages=c,c++,f77,objc --with-local-prefix=${PREFIX}/${TARGET} \
--with-gnu-ld --with-gnu-as --enable-clocale=gnu --enable-shared --enable-threads=posix \
--enable-__cxa_atexit
2>&1 | tee configure.log
case $TARGET in
powerpc-eabi)
# powerpc-eabi doesn't come with a "default" build target, so to
# the configuration process, the compiler looks broken because it
# won't link to produce executables (because it doesn't know what
# linker command file to use). To fix that, we just specify a
# build target. This doesn't affect anything other than it lets
# the configuration steps that happen internal to the build
# process know that the compiler indeed works.
make -s all install 2>&1 | tee make.log
make -s CFLAGS="-myellowknife -O" all 2>&1 | tee -a make.log
make -s install 2>&1 | tee -a make.log
;;
*)
# everyone else can use the standard procedure
make -s -j$NUMPROC all install 2>&1 | tee make.log
;;
esac
# test to see if this step passed
if [ ! -f ${PREFIX}/bin/${TARGET}-gcc ]; then
echo Build failed during gcc && exit 1
fi
echo
echo "Configuring and installing libraries"
mkdir -p ${PREFIX}/${TARGET}/lib
gunzip -c ${TARDIR}/${LIBDISTRO}.tar.gz | tar $TARFLAGS -
cp -r lib/* ${PREFIX}/${TARGET}/lib
rm -rf lib
^ permalink raw reply [flat|nested] 2+ messages in thread
* GCC 2.95.3 cross compiler build error looking for stubs.h
@ 2004-02-12 23:39 Bob Beck
0 siblings, 0 replies; 2+ messages in thread
From: Bob Beck @ 2004-02-12 23:39 UTC (permalink / raw)
To: gcc-help
I am building GCC as a cross compiler for the PowerPC.
The instructions I am following are from O'Reilly's "Building
Embedded Systems" book. At a high level I have done the
following.
o Configure the kernel (2.4.18) using make menuconfig
o Copy kernel header files to gcc build area
o Build binutils 2.10.1
o Build the bootstrap GCC compiler
../gcc-2.95.3/configure --target=powerpc --prefix=$HOME/tools \
--without-headers --with-newlib --enable-language=c
o Build C library with linux threads support
CC=powerpc-linux-gcc ../glibc-2.2.1/configure --host=powerpc
--prefix="/usr" --enable-add-ons --with-headers=$HOME/tools/powerpc-linux
o Build Full GCC compiler
../gcc-2.95.3/configure --target=powerpc --prefix=$HOME/tools \
--enable-languages=c,c++
Now the error. It looks like a file has been generated by the
configure script that includes "features.h" in the glibc tree.
Since _LIBC is not defined, another include "gnu/stubs.h"
is attempted. However, since there is no file "stubs.h", the
build fails.
Does anybody have any suggestions ?
----------------------------------------------
Actual Error
----------------------------------------------
/home/bob/pathfinder-mp/build-tools/build-gcc/gcc/xgcc
-B/home/bob/pathfinder-mp/build-tools/build-gcc/gcc/
-B/home/bob/pathfinder-mp/tools/powerpc-linux/bin/
-I/home/bob/pathfinder-mp/tools/powerpc-linux/include -O2
-DCROSS_COMPILE -DIN_GCC -DHAIFA -g -O2 -I./include -fPIC -g1
-DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -mstrict-align -I.
-I../../gcc-2.95.3/gcc -I../../gcc-2.95.3/gcc/config
-I../../gcc-2.95.3/gcc/../include -c -DL${name} \
../../gcc-2.95.3/gcc/libgcc2.c -o ${name}.o; \
if [ $? -eq 0 ] ; then true; else exit 1; fi; \
powerpc-linux-ar rc tmplibgcc2.a ${name}.o; \
rm -f ${name}.o; \
done
_muldi3
In file included from
/home/bob/pathfinder-mp/tools/powerpc-linux/include/stdlib.h:25,
from ../../gcc-2.95.3/gcc/libgcc2.c:41:
/home/bob/pathfinder-mp/tools/powerpc-linux/include/features.h:311:
gnu/stubs.h: No such file or directory
make[3]: *** [libgcc2.a] Error 1
make[3]: Leaving directory
`/home/bob/pathfinder-mp/build-tools/build-gcc/gcc'
make[2]: *** [stmp-multilib-sub] Error 2
make[2]: Leaving directory
`/home/bob/pathfinder-mp/build-tools/build-gcc/gcc'
make[1]: *** [stmp-multilib] Error 1
make[1]: Leaving directory
`/home/bob/pathfinder-mp/build-tools/build-gcc/gcc'
make: *** [all-gcc] Error 2
[bob@budweiser build-gcc]$
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-02-13 0:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-13 0:46 GCC 2.95.3 cross compiler build error looking for stubs.h Lew Newby Jr.
-- strict thread matches above, loose matches on Subject: below --
2004-02-12 23:39 Bob Beck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).