This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


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

Re: Building GCC 2.95.2 for VxWorks (powerpc)


Paul,

I have this same setup and have developed a shell script to build the tool set for
me.

I have defined a directory structure as such:
[src]$ ls -l vxbuild
vxbuild:
gnu-chain
my_config

vxbuild/gnu-chain:
build           -- the docs suggest building the tool chain in a directory separate
from the source
src              -- unpacked sources

vxbuild/gnu-chain/build:
binutils-2.10.1
gcc-2.95.2

vxbuild/gnu-chain/build/binutils-2.10.1:

vxbuild/gnu-chain/build/gcc-2.95.2:

vxbuild/gnu-chain/src:
binutils-2.10.1
gcc-2.95.2

vxbuild/my_config:
vxppc_bld.sh

My script requires that the sources be unpacked in the "gnu-chain/src" directory.
The shell script is named
"vxppc_bld.sh" and exists in the "my_config" directory.  You have to edit the
script once you get it to
change a few variables:

1) modify BINUT_DIR to match the unpacked source directory of the binutils.  I have
it defined as
binutils-2.10.1

2) modify GCC_DIR to match the unpacked source directory of the gcc you are using.
I have it defined
as gcc-2.95.2

3) next modify the MY_HOST variable to match the machine you are running on.  I
have it defined as
i586-pc-linux-gnu

4) modify the MY_TARGET variable to match the architecture you are targeting with
you cross
development tools.  I had it defined as powerpc-wrs-vxworks.

5) modify the BASE_DIR variable to where you have setup the aforementioned
directory structure.  I
have set it to /src/vxbuild

6) finally modify the INSTALL_DIR and VXW_HDRS variables to point at your
installation of
VxWorks.  I have VxWorks 5.3.1 and it is installed at /usr/wind.  Therefore I have
the INSTALL_DIR
setup so that my linux tool set is rooted in the same place as the one for the
SPARC which is
/usr/wind/host/$MY_HOST.  The VXW_HDRS is setup to copy the needed VxWorks header
files from
/usr/wind/target/h.

It takes a lot of setup time but, if you make a mistake all you have to do is edit
the file and run it again.  As
opposed to typing it all in at the command line.  I'm sorry if this seems verbose,
but I am trying to be
precise.  I would be glad to try and answer/clarify any questions you have.  I am
running stock RedHat
6.1.  Note. The --with-newlib does not really install or use newlib.  As you can
see by the fact that the
script does not build or install the software.  The software sources for newlib do
not even exist on the
machine I build on.  The C++ compiler has built successfully many times but.  I
have never tried to
cross compile C++ code for my target.  Also, when compiling C source code for my
target the
preprocessor gives warnings of redefined preprocessor directives.  Even with these
warnings the code
works on the target.

Hope that helps,

    Ryan Maples

Here is the script:

[my_config]$ cat vxppc_bld.sh
#!/bin/bash
#
# Build Script for VxWorks dev tools under linux
#
#
########################################################################


#
# Define where all the pieces are and where they
# they are going to
########################################################################
BINUT_DIR=binutils-2.10.1
GCC_DIR=gcc-2.95.2
GDB_DIR=insight+dejagnu-20000428
MY_HOST=i586-pc-linux-gnu
MY_TARGET=powerpc-wrs-vxworks

BASE_DIR=/src/vxbuild
TOOLS_DIR=$BASE_DIR/gnu-chain
BUILD_DIR=$TOOLS_DIR/build
SRC_DIR=$TOOLS_DIR/src
MY_CONFIG=$BASE_DIR/my_config

INSTALL_DIR=/usr/wind/host/$MY_HOST
VXW_HDRS=/usr/wind/target/h


#
# Now Build the tools
########################################################################

# Build binutils
mkdir -p $BUILD_DIR/$BINUT_DIR
cd $BUILD_DIR/$BINUT_DIR
$SRC_DIR/$BINUT_DIR/configure -v \
 --prefix=$INSTALL_DIR \
 --exec-prefix=$INSTALL_DIR \
 --target=$MY_TARGET 2>&1 | tee configure.out

make -w all install 2>&1 | tee make.out

# Set path so that binutils for the target can be found
export PATH=$INSTALL_DIR/bin:$PATH

# Build gcc
mkdir -p $BUILD_DIR/$GCC_DIR
cd $BUILD_DIR/$GCC_DIR
$SRC_DIR/$GCC_DIR/configure -v \
 --prefix=$INSTALL_DIR \
 --exec-prefix=$INSTALL_DIR \
 --with-gnu-as --with-gnu-ld --with-newlib \
 --with-headers=$VXW_HDRS \
 --target=$MY_TARGET 2>&1 | tee configure.out

