This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


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

Re: cross-compiler intel -> powerpc-gnu-linux


These are the steps that I followed to build the cross-compiler I am currently using (I am reasonably
certain that these are quite complete):

# Packages:
#   binutils-2.9.5.0.46.tar.gz
#   gcc-core-2.95.2.tar.gz
#   linux-2.2.15.tar.gz
#   glibc-2.1.3.tar.gz
#   glibc-crypt-2.1.tar.gz
#   glibc-linuxthreads.2.1.3.tar.gz
#

# Unpackage source

# Set up some environment vars
host=i686-linux
target=powerpc-linux
prefix=/opt/test
tprefix=${prefix}/${target}
bin=${prefix}/bin
binutils=../binutils-2.9.5.0.46
gcc=../gcc-2.95.2
glibc=../glibc-2.1.3
kernel=../linux-2.2.15

# Do some cleanup (if necessary) and prep work
rm -fr binutils-build gcc-build glibc-build
mkdir binutils-build gcc-build glibc-build

# Build tool chain
cd ${base}/binutils-build
${binutils}/configure --srcdir=${binutils} --prefix=${prefix} --target=${target}
make all
<make install>

cd ${base}/gcc-build
${gcc}/configure --srcdir=${gcc} --prefix=${prefix} --target=${target}
export PATH=${bin}:${PATH}
make all
<make install>

# Install kernel headers
<cd ${kernel}>
# Edit ${kernel}/Makefile, change line 'ARCH := ...' to 'ARCH := ppc'
<make menuconfig>
# In 'Platform support' select correct 'Processor type' and 'Machine type' and exit
# with save
<make dep>
# Copy kernal include files into tool chain install directory
<cp -dR ${kernel}/include/asm-ppc ${tprefix}/include/asm>
<cp -dR ${kernel}/include/linux ${tprefix}/include/linux>

# Finish tool chain
cd ${base}/glibc-build
CC=${target}-gcc
${glibc}/configure --srcdir=${glibc} --prefix=${tprefix} --build=${host}
--enable-add-ons=crypt,linuxthreads --with-headers=${tprefix}/include ${target}
make all
<make install>

All of the steps that are enclosed in '<...>' are steps which are performed while logged in as root.

]
Bob Robison wrote:

