Advertising (This ad goes away for registered users. You can Login or Register)

[Tutorial] install psptoolchain and PSPSDK in OS X(10.11.2)

Forum rules
Forum rule Nº 15 is strictly enforced in this subforum.
Post Reply
User avatar
Hob0dan1
Posts: 1
Joined: Tue Dec 29, 2015 12:25 am
Location: PR

[Tutorial] install psptoolchain and PSPSDK in OS X(10.11.2)

Post by Hob0dan1 » Tue Dec 29, 2015 4:37 am

Before all, this is my first post. I hope it's in the right section. Sorry if there are any mistakes! :cry:

Hello, this is a “Tutorial” on how to install the psptoolchain and pspsdk on Mac(OS X 10.11.2). I’m doing this because when I decided to install and prepare everything for developing Homebrew for the psp I had lots of trouble with the toolchain and sdk.

Some knowledge of Bash would be great and also being comfortable with the Terminal.

First off we need a couple of things before we can start with the installation of the toolchain and sdk.

Part I
Main Software needed:
Xcode -> you can get it at the App Store.

Command Line Tools -> you can get it from the developer apple website.

MacPorts -> https://www.macports.org/install.php, follow instructions on the Quickstart section(The top one). Download the appropriate one and install it. After installing MacPorts remember to add it to your paths file. This can be done by:
* Opening a terminal Window
* Typing:

Code: Select all

sudo nano /etc/paths
* Add this line to the bottom of the file:

Code: Select all

/opt/local/bin

* CTRL + X
* It will ask you if to save changes, type:

Code: Select all

y

* It will ask for the file name, just click Enter
* Close Terminal and reopen, type “port” to see if the changes were made.(Without double quotes)

Git -> you can get it through MacPorts (sudo port install git-core) or by going to the official git website, I think there is pkg or something, I always compile from source.

Part II
Installing the dependencies needed.

Using Git we will clone the repo from pspdev.

I recommend making a temporary folder for the builds,
Open terminal and type:

Code: Select all

mkdir tempPSP
This will create the “temporary” folder
Then we cd to it:

Code: Select all

cd tempPSP
After we’re in the folder, we clone the repo:

Code: Select all

git clone https://github.com/pspdev/psptoolchain.git
After that’s all done, we can start to download all the software needed to build it.
Go into psptoolchain folder by typing on terminal:

Code: Select all

cd psptoolchain
In the folder there should a file called “prepare-mac-os.sh”, you can see the files in terminal by typing:

Code: Select all

ls
We will run it by typing in terminal:

Code: Select all

sudo ./prepare-mac-os.sh
If it gives you an error saying: Warning: The Xcode Command Line Tools don't appear to be installed; most ports will likely fail to build.
Just close and reopen terminal and type:

Code: Select all

xcode-select --install
After that’s done, retype in terminal:

Code: Select all

sudo ./prepare-mac-os.sh
This will install some stuff we need, it can take some time.

After that’s done, let’s do some modifications to some scripts and patch a certain file.

Go to the root of psptoolchain folder using terminal and open the file “toolchain.sh”, I recommend using VIM or nano, or some text editor.
Delete lines 14 and 15 and save the file.
Now let’s do manually what those lines were doing, on terminal type:

Code: Select all

mkdir -p build
Then cd to it:

Code: Select all

cd build
Now things might get a little weird,

The gdb(GNU Debugger) that is used doesn’t quite work out of the box with OS X but there is patch. So we need to patch it manually.

After you’re in the build folder we must download the gdb by typing:

Code: Select all

wget ftp://ftp.gnu.org/pub/gnu/gdb/gdb-7.3.1.tar.bz2
After its downloaded extract it and cd to folder where our file to be patch is located.
To extract type:

Code: Select all

tar jxf gdb-7.3.1.tar.bz2
Type:

Code: Select all

cd gdb-7.3.1/gdb/tui
Now let’s download the patch:

Code: Select all