make -w all-gcc install-gcc LANGUAGES="c c++ java" 2>&1 | tee make.out

## Build gdb
#cd $BUILD_DIR/$GDB_DIR
#$SRC_DIR/$GDB_DIR/configure -v \
# --prefix=$INSTALL_DIR/$MY_HOST \
# --exec-prefix=$INSTALL_DIR/$MY_HOST \
# --target=$MY_TARGET 2>&1 | tee configure.out
#
## --prefix=$INSTALL_DIR/H-$MY_HOST \
#make -w all install 2>&1 | tee make.out

#
# That's it...
########################################################################






"Paul D. Smith" wrote:

> I have VxWorks 5.3.1, with GCC 2.7.2 with host Solaris and target
> PowerPC (PPC603, or powerpc-eabi).  I do not have the source from WRS
> for this version of GCC; I can't find anyone at WRS who will tell me how
> to get it :-/.  I'm still trying.
>
> Anyway, I need to build GCC 2.95.2 for this same target, but on host
> Linux instead of Solaris.
>
> I've checked the mailing list archives, the crossgcc FAQ, and GCC site's
> instructions, etc. but I'm still having troubles.
>
> I built and installed binutils 2.10.1 (--target=powerpc-wrs-vxworks) and
> that went fine.
>
> Then I tried to build GCC 2.95.2.  I don't want to use newlib, I want to
> use the stuff from WRS--is this possible?
>
> What I did was create $prefix/powerpc-wrs-vxworks/sys-include as a
> symlink pointing to the headers that came with the old GCC 2.7.2
> compiler for host Solaris.
>
> Then I configured it like this:
>
>   $ ../gcc-2.95.2/configure --target=powerpc-wrs-vxworks \
>          --enable-languages=c,c++ --enable-version-specific-runtime-libs
>          --with-gnu-as --with-gnu-ld --prefix=$prefix
>
> That seemed to work.
>
> I ran "make", and I hit the failure in fdmatch, etc. which I found
> referenced in Tony Farrell's message to this list of 20 Jul 2000,
> subject "Notes on building gcc-2.95.2 for VxWorks 5.2, 68k", and fixed
> it as recommended there, by adding an #include <types/vxTypesOld.h>.
>
> Then libiberty built, but now I'm getting this error in libio/iovfprintf.c:
>
>   ../../../gcc-2.95.2/libio/iovfprintf.c: In function `_IO_vfprintf':
>   ../../../gcc-2.95.2/libio/iovfprintf.c:292: parse error before `int'
>   ../../../gcc-2.95.2/libio/iovfprintf.c:305: parse error before `int'
>   ../../../gcc-2.95.2/libio/iovfprintf.c:346: parse error before `int'
>   ../../../gcc-2.95.2/libio/iovfprintf.c:355: parse error before `long'
>   ../../../gcc-2.95.2/libio/iovfprintf.c:369: parse error before `double'
>   ../../../gcc-2.95.2/libio/iovfprintf.c:419: parse error before `long'
>   ../../../gcc-2.95.2/libio/iovfprintf.c:429: parse error before `unsigned'
>   ../../../gcc-2.95.2/libio/iovfprintf.c:441: parse error before `void'
>   ../../../gcc-2.95.2/libio/iovfprintf.c:447: parse error before `char'
>   ../../../gcc-2.95.2/libio/iovfprintf.c:471: parse error before `unsigned'
>   ../../../gcc-2.95.2/libio/iovfprintf.c:476: parse error before `unsigned'
>
> These apparently correspond to uses of va_arg()!
>
> Note I need both C _and_ C++, so I can't just punt libio.
>
> It seems to be a Very Bad Thing if stdarg.h is not set up correctly for
> this system, somehow!
>
> I've actually since tried building this same set of code in the same way
> on a Solaris (2.7) host instead of Linux, and it fails with the same
> errors there as well.
>
> Can anyone point out where I may have gone wrong, or what I can do to
> fix or further investigate this problem?
>
> Thanks...!
>
> --
> -------------------------------------------------------------------------------
>  Paul D. Smith <psmith@baynetworks.com>    HASMAT--HA Software Methods & Tools
>  "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
> -------------------------------------------------------------------------------
>    These are my opinions---Nortel Networks takes no responsibility for them.
>
> ------
> 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]