Installing the PSP toolchain in Ubuntu

(As all the guides I found out there were either outdated or specific to windows/cygwin, I decided to put this here just so that I remember how to do this next time I have to install the toolchain on another computer :-) )

First, check out the toolchain sources from svn://svn.ps2dev.org/psp/trunk/psptoolchain into say ~/tmp/psptoolchain:

mkdir ~/tmp/psptoolchain
cd ~/tmp/psptoolchain
svn co svn://svn.ps2dev.org/psp/trunk/psptoolchain .

Notice the svn:// and not http://, most tutorials are still using http://svn… and it won’t work.

Now read ~/tmp/psptoolchain/readme-ubuntu.txt. It tells you to make sure you have a series of packages installed; a pity they forgot to add a couple of packages (libmpfr-dev and libgmp3-dev). This is the full, updated list of packages to install:

sudo apt-get install build-essential autoconf automake bison flex \
  libncurses5-dev libreadline-dev libusb-dev texinfo libmpfr-dev \
  libgmp3-dev

with that and following the remaining instructions in the readme-ubuntu.txt file you should be able to get the toolchain installed in your computer. It will take some time depending on your processor etc, on my powerpc mac it takes a lot of time (in the order of hours), whereas in my brand new ubuntu machine with quad processor it took ~25 minutes, if I remember correctly.

So once it finishes, everything will be installed at /usr/local/pspdev. You might want to create a shortcut to the samples, which are in /usr/local/pspdev/psp/sdk/samples, but have a look at the other folders anyway, since the .h files are in there too and it’s good to know what you’re dealing with.

And this is entirely optional, but if you want to install SDL and other libraries, the easiest way I found is to use their psplibraries script. It is hosted in the same SVN repository so you just need to check it out:

mkdir ~/tmp/psplibraries
cd ~/tmp/psplibraries
svn co svn://svn.ps2dev.org/psp/trunk/psplibraries .

Again, there’s a readme-ubuntu.txt file; you might need to install libtool as specified there, and after that, simply run the libraries-sudo.sh file and let it work for a while since it needs to grab the sources for the libraries and build them.

Once that is finished too, the libraries will be also ready for your consumption and linkage inside the /usr/local/pspdev folder too, so everything is nice and clean. The guys at pspdev did a good job, kudos to them!

City Ambient EP (Live at BCN)