wget https://trac.macports.org/raw-attachment/ticket/46291/0005-tui-Unkown-function.patch
Now let’s rename it so its not so long(the name), type:

Code: Select all

mv 0005-tui-Unkown-function.patch tui-io.patch
After this is done, let’s actually patch the file by doing:

Code: Select all

patch < tui-io.patch
It will ask which file we want to patch, type:

Code: Select all

tui-io.c
After it patches, lets delete the patch file by doing:

Code: Select all

rm -rf tui-io.patch
Now lets move three directories back, type:

Code: Select all

 cd ../../../
Lets delete the downloaded gdb, by typing:

Code: Select all

rm -rf gdb-7.3.1.tar.bz2
And we compress the gdb folder with the patched file, by typing:

Code: Select all

sudo tar -cvjSf gdb-7.3.1.tar.bz2 *
Lets delete the folder now, type:

Code: Select all

rm -rf gdb-7.3.1
Part III
More dependencies.

First is automake-1.9
We can now be in any folder and type in terminal:

Code: Select all

wget http://ftp.gnu.org/gnu/automake/automake-1.9.tar.bz2
Extract it by typing:

Code: Select all

tar jxf automake-1.9.tar.bz2
Then cd to it:

Code: Select all

cd automake-1.9
Now lets configure it, type:

Code: Select all

./configure
After its done, type:

Code: Select all

make
And to finally install it:

Code: Select all

sudo make install
Another dependency is cmake, just type:

Code: Select all

sudo port install cmake
Another dependency is sdl, just type:

Code: Select all

sudo port install libsdl
Another dependency is doxygen, type:

Code: Select all

sudo port install doxygen
Now we should be ready. Go to the psptoolchain folder.

Type:

Code: Select all

sudo ./toolchain-sudo.sh
Let it work its magic, this process can take some time aprox ~ 30-40 minutes, depending on your specs.

If everything went well(or at least it tried), it should say:
Remember to add /usr/local/pspdev/bin to your path…

So let’s go ahead and do that,
type:

Code: Select all

cd && clear
Now type:

Code: Select all

sudo nano /etc/paths
Write

Code: Select all

/usr/local/pspdev/bin
at the end of the file but without the double quotes.
CTRL + X , it will ask if you want to save just type: y
And when prompted for the file name and location just click Enter.

That will add the path for the binaries.
Now let’s add the path for the PSPSDK itself,

This next part is if you’re using the bash shell. In my case I’m using Z shell (zsh) so the file changes, depends on the shell etc..

Type:

Code: Select all

sudo nano ~/.bash_profile
Now type at any part of the file:

Code: Select all

export PSPSDK="/usr/local/pspdev/psp/sdk" #SDK for psp
Then CTRL + X, it will ask if to save type: y
Then press Enter for file name and location.

This should export the path for the pspsdk.
After everything is done you can delete de tempPSP folder:

Code: Select all

rm -rf tempPSP
Remember to close and reopen all your terminals windows before compiling!

Now we’re ready to start compiling!
I’ve tested this by doing a simple hello world and everything went good.
There are a couple of tutorials for C in PSP and such. Just do a couple of searches.

Happy Coding! :D
Advertising
PSP 2k -> 6.60 ME 2.2
Macbook Pro 2012 -> OS X 10.11 & dual boot with Arch.
Macbook 2015 -> OS X 10.11

borsuq
Posts: 1
Joined: Fri Apr 29, 2016 9:37 pm

Re: [Tutorial] install psptoolchain and PSPSDK in OS X(10.11

Post by borsuq » Fri Apr 29, 2016 10:00 pm

Thanks for detailed tutorial. It still fails at compilation (OS X 10.11, XCode 7.3) of gcc (

with following error:

xgcc: error: addsf3: No such file or directory
make[2]: *** [addsf3.o] Error 1
make[2]: *** Waiting for unfinished jobs....
xgcc: error: subsf3: No such file or directory
make[2]: *** [subsf3.o] Error 1

Any ideas come to mind?
Advertising

Post Reply

Return to “Programming and Security”