problems cross-compilng gcc

Brendan J Simon
Wed Dec 29 17:48:00 GMT 1999

Andy wrote:

> Day 3
> This time the events unfolded as follows:
> I configured the gcc environment using --with-libs and --with-headers options.
> This forced the configure script to copy the target libs to
> /cross-tools/powerpc--openbsd/lib and
> create a directory in /cross-tools/powerpc-openbsd called sys-includes
> where it copied all the target headers.
> Then I ran make  all install.
> It fixed the headers ( or so it said)
> The errors it produced during build were the same as  before:
> 1. conflicting types for sys_errlist ( libiberty/strerror.c)
> 2. unknown fields of the FILE struct and some undefined flags (
> libiberty/vsprintf.c)
> 3.undefined PATH_MAX ( libchill/basicio.c)
> 4.   libiberty/strsignal.c: coid psignal(signo, message)
> - message declared as const in the header.
> In addition to that it produced a "parse error" in gcc/include/stdio.h on
> the following routine declarations:
> /*
> int      vasprintf __P((char **, const char *, _BSD_DUMMY_VA_LIST_))
>                 __attribute__((format (printf, 2, 0)));
> int      vsnprintf __P((char *, size_t, const char *, _BSD_DUMMY_VA_LIST_))
>                 __attribute__((format (printf, 3, 0)));
> int      vscanf __P((const char *, _BSD_DUMMY_VA_LIST_))
>                 __attribute__((format (scanf, 1, 0)));
> int      vsscanf __P((const char *, const char *, _BSD_DUMMY_VA_LIST_))
>                 __attribute__((format (scanf, 2, 0)));*/
> aparrently it couldn't find  _BSD_DUMMY_VA_LIST_ ( I couldn't)
> I commented these routines out - well it didn't complain.
> After that the buid completed successfully
> couple of questions that arose during the build process:
> -the  target libraries I told it to use to build the cross-compiler were
> built with gcc 2.8.1 -- could this be a part of my problem?
> -It built several copies of libiberty:
> - gcc*/libiberty
> - gcc*/powerpc--openbsd/libiberty
> -gcc*/powerpc--openbsd/soft-float/libiberty
> Why is this done?
> BTW the last 2 libiberty libs were the ones that gave me errors
> <<<>>>
> Now to the real problem:
> when I tried to build a kernel with the cross-compiler I was getting
> unresolved link errors ( routines like bcmp, bcopy, bzero,etc.)
> These routines are compiled into  libkern.o object  so I examined that and
> lo! it's all bogus.
> i.e, nm reports:
> nm: libkern.o: not object file or archive
> I did a hex dump - well  there's elf header but no symbol names.
> I  ran nm on  several objects that my cross-compiler produced and all with
> the same result:
> nm reports that it's not an object file or archive.,
> So, looks like my cross-compiler produces garbage.
> I'm totally stuck
> Any ideas ? anyone?

This means you are using the wrong version of nm and/or you are compiling with the
wrong version of gcc.
"nm --help" will give you the supported targets.  This will usually be for your
native processor architecture.  Check your paths.  Use the absolute path for the
correct cross tools version of nm.

Did you add a program prefix when configuring/building the cross-compiler
(--with-program-prefix=powerpc-openbsd-) ?

I used "--with-program-prefix=powerpc-linux-" for my cross-compiler and binutils.
I then use powerpc-linux-nm, powerpc-linux-ar, powerpc-linux-as,
powerpc-linux-gcc, powerpc-linux-g++, etc for all my cross-tools.

Brendan Simon.

Want more information?  See the CrossGCC FAQ,
Want to unsubscribe? Send a note to

More information about the crossgcc mailing list