DS.rs = [[an error occurred while processing this directive]]

Building the Cell SDK from upstream

This guide follows that at Jeremy Kerr's place.

However, this is for GCC 4.8, binutils 2.23.2, and newlib-2.0.0.

Be forewarned that this is (my memory and logs of) how I really did it, not how it perhaps ought to be done.

Build GNU binutils

  1. Get binutils from its download site
  2. tar -xzf binutils-2.23.2.tar.gz
  3. mkdir binutils-2.23.2-spu
  4. cd binutils-2.23.2-spu
  5. ./configure --enable-lto --disable-werror --program-prefix=spu- --target=spu-elf
  6. make
  7. make install
    (I actually used DESTDIR= make install to install it to a different location and manage it using something like stow)

Build GCC the first time

  • Get GCC from a mirror
  • tar -xjf gcc-4.8.0.tar.bz2
  • mkdir gcc-4.8.0-spu
  • cd gcc-4.8.0-spu
  • ../gcc-4.8.0/configure --enable-lto --build=powerpc-unknown-linux-gnu --host=powerpc-unknown-linux-gnu --program-suffix=-4.8 --enable-threads=posix --disable-libgcj --enable-languages=c,c++ --disable-threads --disable-checking --with-system-zlib --disable-libssp --program-prefix=spu- --target=spu --with-as=/usr/local/bin/spu-as --with-ld=/usr/local/bin/spu-ld
    (I should have excluded c++; it's not supported anyway)
  • The build will fail. See this link for a similar situation. The problem is that we don't have a libc yet, so it can't link a final program. The C compile works anyway.
  • make all-gcc
  • make install
  • Build newlib (libc)

    1. Get newlib from their site
    2. tar -xzf newlib-2.0.0.tar.gz
    3. mkdir newlib-2.0.0-spu
    4. cd newlib-2.0.0-spu
    5. CFLAGS='-Os -pipe -mea32' CXXFLAGS='-Os -pipe -mea32' ../newlib-2.0.0/configure --enable-lto --target=spu
    6. make
    7. make install

    Rebuild GCC with libc

  • Get GCC from a mirrot
  • mkdir gcc-4.8.0-spu-full
  • cd gcc-4.8.0-spu-full
  • ../gcc-4.8.0/configure --enable-lto --disable-threads --disable-checking --with-system-zlib --enable-languages=c --disable-libssp --program-prefix=spu- --target=spu --program-suffix=-4.8 --with-as=/usr/local/bin/spu-as --with-ld=/usr/local/bin/spu-ld
  • make
  • make install
  • cd ${install_location}/lib/gcc
  • for file in /usr/local/spu/lib/*; do ln -s $file; done
  • The last step in the full GCC build is to ensure that the SPU crt1.o and friends can be found. If you don't do it, you'll end up with an error about not finding crt1.o and crti.o when you build any sort of SPE program. (I only tried with with a Hello World SPU program)

    I also built gcc 4.8 for the PPU, but that's very similar.

    I successfully built libspe2 using gcc 4.8 since it was a bit later than what Gentoo provided.

    I also successfully built spu-tools, though they didn't run successfully.

    Testing thus far is only with a Hello World program that outputs &dquot;PPU side!&dquot; on the PPU and &dquot;SPU side!&dquot; on the SPU.

    Page last modified Thursday, 30-May-2013 21:32:00 EDT