Have problem with the toolchain

Investigation into how Linux on the PS3 might lead to homebrew development.

Moderators: cheriff, emoon

Post Reply
cchalpha
Posts: 9
Joined: Sun Feb 24, 2008 7:08 pm

Have problem with the toolchain

Post by cchalpha »

Built the toolchain on x86 host, but I have problem when I test it with the helloworld program. Any idea what happened?

Code: Select all

~# ppu-gcc -o test test.c 
test.c: In function 'main':
test.c:3: warning: incompatible implicit declaration of built-in function 'printf'
/usr/local/ps3dev/ppu/lib/gcc/ppu/4.2.0/../../../../ppu/bin/ld: crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status
cchalpha
Posts: 9
Joined: Sun Feb 24, 2008 7:08 pm

Post by cchalpha »

Add -v to gcc and generate detail info.

Code: Select all

:~# ppu-gcc -v -o test test.c 
Using built-in specs.
Target: ppu
Configured with: ../configure --prefix=/usr/local/ps3dev/ppu --target=ppu --enable-languages=c,c++ --with-newlib --enable-cxx-flags=-G0 --disable-libgomp --disable-libmudflap --disable-nls --disable-shared --disable-threads
Thread model: single
gcc version 4.2.0
 /usr/local/ps3dev/ppu/libexec/gcc/ppu/4.2.0/cc1 -quiet -v -D__unix__ -D__gnu_linux__ -D__linux__ -Dunix -D__unix -Dlinux -D__linux -Asystem=linux -Asystem=unix -Asystem=posix test.c -quiet -dumpbase test.c -auxbase test -version -o /tmp/cceAgKQd.s
ignoring nonexistent directory "/usr/local/ps3dev/ppu/lib/gcc/ppu/4.2.0/../../../../ppu/sys-include"
#include "..." search starts here:
#include <...> search starts here&#58;
 /usr/local/ps3dev/ppu/lib/gcc/ppu/4.2.0/include
 /usr/local/ps3dev/ppu/lib/gcc/ppu/4.2.0/../../../../ppu/include
End of search list.
GNU C version 4.2.0 &#40;ppu&#41;
	compiled by GNU C version 4.2.3 &#40;Ubuntu 4.2.3-1ubuntu2&#41;.
GGC heuristics&#58; --param ggc-min-expand=73 --param ggc-min-heapsize=80642
Compiler executable checksum&#58; 6188bd1ffaf4ee136cf930e05feb79ff
test.c&#58; In function 'main'&#58;
test.c&#58;3&#58; warning&#58; incompatible implicit declaration of built-in function 'printf'
 /usr/local/ps3dev/ppu/lib/gcc/ppu/4.2.0/../../../../ppu/bin/as --traditional-format -a64 -mppc64 -many -V -Qy -o /tmp/cc8oQRMk.o /tmp/cceAgKQd.s
GNU assembler version 2.17 &#40;ppu&#41; using BFD version 2.17
 /usr/local/ps3dev/ppu/libexec/gcc/ppu/4.2.0/collect2 --eh-frame-hdr -V -Qy -m elf64ppc -dynamic-linker /lib64/ld64.so.1 -o test crt1.o crti.o /usr/local/ps3dev/ppu/lib/gcc/ppu/4.2.0/crtbegin.o -L/usr/local/ps3dev/ppu/lib/gcc/ppu/4.2.0 -L/usr/local/ps3dev/ppu/lib/gcc/ppu/4.2.0/../../../../ppu/lib/../lib64 -L/usr/local/ps3dev/ppu/lib/gcc/ppu/4.2.0/../../../../ppu/lib /tmp/cc8oQRMk.o -lgcc -lc -lgcc /usr/local/ps3dev/ppu/lib/gcc/ppu/4.2.0/crtsavres.o /usr/local/ps3dev/ppu/lib/gcc/ppu/4.2.0/crtend.o crtn.o
GNU ld version 2.17
  Supported emulations&#58;
   elf64ppc
   elf32ppclinux
   elf32ppc
   elf32ppcsim
/usr/local/ps3dev/ppu/lib/gcc/ppu/4.2.0/../../../../ppu/bin/ld&#58; crt1.o&#58; No such file&#58; No such file or directory
collect2&#58; ld returned 1 exit status
unsolo
Posts: 155
Joined: Mon Apr 16, 2007 2:39 am
Location: OSLO Norway

Post by unsolo »

what platform and why 4.2.0
Don't do it alone.
cchalpha
Posts: 9
Joined: Sun Feb 24, 2008 7:08 pm

Post by cchalpha »

unsolo wrote:what platform and why 4.2.0
I'm using ubuntu 8.04 on x86 pentium M, and the 4.2.0 is the right version according to the toolchain scripts for ppu, you can see 002-gcc-4.2.0-ppu-stage1.sh in scripts folder.
ouasse
Posts: 80
Joined: Mon Jul 30, 2007 5:58 am
Location: Paris, France

Post by ouasse »

you used the toolchain for otheros, which has neither support for libc nor newlib. You may only be able to use the toolchain for compiling kernels or the otheros demo.
cchalpha
Posts: 9
Joined: Sun Feb 24, 2008 7:08 pm

