Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Cross compiler problems: gcc on linux for powerpc-wrs-vxworks

320 views
Skip to first unread message

Vic at Marconi

unread,
Jun 2, 2004, 10:57:23 AM6/2/04
to
All,

I'm trying to compile gcc 2.95.3 on a linux box to produce a cross
compiler from linux to powerpc, for vxworks. In other words:

The result should be linux executables (i.e., programs to run on the
linux box) that compile our software, producing powerpc executables to
run on vxworks.

I will give the details below, but the crux of the matter is: I cannot
get gcc to compile successfully.

Has anyone else out there tried this, and succeeded?

(Note: I've looked all over the web, and found some useful
information, which has gotten me as far as I have, but now I have
problems that I haven't seen addressed anywhere.)

Thanks.

Vic Norman


The linux box is this:

Linux swbuild-linux1 2.4.20-28.9smp #1 SMP Thu Dec 18 13:37:36 EST
2003 i686 i686 i386 GNU/Linux

I have created a directory called gcc in my home directory:

mkdir /us/norman/gcc

And, unpacked gcc 2.95.3 and binutils 2.11.2 in there. I am trying to
put the results in /us/norman/gcc (for now).

So, I do this:

cd /us/norman/gcc
setenv PATH /us/norman/gcc/bin:$PATH
cd binutils-2.11.2/
configure --prefix=/us/norman/gcc --target=powerpc-wrs-vxworks
make all install

[This completes successfully.]

rehash
cd ../gcc-2.95.3
configure --prefix=/us/norman/gcc --target=powerpc-wrs-vxworks
--with-headers=/us/swcommon/vxworks-main/target/h
--enable-languages=c,c++
make cross

[Error # 1]

/us/norman/gcc/gcc-2.95.3/gcc/xgcc -B/us/norman/gcc/gcc-2.95.3/gcc/
-B/us/norman/gcc/powerpc-wrs-vxworks/bin/ -c -DHAVE_CONFIG_H -g -O2
-I. -I./../../include choose-temp.c
In file included from
/us/norman/gcc/gcc-2.95.3/gcc/include/types/vxANSI.h:45,
from
/us/norman/gcc/gcc-2.95.3/gcc/include/stdio.h:59,
from choose-temp.c:29:
/us/norman/gcc/gcc-2.95.3/gcc/include/types/vxArch.h:46: warning:
`_BIG_ENDIAN' redefined
*Initialization*:1: warning: this is the location of the previous
definition
choose-temp.c:38: sys/file.h: No such file or directory
make[2]: *** [choose-temp.o] Error 1

Edit ~/gcc/gcc-2.95.3/powerpc-wrs-vxworks/libiberty/config.h, changing
#define HAVE_SYS_FILE_H 1
to
#undef HAVE_SYS_FILE_H

$ make cross

[Error # 2]

/us/norman/gcc/gcc-2.95.3/gcc/xgcc -B/us/norman/gcc/gcc-2.95.3/gcc/
-B/us/norman/gcc/powerpc-wrs-vxworks/bin/ -c -DHAVE_CONFIG_H -g -O2
-I. -I./../../include fdmatch.c
In file included from
/us/norman/gcc/gcc-2.95.3/gcc/include/types/vxANSI.h:45,
from
/us/norman/gcc/gcc-2.95.3/gcc/include/types/vxTypes.h:63,
from
/us/norman/gcc/lib/gcc-lib/powerpc-wrs-vxworks/2.95.3/../../../../powerpc-wrs-vxworks/sys-include/sys/types.h:39,
from fdmatch.c:52:
/us/norman/gcc/gcc-2.95.3/gcc/include/types/vxArch.h:46: warning:
`_BIG_ENDIAN' redefined
*Initialization*:1: warning: this is the location of the previous
definition
In file included from fdmatch.c:53:
/us/norman/gcc/lib/gcc-lib/powerpc-wrs-vxworks/2.95.3/../../../../powerpc-wrs-vxworks/sys-include/sys/stat.h:43:
parse error before `ULONG'

edit ~/gcc/powerpc-wrs-vxworks/sys-include/sys/types.h, adding this

#include "types/vxTypesOld.h"

after the "types/vxTypes.h" line.

$ make cross

[Error # 4]
/us/norman/gcc/gcc-2.95.3/gcc/xgcc -B/us/norman/gcc/gcc-2.95.3/gcc/
-B/us/norman/gcc/powerpc-wrs-vxworks/bin/ -c -DHAVE_CONFIG_H -g -O2
-I. -I./../../include getpagesize.c
In file included from
/us/norman/gcc/gcc-2.95.3/gcc/include/types/vxANSI.h:45,
from
/us/norman/gcc/gcc-2.95.3/gcc/include/types/vxTypes.h:63,
from
/us/norman/gcc/lib/gcc-lib/powerpc-wrs-vxworks/2.95.3/../../../../powerpc-wrs-vxworks/sys-include/sys/types.h:39,
from getpagesize.c:33:
/us/norman/gcc/gcc-2.95.3/gcc/include/types/vxArch.h:46: warning:
`_BIG_ENDIAN' redefined
*Initialization*:1: warning: this is the location of the previous
definition
getpagesize.c:35: sys/param.h: No such file or directory

Edit the config.h file again, undefing the HAVE_SYS_PARAM.

$ make cross

[Error # 5]

/us/norman/gcc/gcc-2.95.3/gcc/xgcc -B/us/norman/gcc/gcc-2.95.3/gcc/
-B/us/norman/gcc/powerpc-wrs-vxworks/bin/ -c -DHAVE_CONFIG_H -g -O2
-I. -I./../../include vasprintf.c
In file included from
/us/norman/gcc/gcc-2.95.3/gcc/include/types/vxANSI.h:45,
from
/us/norman/gcc/gcc-2.95.3/gcc/include/stdio.h:59,
from vasprintf.c:26:
/us/norman/gcc/gcc-2.95.3/gcc/include/types/vxArch.h:46: warning:
`_BIG_ENDIAN' redefined
*Initialization*:1: warning: this is the location of the previous
definition
In file included from
/us/norman/gcc/lib/gcc-lib/powerpc-wrs-vxworks/2.95.3/../../../../powerpc-wrs-vxworks/sys-include/arch/ppc/toolPpc.h:539,
from
/us/norman/gcc/lib/gcc-lib/powerpc-wrs-vxworks/2.95.3/../../../../powerpc-wrs-vxworks/sys-include/arch/ppc/archPpc.h:130,
from
/us/norman/gcc/gcc-2.95.3/gcc/include/types/vxArch.h:84,
from
/us/norman/gcc/gcc-2.95.3/gcc/include/types/vxANSI.h:45,
from
/us/norman/gcc/gcc-2.95.3/gcc/include/stdio.h:59,
from vasprintf.c:26:
/us/norman/gcc/gcc-2.95.3/gcc/include/va-ppc.h:75: warning: `va_start'
redefined
/us/norman/gcc/gcc-2.95.3/gcc/include/stdarg.h:96: warning: this is
the location of the previous definition

Edit gcc-2.95.3/libio/gen-params, setting
${macro_prefix}HAVE_PRINTF_FP and
${macro_prefix}HAVE_LONG_DOUBLE_IO to 0 in all cases.

$ make cross

[Error # 6]

/us/norman/gcc/gcc-2.95.3/gcc/xgcc -B/us/norman/gcc/gcc-2.95.3/gcc/
-B/us/norman/gcc/powerpc-wrs-vxworks/bin/ -c -DHAVE_CONFIG_H -g -O2
-I. -I./../../include vasprintf.c
In file included from
/us/norman/gcc/gcc-2.95.3/gcc/include/types/vxANSI.h:45,
from
/us/norman/gcc/gcc-2.95.3/gcc/include/stdio.h:59,
from vasprintf.c:26:
/us/norman/gcc/gcc-2.95.3/gcc/include/types/vxArch.h:46: warning:
`_BIG_ENDIAN' redefined
*Initialization*:1: warning: this is the location of the previous
definition
In file included from
/us/norman/gcc/lib/gcc-lib/powerpc-wrs-vxworks/2.95.3/../../../../powerpc-wrs-vxworks/sys-include/arch/ppc/toolPpc.h:539,
from
/us/norman/gcc/lib/gcc-lib/powerpc-wrs-vxworks/2.95.3/../../../../powerpc-wrs-vxworks/sys-include/arch/ppc/archPpc.h:130,
from
/us/norman/gcc/gcc-2.95.3/gcc/include/types/vxArch.h:84,
from
/us/norman/gcc/gcc-2.95.3/gcc/include/types/vxANSI.h:45,
from
/us/norman/gcc/gcc-2.95.3/gcc/include/stdio.h:59,
from vasprintf.c:26:
/us/norman/gcc/gcc-2.95.3/gcc/include/va-ppc.h:75: warning: `va_start'
redefined
/us/norman/gcc/gcc-2.95.3/gcc/include/stdarg.h:96: warning: this is
the location of the previous definition
/us/norman/gcc/gcc-2.95.3/gcc/include/va-ppc.h:191: warning: `va_arg'
redefined
/us/norman/gcc/gcc-2.95.3/gcc/include/stdarg.h:116: warning: this is
the location of the previous definition
/us/norman/gcc/gcc-2.95.3/gcc/include/va-ppc.h:196: warning:
`__va_copy' redefined
/us/norman/gcc/gcc-2.95.3/gcc/include/stdarg.h:120: warning: this is
the location of the previous definition
vasprintf.c: In function `int_vasprintf':
vasprintf.c:60: warning: dereferencing `void *' pointer
vasprintf.c:60: request for member `fpr' in something not a structure
or union


Alas, these muddy waters I have not been able to negotiate. It
appears that
__PPC__ is not defined when stdargs.h is included. But, including it
manually, as I have tried, just led to more problems...

Has anyone negotiated these waters and come out alive on the other
side?

Andy Sinclair

unread,
Jun 2, 2004, 12:06:23 PM6/2/04
to
Vic at Marconi wrote:
>I'm trying to compile gcc 2.95.3 on a linux box to produce a cross
>compiler from linux to powerpc, for vxworks. In other words:
>
>The result should be linux executables (i.e., programs to run on the
>linux box) that compile our software, producing powerpc executables to
>run on vxworks.
>
>I will give the details below, but the crux of the matter is: I cannot
>get gcc to compile successfully.
>
>Has anyone else out there tried this, and succeeded?

I have successfully compiled gcc for the powerpc-eabi target.

I see you have successfully compiled binutils, which is a good sign.

The second step in to build a bootstrap compiler.
You need to build gcc for C only (i.e. '--enable-languages=c').
The C++ compiler and the libraries require a working C cross compiler
in order to be built successfully.

Try that and report if you have any problems.

Also, have a look at these links.
http://billgatliff.com/twiki/bin/view/Crossgcc/
http://www.kegel.com/crosstool/

Regards
Andy Sinclair

0 new messages