Cross compiler, x86-linux -> powerpc-wrs-vxworks, MPC860, gcc trouble
Kai Ruottu
kai.ruottu@luukku.com
Fri Apr 12 07:43:00 GMT 2002
Leif Rune Solas wrote:
>
> Hi,
> I am trying to set up an powerpc-wrs-vxworks compiler hosted on a linux pc.
> My target is a MBX860 board. The cross compiler seems to have been compiled
> and installed without errors, I have used binutils 2.11.2, and gcc-2.95.3.
> Gcc was configured and installed like this:
>
> ../gcc-2.95.3/configure --target=powerpc-wrs-vxworks --enable-
> long-long --with-headers=/usr/tornado/target/h --enable-languages=c,c++
Did you use the VxWorks headers 'unfiltered' ? What I have seen, they have
the C and C++ headers mixed into a mess, so one must know which ones belong
to the 'standard C headers' and which ones into the 'C++ headers'. A 'normal'
GCC-install puts these into separate directories, the VxWorks-install is not
'normal' in any sense...
The result from this may be that the old C++ headers in the VxWorks-stuff
may be found before the newer headers in the GCC-sources...
> To make it compile I had to do some small changes to libio:
> < ostream& vform(const char *format, _IO_va_list args);
> ---
> > ostream& vform(const char *format, void * args);
>
> in streambuf.h and iostream.h, I substituted _IO_va_list with void * four
> places.
Were these from the GCC-sources or from the VxWorks headers ? The latter
should never be used...
> When compiling one of my applications after doing "make all install", this
> happens and I do not understand clearly why:
>
> ---- from my shell -------------
> # make depend
> make[1]: Entering directory `/home/leifs/apps/KeyUtil/MrKeyUtil/obj.mbx'
> powerpc-wrs-vxworks-g++ -c -mcpu=860 -fvolatile -Wall -D_MBX -D__USE_MALLOC
> -fno-builtin -msoft-float -fno-exceptions -fno-rtti
> -I../../tornado/target/config -I../.. -O6 -DGZ -DGS_STATUS -I.. ../App.cxx
> In file included from
> /usr/local/lib/gcc-lib/powerpc-wrs-vxworks/2.95.3/include/types/vxANSI.h:44,
> from
> /usr/local/lib/gcc-lib/powerpc-wrs-vxworks/2.95.3/include/stdio.h:59,
> from ../../MD-DES/des.h:75,
> from ../App.h:3,
> from ../App.cxx:5:
> /usr/local/lib/gcc-lib/powerpc-wrs-vxworks/2.95.3/include/types/vxCpu.h:200:
> #error CPU is not defined correctly
In your case the "#define CPU PPC860" should have been existed is some earlier
header, or the '-mcpu=860' should cause a '-DCPU=PPC860' in 'specs' (for 'cpp') :
-------------------- a clip from vxCpu.h -----------------------------
#if (CPU==PPC403 || CPU==PPC505 || CPU==PPC601 || CPU==PPC603 || \
CPU==PPC604 || CPU==PPC860)
#define CPU_FAMILY PPC
#endif /* CPU_FAMILY==PPC */
/*
* Check that CPU and CPU_FAMILY are now defined correctly.
* If CPU is defined to be one of the above valid values then
* the CPU_FAMILY will have been properly selected.
* This is required in order to select the right headers
* and definitions for that CPU in subsequent headers.
* If CPU or CPU_FAMILY is not defined at this point,
* we generate an error and abort the compilation.
*/
#if !defined(CPU) || !defined(CPU_FAMILY)
#error CPU is not defined correctly
#endif
-------------------- a clip from vxCpu.h -----------------------------
> So, it says that the cpu is not defined correctly and it complaints about
> some missing files. I do not understand why the cpu is not defined since the
> configure command should be OK, and why is it asking for files in arch/mips/
> which is not there? Has gcc somehow mixed ppc and mips due to error in the
> configuration?
The reason is simple: The '-mcpu=860' doesn't trigger the needed '-DCPU=PPC860'
in 'specs'. So there is an error in the gcc-2.95.3 configuration stuff, in the
file 'gcc/config/rs6000/vxppc.h' :
----------------------------------- clip ------------------------------
#undef CPP_SPEC
#define CPP_SPEC "%{posix: -D_POSIX_SOURCE} %(cpp_sysv) %(cpp_endian) %(cpp_cpu) \
%{mads: %(cpp_os_ads) } \
%{myellowknife: %(cpp_os_yellowknife) } \
%{mmvme: %(cpp_os_mvme) } \
%{msim: %(cpp_os_sim) } \
%{mcall-linux: %(cpp_os_linux) } \
%{mcall-solaris: %(cpp_os_solaris) } \
%{!mads: %{!myellowknife: %{!mmvme: %{!msim: %{!mcall-linux: %{!mcall-solaris: %(cpp_os_default) }}}}}} \
%{!DCPU=*: \
%{!mcpu*: -DCPU=PPC603} \
%{mcpu=powerpc: -DCPU=PPC603} \
%{mcpu=403: -DCPU=PPC403} \
%{mcpu=601: -DCPU=PPC601} \
%{mcpu=603: -DCPU=PPC603} \
%{mcpu=604: -DCPU=PPC604} \
%{mcpu=860: -DCPU=PPC860}}"
----------------------------------- clip ------------------------------
Modifying the CPP_SPEC being like previously should fix the bug permanently, but
when you already have installed, editing the:
/usr/local/lib/gcc-lib/powerpc-wrs-vxworks/2.95.3/specs
is much easier... Just search for '*cpp:' and the spec after it and add the
needed '%{mcpu=860: -DCPU=PPC860}' between the last two '}'s...
However I suggest you to fix the bug in the sources...
Oops, after writing all this, I got a thought to check the 'gcc-3.0.4' sources
and there ('gcc/config/rs6000/sysv4.h') I saw:
----------------------------------- clip ------------------------------
#define CPP_OS_VXWORKS_SPEC "\
-DCPU_FAMILY=PPC \
%{!mcpu*: \
%{mpowerpc*: -DCPU=PPC603} \
%{!mno-powerpc: -DCPU=PPC603}} \
%{mcpu=powerpc: -DCPU=PPC603} \
%{mcpu=401: -DCPU=PPC403} \
%{mcpu=403: -DCPU=PPC403} \
%{mcpu=601: -DCPU=PPC601} \
%{mcpu=602: -DCPU=PPC603} \
%{mcpu=603: -DCPU=PPC603} \
%{mcpu=603e: -DCPU=PPC603} \
%{mcpu=ec603e: -DCPU=PPC603} \
%{mcpu=604: -DCPU=PPC604} \
%{mcpu=604e: -DCPU=PPC604} \
%{mcpu=620: -DCPU=PPC604} \
%{mcpu=740: -DCPU=PPC603} \
%{mcpu=750: -DCPU=PPC603} \
%{mcpu=801: -DCPU=PPC603} \
%{mcpu=821: -DCPU=PPC603} \
%{mcpu=823: -DCPU=PPC603} \
%{mcpu=860: -DCPU=PPC603}"
----------------------------------- clip ------------------------------
Perhaps the '-mcpu=860' implying '-DCPU=PPC603' has some important reason...
So using it instead could be a better choice. Perhaps the 'comp.sys.powerpc.tech'
newsgroup or something would tell more, now I remember seeing something... or then
not...
Cheers, Kai
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
More information about the crossgcc
mailing list