Problems when building gcc 3.2or 3.3 as cross compiler for powerpc-linux

Richard Sewards richard.sewards@navtelcom.com
Mon May 26 15:48:00 GMT 2003


Hi,

I have been trying to build 3.2.3 and 3.3 with glibc 2.3.2 as cross
compilers (host i686-linux-gnu, target powerpc-linux-gnu) and I run into
header file problems when compiling libgcc2.c.  Specifically, I get:

    In file included from tconfig.h:22,
                 from ../src/gcc/libgcc2.c:36:
    ../src/gcc/config/rs6000/linux.h:86:20: signal.h: No such file or
directory
    ../src/gcc/config/rs6000/linux.h:87:26: sys/ucontext.h: No such file
or directory

I have been following the advice in Nick Patavalis' very helpful note,
but this appears to be a powerpc specific issue.

The only place I can find signal.h and sys/ucontext.h files that contain
the struct definitions (sigcontext, ucontext) used by rs6000/linux.h is
in glibc.  The kernel headers (2.4.20) don't have the necessary structs.

So, how can I build the minimal gcc needed to build glibc if libgcc2
needs glibc?  Has anyone else tried this?  


I have tried ignoring the error ("make -k; make -k install") under the
assumption that to build glibc I don't need to create executables and
thus don't need libgcc.a.  However, with the resulting minimal gcc I get
errors from glibc:

    sscanf.c:31: warning: conflicting types for built-in function
`sscanf'
    sscanf.c: In function `sscanf':
    sscanf.c:37: error: `va_start' used in function with fixed args

In glibc 2.3.2 sscanf is coded as:

int
sscanf (s, format)
     const char *s;
     const char *format;
{
  va_list arg;
  int done;

  va_start (arg, format);
  done = __vsscanf (s, format, arg);
  va_end (arg);

  return done;
}

Is there some magic that requires "sscanf (s, format)" instead of
"sscanf (s, format, ...)" here?  Is this error due to my incomplete
minimal gcc build?

Thanks in advance, 

--
Richard Sewards
=* 121245

-----Original Message-----
From: Nick Patavalis [mailto:npat@inaccessnetworks.com] 
Sent: Thursday, May 22, 2003 7:05 AM
To: t152@vmars.tuwien.ac.at
Cc: gcc-help@gcc.gnu.org
Subject: Re: problems when building gcc 3.2.3 as crosscompiler

On Wed, May 21, 2003 at 03:51:00PM +0200, t152@vmars.tuwien.ac.at wrote:
> Hi,
> 
> I'm currently trying to build the gcc 3.2.3 as cross-compiler
> for power pc on a i686-pc-linux-gnu host with this compiler:
>
> ...
> 
> Maybe there is something completely wrong with my approach.
> 

Not completely wrong, but not right either. Since you have no target
standard-library (glibc), I would suggest first building a mininal
(no-threads, and no-other-fancy-stuff) c-only cross-compiler, using
the "inhibit_libc" patch. Then you can use this compiler to
cross-build a glibc (or other standard library) for your target. Only
then, having the target library, you can build a "complete"
cross-compiler with front-ends for any language you might need, thread
support, etc.

I have posted a message with very detailed instructions on how to
build a cross-toolchain from scratch in the "gcc-help" newsgroup. The
examples are for the sparc-linux target, but the overall procedure is
very similar for other targets too. You can also get this document
from here:

http://www.inaccessnetworks.com/misc-downloads/xdvl/cross-toolchain-buil
d.txt

/npat

-- 
They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety.
  -- Benjamin Franklin, Historical Review of Pennsylvania, 1759.



More information about the Gcc-help mailing list