> OK, I got the new (2.9.5.0.46) binutils and built it with no real problems.  I configured gcc
> adding a -with-headers line to point at a copy of powerpc-linux kernel
> headers that I have (from a fairly recent kernel).  I was able to get successfully through the gcc
> build with that.  Now I
> need to build glibc.  This seems more complicated.  I tried the following configure line, and
> directly referenced the sys-include directory utilized in the gcc build.  (I know this sounds
> kludgy... I'm open to other ideas!)  The build continued on for quite a ways before failing.
>
> #!/bin/sh
> CC=powerpc-gnu-linux-gcc ../glibc-2.1.3/configure --host=powerpc-gnu-linux
> --build=powerpc-gnu-linux --target=powerpc-gnu-linux
>  --prefix=/usr/crosslinux --exec-prefix=/usr/crosslinux --program-suffix=linppc -v
> --enable-languages=c --with-binutils=/usr/cr
> osslinux/powerpc-gnu-linux/bin --enable-add-ons=linuxthreads,crypt
> --with-headers=/usr/crosslinux/powerpc-gnu-linux/sys-include
>
> (ignore the linewraps)  I had to but in host= and build= for powerpc to get things cranking.  It
> goes for quite a while, but then while trying to do a link step it complains:
>
> powerpc-gnu-linux-gcc -B/usr/crosslinux/powerpc-gnu-linux/bin/ -nostdlib -nostartfiles -o
> /usr/local/temp/build-glibc/locale/localedef  -Wl,-dynamic-linker=/usr/crosslinux/lib/ld.so.1
> /usr/local/temp/build-glibc/csu/crt1.o /usr/local/temp/build-glibc/csu/crti.o
> `powerpc-gnu-linux-gcc -B/usr/crosslinux/powerpc-gnu-linux/bin/ --print-file-name=crtbegin.o`
> /usr/local/temp/build-glibc/locale/localedef.o /usr/local/temp/build-glibc/locale/ld-ctype.o
> /usr/local/temp/build-glibc/locale/ld-messages.o /usr/local/temp/build-glibc/locale/ld-monetary.o
> /usr/local/temp/build-glibc/locale/ld-numeric.o /usr/local/temp/build-glibc/locale/ld-time.o
> /usr/local/temp/build-glibc/locale/ld-collate.o /usr/local/temp/build-glibc/locale/charmap.o
> /usr/local/temp/build-glibc/locale/charset.o /usr/local/temp/build-glibc/locale/linereader.o
> /usr/local/temp/build-glibc/locale/locfile.o /usr/local/temp/build-glibc/locale/stringtrans.o
> /usr/local/temp/build-glibc/locale/repertoire.o /usr/local/temp/build-glibc/locale/simple-hash.o
> /usr/local/temp/build-glibc/locale/xmalloc.o /usr/local/temp/build-glibc/locale/xstrdup.o
> -Wl,-rpath-link=/usr/local/temp/build-glibc:/usr/local/temp/build-glibc/math:/usr/local/temp/build-g
> libc/elf:/usr/local/temp/build-glibc/nss:/usr/local/temp/build-glibc/nis:/usr/local/temp/build-glibc
> /rt:/usr/local/temp/build-glibc/resolv:/usr/local/temp/build-glibc/db2:/usr/local/temp/build-glibc/l
> inuxthreads /usr/local/temp/build-glibc/libc.so.6 /usr/local/temp/build-glibc/libc_nonshared.a
> -lgcc `powerpc-gnu-linux-gcc -B/usr/crosslinux/powerpc-gnu-linux/bin/ --print-file-name=crtend.o`
> /usr/local/temp/build-glibc/csu/crtn.o
> /usr/local/temp/build-glibc/locale/localedef.o: In function `main':
> /usr/local/temp/glibc-2.1.3/locale/programs/localedef.c:282: warning: mmap is not implemented and
> will always fail
> /usr/local/temp/build-glibc/libc.so.6: undefined reference to
> `__syscall_getpriority'/usr/local/temp/build-glibc/libc.so.6: undefined reference to
> `__syscall_execve'
> /usr/local/temp/build-glibc/libc.so.6: undefined reference to `__syscall_sigaction'
> /usr/local/temp/build-glibc/libc.so.6: undefined reference to `__syscall_sigprocmask'
>
> and a bunch more __syscall_xxxx undefined.  I'm guessing that I did something dumb/obvious and
> somehow the appropriate sysdefs that include syscall are not being built, or included in my
> temporary libc.
>
> Can anyone shed some light on this?  I'm not real familiar with where to look for gilbc
> configuration/help.  The stuff I have seen does not address the cross-environment.
>
> thanks,
> bob
>
> On 13-Jun-00 Brendan Simon wrote:
> > Hi Bob,
> >
> > I remember this problem and it is very frustrating._ I can't rember how
> > I solved it._ I'll have to look through my build scripts when I get
> > home._ I have a feeling that I had the "preinstall" the header files
> > manually._ ie. copy header files to $prefix/$target/include._ Also make
> > sure the linux header files are there too._ I usually just use a
> > symbolic link to the kernel headers._ Make sure it is not the kernel
> > headers for your host (ie. /usr/include/linux or
> > /usr/src/linux/include/linux) as the asm symbolic link will be wrong.
> > I can't be more specific at this stage but will have a better idea of
> > what I did when I look at my build scripts.
> >
> > BTW: I think the binutils I used was 2.9.5.0.24._ I'm sure there is a
> > later version now._ I got it from H.Lu's site at vasystems._ I can't
> > remeber the URL at the moment but I'm sure it must be in the archives
> > somewhere._ I know that 2.9.1 is outdated and some problems were fixed
> > for the powerpc.
> >
> > Brendan Simon.
> >
> >
> >
> > Bob Robison wrote:
> >>
> >> I have been reading through the archives (which have been very helpful) -- but I am still having
> >> problems building the cross-compiler I want.  My setup is:
> >>
> >> gcc-2.95.2    glibc-2.1.3  binutils-2.9.1
> >>
> >> Binutils seems to build with no problems.  My configure line for gcc (from a build directory)
> >> is:
> >>
> >> .../gcc-2.95.2/configure --target=powerpc-gnu-linux --prefix=/usr/crosslinux \
> >> --exec-prefix=/usr/crosslinux --program-suffix=linppc -v --enable-languages=c \
> >> --with-headers=/usr/local/temp/glibc-2.1.3/include
> >>
> >> The problem I have is exactly the same as what Brendan Simon reported on January 24th:
> >> The --with-headers line copies everything from glibc-2.1.3/include into a sys-include directory
> >> (in my case: /usr/crosslinux/powerpc-gnu-linux/sys-include)  But some of these files reference
> >> include files that are one level up.  i.e. sys/cdefs.h is a single line file that includes
> >>   This misc directory is in the glibc-2.1.3 main directory -- but I'm not sure
> >> how to reference it.  I don't think I should set my --with-headers= argument to reference the
> >> whole
> >> glibc-2.1.3 directory!
> >>
> >> Any ideas?
> >> (output below is snipped from the output of >make LANGUAGES=c all install
> >> --------------------
> >> make[3]: Entering directory &pi0;/usr/local/temp/gcc-build/gcc'
> >> rm -f tmplibgcc2.a
> >> for name in _muldi3 _divdi3 _moddi3 _udivdi3 _umoddi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _ffsdi2
> >> _udiv_w_sdiv _udivmoddi4 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf _fixunsdfsi _fixunssfsi
> >> _fixunsdfdi
> >> _fixdfdi _fixunssfdi _fixsfdi _fixxfdi _fixunsxfdi _floatdixf _fixunsxfsi _fixtfdi _fixunstfdi
> >> _floatditf __gcc_bcmp _varargs __dummy _eprintf _bb _shtab _clear_cache _trampoline __main _exit
> >> _ctors _pure; \
> >> do \
> >>   echo ${name}; \
> >>   /usr/local/temp/gcc-build/gcc/xgcc -B/usr/local/temp/gcc-build/gcc/
> >> -B/usr/crosslinux/powerpc-gnu-linux/bin/ -I/usr/crosslinux/powerpc-gnu-linux/include -O2
> >> -DCROSS_COMPILE -DIN_GCC -DHAIFA    -g -O2 -I./include  -fPIC -g1  -DIN_LIBGCC2
> >> -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc   -mstrict-align -I. -I../../gcc-2.95.2/gcc
> >> -I../../gcc-2.95.2/gcc/config -I../../gcc-2.95.2/gcc/../include -c -DL${name} \
> >>        ../../gcc-2.95.2/gcc/libgcc2.c -o ${name}.o; \
> >>   if [ $? -eq 0 ] ; then true; else exit 1; fi; \
> >>   arlinppc rc tmplibgcc2.a ${name}.o; \
> >>   rm -f ${name}.o; \
> >> done
> >> _muldi3
> >> _divdi3
> >> _moddi3
> >> _udivdi3
> >> _umoddi3
> >> _negdi2
> >> _lshrdi3
> >> _ashldi3
> >> _ashrdi3
> >> _ffsdi2
> >> _udiv_w_sdiv
> >> _udivmoddi4
> >> _cmpdi2
> >> _ucmpdi2
> >> _floatdidf
> >> _floatdisf
> >> _fixunsdfsi
> >> In file included from
> >> /usr/crosslinux/lib/gcc-lib/powerpc-gnu-linux/2.95.2/../../../../powerpc-gnu-linux/sys-include/fe
> >> atu
> >> res.h:250,
> >>                  from
> >> /usr/crosslinux/lib/gcc-lib/powerpc-gnu-linux/2.95.2/../../../../powerpc-gnu-linux/sys-include/li
> >> mit
> >> s.h:26,
> >>                  from /usr/local/temp/gcc-build/gcc/include/limits.h:117,
> >>                  from include/syslimits.h:7,
> >>                  from include/limits.h:11,
> >>                  from ../../gcc-2.95.2/gcc/libgcc2.c:1105:
> >> /usr/crosslinux/lib/gcc-lib/powerpc-gnu-linux/2.95.2/../../../../powerpc-gnu-linux/sys-include/sy
> >> s/c
> >> defs.h:1: misc/sys/cdefs.h: No such file or directory
> >>
> >>
> >>
> >>
> >> Please help!
> >> bob
> >> -----------
> >> This message was sent by XFMail at 16:43:09 on 12-Jun-00 by:
> >> Bob Robison          Southwest Research Institute,http://www.swri.org
> >> Staff Engineer             Signal Exploitation & Geolocation Division
> >> brobison@swri.org               Phone:(210)522-3935/Fax:(210)522-2709
> >> <><    <><    <><    <><    <><    <><    <><    <><    <><   Col 3:2
> >>
> >>
> >
>
> ------
> Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
> Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


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


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