Comments

  • Thanks for the mini Howto, Sole. It works fine in my Debian for AMD 64. Greetings from Canary Islands :)

  • Ohh! I didn’t know you also read my blog :-)

    Thanks to you for reading! I’m glad it also works in Debian. Let’s give these psp’s some cool stuff to execute!

  • Nice and simple. Libs are the icing on the cake. Thanks.

  • Thank you so much for this, i searched around for ages trying to find what was needed to set this up. This guide is awesome. I love you…. so much.

  • that’s enthusiasm! thanks to you!

  • you should get a medal or something for this…

    I send you many internets

  • glad it’s useful :)

    What am I going to do with so many internets? :D

  • thanks, i redid my machine and this was much quicker and less painful than the first time i did it with someone else’s instructions

  • super! waiting for some psp homebrew apps developed in ubuntu, then ;-)

  • nice i really like ubuntu and first i did use windows for my psp homebrew but this works much easier

  • Hi,
    some month ago I’ve installed psptoolchain but something goes wrong (I can compile hello world but it doesn’t works).
    I try your guide but I can’t contact ‘svn.ps2dev.org’…
    What I should try ?

    Thanks!

  • I can’t help you if you don’t post the error message you get. You probably don’t have svn installed and that’s why you can’t contact the server. Other than that I can’t think of anything else…

  • Awesome tutorial, thanks! I wrote one for 7.04, but the install route has appearantly changed enough that that’s no longer valid. You saved me a good couple of hours, im sure.

    You should post this at psp-hacks development forum, they have a mega thread for setting up the environment, and the only linux install info there currently is my old thread.

    Thanks again!

  • just in case anyone here hits problems running psplibraries before they fix it, it is currently a little ill and bombs out in a few places.

    I posted the resolution here.
    http://forums.ps2dev.org/viewtopic.php?p=77896#77896

    I’m guessing ooPo will have it fixed on svn after the holidays. It’s just a few missing includes, libs, and a config.guess file.

  • Great Job! The Best tutorial, I couldn’t compile the toolchain after this tutorial, I did it!! Thanx a lot!!

  • Lui, I guess you meant you COULD compile it after the tuto :D

  • Thanks! It’s good to see a not-so-old tuto about this.

  • cool!

  • Hi Thanks a lot for this you’re right about nearly all the tutorils being for windows with cygwin etc.
    I realise this is a fairly old page, are all the links still correct? and will this work with the latest psp toolchain? I am going to do this as soon as i get latest ubuntu installed.
    Thanks a lot.

  • If you read the comments, you’ll see it seems to be working for people – at least back in April of 2009, so it seems to be still current. Not sure if you can call the advice fairly old then!

  • Yeah, good point ive just tried this and it was all going well until i ran the toolchain.sh where it said C compiler cannot create executables.
    So i’m a bit stuck, any suggestions?
    thanks very much for this tho, it is very helpful and easy to follow.
    oh, and it also said E: Couldn’t find package libgmp3-d when i tried to get that package.

  • Oh, i said in that post i was running toolchain.sh but i was actually running toolchain-sudo.sh as it says in the readme, should I be using toolchain.sh perhaps?

  • do you have gcc (the C compiler) installed on your system?

  • yes i have gcc 4.2.2
    I’ve just edited the toolchain-sudo.sh file to include:
    export CC=/usr/bin/gcc-4.2
    I think it may be an error specific to ubuntu 9.04 as this seems to have got past that stage, I’ll reply if it works.

  • hmm, that’s interesting! hope that works, and please let me know in any case. it’s good to know just in case we re-format :D

  • Yes, i think its worked but i’m not sure. Is there any way to check if it installed everything? i’ve not tried using it yet, will do soon…

  • What about trying to compile something? :P

  • Thanks for the info. I noticed my fresh install of ubuntu had gcc-4.3 so had to edit the toolchain-sudo.sh script for that, but everything else worked fine.

  • Thanks goodness I found that site :)
    It seems I won’t never do it and this saved my mind :)
    Thank alot.

    Greetings from Czech Republic :)

  • so far so good until the VERY last instruction:

    ## Build and install the toolchain + sdk.
    sudo ./toolchain-sudo.sh

    nathan@ps3-ubuntu:~/tmp/psptoolchain$ sudo ./toolchain-sudo.sh
    sudo: ./toolchain-sudo.sh: command not found

    GRRR!!! someone help please? :(

  • after reading above i see that newer versions of gcc are causing errors. i included

    export CC=/usr/bin/gcc-4.4

    in the toolchain-sudo.sh file, (my version is 4.4.1) and this allowed me to put my password in, instead of an instant error, and THEN it error’d with the same thing.

    argh :(

  • Sorry to hear that. Maybe they’ve changed the name of the script? It’s ages since I last installed this.

    Do a

    ls

    in that directory and see if there’s any .sh file. It might be what you need to execute now.

    Hope it works! Fingers crossed.

  • that didn’t work but i found out what was wrong. here’s a mini guide anyone installing this in the future, as you WILL come across these problems.

    1. readme-ubuntu.txt leaves out that when you add the exports to the end of bash.rc you will need to leave 1 blank line (hit enter 2x when cursor is at the end of the last line with text in it) between the exports and the previous end of the file,

    then after the end of the exports you will need to hit enter 1x (do not leave a blank line) and type:

    fi

    2. idk when the toolchain-sudo.sh file began requiring to know what version of gcc you have, but either way it’s left out of the readme entirely, so to find out which version you have, open a terminal and type:

    gcc -v

    get the first 2 numbers of your version, for example i have 4.4.1 so all i need is 4.4

    3. open toolchain-sudo.sh with any kind of text editor and add the line following line under the last export line:

    export CC=/usr/bin/gcc-4.4

    change 4.4 to the number you got from step #2

    4. now enter the last instruction from the readme file:
    sudo toolchain-sudo.sh

    =====================================
    thank you for hangin’ around so long after making the guide, sole

    this is an awesome 21st b-day present ;) i can now compile my daedalusx64 revs on my ps3

    p.s. you might want to add these steps to the OP if you can edit it. not many would think to scroll down to the comments for troubleshooting (took me half a year to figure that out lol)

  • Great to hear you could finally install it!!

    I might update it then. Or I might try and install it again just to make sure all steps are correct and the guide is current.

    Thanks a lot for the advice and fixes, and of course HAPPY BIRTHDAY!! :D

  • actually, scratch the second half of step 1

  • i still need 1 more thing yet before i can compile :(

    zlib

    how can i get this on linux?

    one of our devs says “use the psplibrairies scripts from ps2dev.org to install it.” but that’s too vague for me

  • sudo apt-get install zlib1g zlib1g-dev

    ?? does it work?

  • it installed but that’s apparently not what’s making the terminal complain =/

    see here for the full error list and scroll down to see what the dev(s) are saying

    http://forums.daedalusx64.com/viewtopic.php?f=12&t=2540

    i don’t want to spam your guide page with it lol

  • it just occurred to me that the dev from our forums are referring to “psplibraries” which is above in your OP.

    i’m going to run that and report back the result. i know how valuable feedback is lol

  • yay. the ‘optional’ part of your OP is what i needed (aka required lol)

    rawk on. i’m now independant of PC’s now using linux on my ps3… compiling was the one thing i had to use a PC for. glad that barrier is gone :)

    nothing special required to install the psplibraries.

  • Short, straight, and to the point. Just how it should be. Great job. Now I can finally develop for the PSP without being stuck with Lua.

    Ubuntu inside Windows XP x64 using VirtualBox FTW!

  • wow, won’t it be easier to just install Linux and get rid of Windows? :P