Plasma demo

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

Moderators: cheriff, emoon

Post Reply
ralferoo
Posts: 122
Joined: Sat Mar 03, 2007 9:14 am
Contact:

Plasma demo

Post by ralferoo »

I was a bit bored this evening, so I knocked together a quick plasma demo (as used to be popular on the Amiga) available at the usual place: http://www.ranulf.net/ps3/

Seems to run fine at 30fps in 720p but doesn't quite do things fast enough to run at 1080i at 30fps. Then again, I've not even bothered optimising it nor am I ever likely to...The only reason I wrote this was because I realised it's been an awfully long time since I've seen a plasma and so it was just a bit of reminiscing really!
edepot
Posts: 111
Joined: Sat Apr 09, 2005 3:39 pm

binary

Post by edepot »

Do you have a binary with that? I think the problem with the ps3 linux is that it is so new and the development environment takes lots of tweaking, installing, or updating of
dependent packages in order to compile your program. I am sure lots of people have different settings than you do and since there are no instructions stating what versions
of the compiler you are using, it is a hit or miss trying to make your program compile.
Maybe you can include a binary with your download. If you wish to include the source,
maybe include a readme with the packages you have installed (instructions on
installing would be nice too starting with a blank YDL)

I tried to compile it but it got stuck in quite a few places, and I happen to have the latest
SPE2.

[root@localhost plasma]# make test
gcc -c main.cpp -o main.o
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
make: *** [main.o] Error 1

So maybe a binary to start!
ralferoo
Posts: 122
Joined: Sat Mar 03, 2007 9:14 am
Contact:

Post by ralferoo »

Looks to me as if your g++ installation is broken as cc1plus is critical to building any C++ program.

Possibly, it's simply a case that you don't have the correct gcc in your path. In that case, either add it to the path and run again, or add the path directly in front of the gcc part in the following lines in the Makefile (an example below, although I just made the paths up - yours will almost certainly be somewhere else!)

Code: Select all

PPUCC = /opt/cell/ppu/bin/gcc
SPUCC = /opt/cell/spu/bin/spu-gcc
It's possible your gcc is called ppu-gcc too. You might also want to change gcc to g++ to see if that fixes your problems.

I can upload a binary tonight, although not at the moment as I'm at work!
ralferoo
Posts: 122
Joined: Sat Mar 03, 2007 9:14 am
Contact:

Post by ralferoo »

Regarding my installation, it's a standard RH install as documented at http://ps3.qj.net/PS3-Linux-The-void-ha ... /aid/73144 with the libspe packages and the SBE toolchains installed as provided by the Barcelona Supercomputer Center http://www.bsc.es/projects/deepcomputing/linuxoncell/

I don't have any installation instructions myself, as I just followed the instructions I found on these sites.

Personally, I can't really stand using Red Hat / Fedora Core, so at some point I'll install make instructions for installing a Debian based system, although I have other priorities right now...
ralferoo
Posts: 122
Joined: Sat Mar 03, 2007 9:14 am
Contact:

Post by ralferoo »

The plain binary file is available at http://www.ranulf.net/ps3/plasma

It has quite a dependency on a lot of libraries, which may or may not be the same on your distribution of Linux (which is why source distribution is probably easiest for most people), although feedback of which distributions of Linux this runs under would be interesting...

Code: Select all

[root@localhost plasma]# ldd main
        linux-vdso32.so.1 =>  (0x00100000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x0ee20000)
        libm.so.6 => /lib/libm.so.6 (0x0f4d0000)
        libc.so.6 => /lib/libc.so.6 (0x0f5b0000)
        libspe.so.1 => /usr/lib64/libspe.so.1 (0x0ff90000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x0f2a0000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x0ef50000)
        /lib/ld.so.1 (0x0ffc0000)
        librt.so.1 => /lib/librt.so.1 (0x0fb80000)
edepot
Posts: 111
Joined: Sat Apr 09, 2005 3:39 pm

Your binary.

Post by edepot »

Can you recode your plasma demo so that it does not use .so but static binaries like .a?
That way all the required code is compiled into your program and people need not
worry about whether theyhave installed the correct version of a .so library on their
machines.

Is it even possible to force the compiler to take code from a .so library and static link
it into the code? I think that would solve lots of people's problems of distributing their
program to run on all the PS3 linux. I notice that stdc++ library has a .so extension.
does that mean people must have that installed to run it? is there a way around that?


In the ps3lines I made the libraries I used were static (.a), I think this
should take care of letting it run on all ps3 linux distributions regardless of whether
the user has installed the correct packages or not. maybe you can try it out again.
This time I added sound.
ralferoo
Posts: 122
Joined: Sat Mar 03, 2007 9:14 am
Contact:

Post by ralferoo »

At the time of posting the binary, I had considered it. However, static linking turned the 40k binary to a 600k monster, and frankly this is ridiculous for a demo with about 6k of source.

Sure, I could have spent some time pulling out just the functions I needed but to be honest, I think it's not an avenue I want to go down at this stage.

The point of releasing the demo wasn't particularly so people could run it and think "wow that looks pretty" and look at it for maybe 30 seconds before moving on. It's more that, as I understand it at least, everyone on this forum is interested in developing for the PS3 under Linux and it's some source that demonstrates some methods for how to do that. When I was starting on the PS3, I desperately wanted some source that actually did what it claimed to do in the article.

Now, given that we're all developers here, it stands to reason that we should be able to compile and build things for the PS3, and to be honest, the only thing I used that wasn't supplied as standard with gcc is libspe and the spu_mfcio stuff. To be honest, if you're doing any PS3 development, you need this stuff to be present, so it's fair to say that everyone should be able to compile and run my demo if they have installed the toolchains correctly.

This goes back to my point. The error message your system gave shows that either g++ isn't installed correctly on your machine or you have several version of gcc installed (not uncommon, many systems have gcc 2.9.7 for compiling the kernel, for instance) and you're using the wrong one. However, if you're doing PS3 development, you should be able to use the same setup you've already got. Obviously, this might require tweaking of the Makefile, but that shouldn't be beyond you.

I think for the time being when everyone on this forum is interested in developing under Linux, we should all get to the point where we can build each others sources, particularly when there's nothing non-standard being used.

As and when the focus of my releases moves from being something for developers to something for end users, I'll consider how to package it up to make it easy for everyone (and in fact, that's a seperate project I'm thinking about already), but at the moment I'm distributing source code because that's what's going to help people learn.
edepot
Posts: 111
Joined: Sat Apr 09, 2005 3:39 pm

got it working

Post by edepot »

I ended up needing to point to ppu-gcc (or something like that)
in the makefile instead of gcc to get it working. that is a nice program.
I may incorporate the spe to do some fancy stuff too. did you use the
newest version of the sdk? spe2?

how do you force a .so to statically link to a program on linux?
Post Reply