Post by cchalpha »

ouasse wrote:you used the toolchain for otheros, which has neither support for libc nor newlib. You may only be able to use the toolchain for compiling kernels or the otheros demo.
I downloaded it from http://ps2dev.org/ps3/Tools/Toolchain/p ... 26.tar.bz2, I also tried the svn one, is it only for otherOS dev?
IronAvatar
Posts: 23
Joined: Sat Nov 25, 2006 5:53 am

Post by IronAvatar »

I've finaly gotten my PS3 running Linux and setup with the IBM cell sdk.

If you're using Ubuntu, you should be able to install the compiler from the BSCC by doing something like;

Code: Select all

sudo apt-get install ppu-g++ spu-g++ ppu-gdp spu-gdb cell-programming-primer
And be able to cross compile without any problems to run on a linux box. I haven't personaly tried this yet though, instead I'm using ssh to connect to my PS3 and call make from the command line which uses the CBE version of the IBM Cell SDK.

I edit the code on my PC though by using a folder shared with Samba.

The reason I'm doing it this way, is because I can't be bothered/don't yet know how to cross-compile the necessary support libraries (X11 dev, SDL, libc etc.) that I need. But because all that stuff is pre-built on my PS3, it's just easier to compile via ssh :)
cchalpha
Posts: 9
Joined: Sun Feb 24, 2008 7:08 pm

Post by cchalpha »

Thanks IronAvatar. I'll try your commands when I back home tonight.
ooPo
Site Admin
Posts: 2023
Joined: Sat Jan 17, 2004 9:56 am
Location: Canada
Contact:

Post by ooPo »

The ps3toolchain, which is used for otheros development, has support for newlib but it doesn't have an OS added yet. This means there's no startup code, which is why it can't find crt*.o. You can find some startup code in the otheros demo.

As for Ubuntu:
danpeori@yggdrasil:~$ apt-cache search ppu-
ppu-binutils - PPU assembler, linker and binary utilities
ppu-g++ - PPU C++ compiler
ppu-gcc - PPU C compiler
ppu-gdb - Combined debugger for Linux on Cell BE
ppu-gfortran - PPU Fortran compiler
ppu-gnat - PPU Ada compiler
ppu-sysroot - Cell Broadband Engine (CBE) Cross-Compile System Root
ppu-sysroot64 - PPU cross-sysroot (64-bit)

danpeori@yggdrasil:~$ apt-cache search spu-
spu-binutils - SPU assembler, linker and binary utilities
spu-g++ - SPU cross-compiler (C++ compiler)
spu-gcc - SPU cross-compiler (preprocessor and C compiler)
spu-gdb - SPU stand-alone debugger
spu-gfortran - SPU cross-compiler (Fortran compiler)
spu-newlib - SPU C library
That's fantastic! I had no idea it was there.
IronAvatar
Posts: 23
Joined: Sat Nov 25, 2006 5:53 am

Post by IronAvatar »

Yeah, not many people know about it. I just happened to come accross it when looking for some advice on installing the IDM sdk on non RH/Fedora.

ooPo...sort of wondering where you got the inspiration for your hostname. Was it;

1) Norse Mythology
2) First Linux distro on CD
3) Name of a character from the first PS2 game that I worked on

(I'm betting that it wasn't 3)
cchalpha
Posts: 9
Joined: Sun Feb 24, 2008 7:08 pm

Post by cchalpha »

It works, type

aptitude search ppu-
and
aptitude search spu-

and you will have a list of ppu/spu related packages, and I am sure which ones should be installed, :D
cchalpha
Posts: 9
Joined: Sun Feb 24, 2008 7:08 pm

Post by cchalpha »

Here are the packages I installed

Code: Select all

 aptitude search ppu-
i   ppu-binutils                    - PPU assembler, linker and binary utilities
i   ppu-g++                         - PPU C++ compiler                          
i   ppu-gcc                         - PPU C compiler                            
i   ppu-gdb                         - Combined debugger for Linux on Cell BE    
p   ppu-gfortran                    - PPU Fortran compiler                      
p   ppu-gnat                        - PPU Ada compiler                          
i   ppu-sysroot                     - Cell Broadband Engine &#40;CBE&#41; Cross-Compile 
i A ppu-sysroot64                   - PPU cross-sysroot &#40;64-bit&#41;                

 aptitude search spu-
i   spu-binutils                    - SPU assembler, linker and binary utilities
i   spu-g++                         - SPU cross-compiler &#40;C++ compiler&#41;         
i   spu-gcc                         - SPU cross-compiler &#40;preprocessor and C com
i   spu-gdb                         - SPU stand-alone debugger                  
p   spu-gfortran                    - SPU cross-compiler &#40;Fortran compiler&#41;     
i   spu-newlib                      - SPU C library                             
And the test helloworld program compiled and linked.

Code: Select all

file test
test&#58; ELF 64-bit MSB executable, 64-bit PowerPC or cisco 7500, version 1 &#40;SYSV&#41;, for GNU/Linux 2.6.8, dynamically linked &#40;uses shared libs&#41;, not stripped
Post Reply