forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to compile?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development
View previous topic :: View next topic  
Author Message
Thanhda



Joined: 09 Apr 2005
Posts: 331
Location: Canada

PostPosted: Fri Apr 22, 2005 6:15 pm    Post subject: How to compile? Reply with quote

okay, i've been trying to look around, but i cant seem to find out how to compile my code to an elf file.

I am currently running on Knopixx linux, and was able to get the autobuild install, but i dont know where to go from there. i know in gcc to compile code its

Code:

gcc file.c -o name


if you can just direct me to a tutor that would be great. and yes i have already checked out http://www.oopo.net/consoledev/. all it says is theres an old way to do it, but just use the auto build. i cant seem to find anywhere that teaches how to use gcc or compile ps2 code.
Back to top
View user's profile Send private message Visit poster's website
blackdroid



Joined: 17 Jan 2004
Posts: 564
Location: Sweden

PostPosted: Fri Apr 22, 2005 6:22 pm    Post subject: Reply with quote

use the toolchain.sh script on ooPo's site and run it.
_________________
Kung VU
Back to top
View user's profile Send private message Visit poster's website
ooPo
Site Admin


Joined: 17 Jan 2004
Posts: 2032
Location: Canada

PostPosted: Fri Apr 22, 2005 10:13 pm    Post subject: Reply with quote

If you have already built the toolchain, you can go to /usr/local/ps2dev/ps2sdk/sample/hello and type 'make'. This will build a sample 'hello world' program for you.
Back to top
View user's profile Send private message Visit poster's website
Thanhda



Joined: 09 Apr 2005
Posts: 331
Location: Canada

PostPosted: Sat Apr 23, 2005 1:54 am    Post subject: Reply with quote

blackdroid wrote:
use the toolchain.sh script on ooPo's site and run it.


buddy, read my post i said i already built it. what do i do next. i'm not a linux user, so i dont know what to do next. btw it says

knoppix@ttyp0[ps2toolchain]$ ./toolchain.sh
bash: ./toolchain.sh: Permission denied

only toolchain-oldiop.sh seems to work. can it still use this one? is this just an older version?


Last edited by Thanhda on Sat Apr 23, 2005 1:58 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Thanhda



Joined: 09 Apr 2005
Posts: 331
Location: Canada

PostPosted: Sat Apr 23, 2005 1:55 am    Post subject: Reply with quote

ooPo wrote:
If you have already built the toolchain, you can go to /usr/local/ps2dev/ps2sdk/sample/hello and type 'make'. This will build a sample 'hello world' program for you.


just type 'make'? does this compile according to the make file?
Back to top
View user's profile Send private message Visit poster's website
ooPo
Site Admin


Joined: 17 Jan 2004
Posts: 2032
Location: Canada

PostPosted: Sat Apr 23, 2005 1:57 am    Post subject: Reply with quote

That's the rumor.

It'll show you the steps it takes, however. Good for learning.
Back to top
View user's profile Send private message Visit poster's website
Thanhda



Joined: 09 Apr 2005
Posts: 331
Location: Canada

PostPosted: Sat Apr 23, 2005 2:06 am    Post subject: Reply with quote

okay well why wont toolchain.sh complie? that reason may that be? also is there a sample in the old one i can test?

edit: nm i got it working, i just righ click and set as excutable. =p
Back to top
View user's profile Send private message Visit poster's website
Thanhda



Joined: 09 Apr 2005
Posts: 331
Location: Canada

PostPosted: Sat Apr 23, 2005 2:41 am    Post subject: Reply with quote

ooPo wrote:
If you have already built the toolchain, you can go to /usr/local/ps2dev/ps2sdk/sample/hello and type 'make'. This will build a sample 'hello world' program for you.


this folder doesnt exist. is there anything else i was supose to install?
Back to top
View user's profile Send private message Visit poster's website
ooPo
Site Admin


Joined: 17 Jan 2004
Posts: 2032
Location: Canada

PostPosted: Sat Apr 23, 2005 3:02 am    Post subject: Reply with quote

When you run toolchain.sh properly, it installs ps2sdk into /usr/local/ps2dev/ps2sdk. If that directory doesn't exist, something probably went wrong with the install.

Did you notice any error messages?
Back to top
View user's profile Send private message Visit poster's website
Thanhda



Joined: 09 Apr 2005
Posts: 331
Location: Canada

PostPosted: Sat Apr 23, 2005 3:03 am    Post subject: Reply with quote

ooPo wrote:
When you run toolchain.sh properly, it installs ps2sdk into /usr/local/ps2dev/ps2sdk. If that directory doesn't exist, something probably went wrong with the install.

Did you notice any error messages?


yeah it said in the end, ERROR INSTALLING BINUT or something like that.

i'm running on Knoppix. could that be a reason why its messed, up?
Back to top
View user's profile Send private message Visit poster's website
ooPo
Site Admin


Joined: 17 Jan 2004
Posts: 2032
Location: Canada

PostPosted: Sat Apr 23, 2005 3:47 am    Post subject: Reply with quote

I don't run knoppix, so I have no idea.

Being a bit more specific with the error message may help, however.

One thing I do not understand is why you thought everything installed ok when it gave you an error.

Are you sure you're cut out for this?
Back to top
View user's profile Send private message Visit poster's website
Thanhda



Joined: 09 Apr 2005
Posts: 331
Location: Canada

PostPosted: Sat Apr 23, 2005 4:06 am    Post subject: Reply with quote

yeah i'm sure i am cut out for this. i thought it installed okay, but i just checked again.
i've been programming for some time, in opengl. i am a windows user, and had a crash course on linux about a year ago. so linux is new to me(similar to dos tho). I am reading LDP docs to find out how linux runs inside out. i am getting the just of it, and able to compile code just fine. only having problems installing the toolchain. I would usually try to get it working on windows but i cant even get gcc to work on cygwin.

anyway this is the error i get with the old tool-chain.

Code:

as: unrecognized option `-G'
make[2]: *** [libgcc/./_muldi3.o] Error 1
make[2]: Leaving directory `/ramdisk/home/knoppix/ps2toolchain-old/gcc-3.2.2/gcc'
make[1]: *** [libgcc.a] Error 2
make[1]: Leaving directory `/ramdisk/home/knoppix/ps2toolchain-old/gcc-3.2.2/gcc'
make: *** [all-gcc] Error 2
/bin/sh ./mkinstalldirs /usr/local/ps2dev/ee /usr/local/ps2dev/ee
mkdir /usr/local/ps2dev
mkdir /usr/local/ps2dev/ee
mkdir /usr/local/ps2dev
mkdir /usr/local/ps2dev/ee
make: *** [installdirs] Error 1
cp: cannot stat `/usr/local/ps2dev/ps2lib/ee/startup/crt0.o': No such file or directory



compiling code for the new one again now so see what the error is.
btw knoppixx is a linux live on CD, meaning everytime i restart the computer, all files get erease and runs off ram. but i have mounted a partition to store all save code into.

edit: when compiling new autobuild it starts of by saying this before installing

Code:

CVS                  binutils-2.9.1-IOP.patch  newlib-1.10.0.patch
README.TXT           gcc-2.8.1-IOP.patch       toolchain-oldiop.sh
binutils-2.14.patch  gcc-3.2.2.patch           toolchain.sh
knoppix@ttyp0[ps2toolchain]$ ./toolchain.sh
cat: /home/knoppix/.cvspass: No such file or directory
THE SECRET PASSWORD IS: anonymous
Logging in to :pserver:anonymous@cvs.ps2dev.org:2401/home/ps2cvs
CVS password:
cvs login: warning: failed to open /home/knoppix/.cvspass for reading: No such file or directory
./toolchain.sh: line 35: gmake: command not found


my guess checks to see if i have it downloaded yet or not, and if not it download the files. not sure tho. and it ends with this.

Code:

make[3]: *** [tc-mips.o] Error 1
make[3]: Leaving directory `/ramdisk/var/tmp/ps2dev/binutils-2.14/build-ee/gas'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/ramdisk/var/tmp/ps2dev/binutils-2.14/build-ee/gas'
make[1]: *** [all-recursive-am] Error 2
make[1]: Leaving directory `/ramdisk/var/tmp/ps2dev/binutils-2.14/build-ee/gas'
make: *** [all-gas] Error 2
ERROR BUILDING BINUTILS (binutils-2.14 ee)



btw oopo: what version of linux are you using? Fedora? is there any other steps i am supose to take before running toolchain.sh?
Back to top
View user's profile Send private message Visit poster's website
Thanhda



Joined: 09 Apr 2005
Posts: 331
Location: Canada

PostPosted: Sat Apr 23, 2005 10:33 am    Post subject: Problem Fix Reply with quote

okay, i manage to install it. the reason it was giving me errors was because user/local/ is read only. i tried whiching to root by typing su, but still wont allow me to install. so i just modifed the toolchain.sh file path to /home/knoppix/local/ and it works fine so far.
Back to top
View user's profile Send private message Visit poster's website
cheriff
Regular


Joined: 23 Jun 2004
Posts: 262
Location: Sydney.au

PostPosted: Sat Apr 23, 2005 11:52 am    Post subject: Reply with quote

with Knoppix, there is an icon in the "start menu" which opens a terminal as superuser. The reason you can't use su is because there is no root password set. If you can set the root password yourself, su will work as normal.

Also, Because knoppix is a live CD, directories /usr and such are run right off the CD, i think any additions to this you make are kept in a ramdir. So with the default setup you may have to re-install the toolchain every reboot.

Since you have a disk partition setup for your homedir, it may be advisable to edit the toochain.sh to install to /mnt/mypartition/ps2, or whereever the disk is mounted. Remember to change $PS2SDK to reflect this.

But my serious advice would to be to do all this under cygwin in windows, or even install a linux partition...
- cheriff
_________________
Damn, I need a decent signature!
Back to top
View user's profile Send private message
ooPo
Site Admin


Joined: 17 Jan 2004
Posts: 2032
Location: Canada

PostPosted: Sat Apr 23, 2005 12:04 pm    Post subject: Reply with quote

In the toolchain script, $PS2SDK should automatically use $PS2DEV/ps2sdk, so you'd only need to change $PS2DEV.
Back to top
View user's profile Send private message Visit poster's website
rinco



Joined: 21 Jan 2005
Posts: 255
Location: Canberra, Australia

PostPosted: Sat Apr 23, 2005 1:20 pm    Post subject: Reply with quote

cheriff wrote:
with Knoppix, there is an icon in the "start menu" which opens a terminal as superuser. The reason you can't use su is because there is no root password set. If you can set the root password yourself, su will work as normal.


I thought you could use sudo to get a root shell.... sudo bash

Quote:
But my serious advice would to be to do all this under cygwin in windows, or even install a linux partition...


I was thinking exactly the same thing.
Back to top
View user's profile Send private message
Thanhda



Joined: 09 Apr 2005
Posts: 331
Location: Canada

PostPosted: Sun Apr 24, 2005 6:45 am    Post subject: Reply with quote

well, i'm just want to see if i can get the enviroment all set up. i plan to reformat my computer, and create a partition for both my windows and linux OS. i'm downloading the Fedora ISO as we speak. if someone would like to recommend another Linux OS let me know.
Back to top
View user's profile Send private message Visit poster's website
Thanhda



Joined: 09 Apr 2005
Posts: 331
Location: Canada

PostPosted: Wed Apr 27, 2005 7:02 pm    Post subject: Reply with quote

okay, still no compile, i finally got the toolchain to compile Fedora 3.

when i go to the samples/hello/ i type make, and it gives me this error

Code:

ee-gcc -D_EE -O2 -G0 -Wall  -I/ee/include -I/common/include -I.  -c hello.c -o hello.o
make: ee-gcc: Command not found
make: *** [hello.o] Error 127


originally it said no such file. but i modifed the make file to go to the dir. and now i get this.

i'm guessing ee-gcc is not installed. but shouldnt toolchain.sh install it?

but when i place the code into the ee/bin folder it compiles, but gives me this answer

Code:

[root@localhost bin]# ./ee-gcc -D_EE -O2 -G0 -Wall  -I/ee/include -I/common/include -I.  -c hello.c -o hello.o
hello.c:14:22: tamtypes.h: No such file or directory
hello.c:15:20: sifcmd.h: No such file or directory
hello.c:16:20: kernel.h: No such file or directory
hello.c:17:20: sifrpc.h: No such file or directory
hello.c:18:17: sio.h: No such file or directory
hello.c: In function `main':
hello.c:22: warning: implicit declaration of function `SifInitRpc'
hello.c:27: warning: implicit declaration of function `printf'
hello.c:28: warning: implicit declaration of function `nprintf'
hello.c:30: warning: implicit declaration of function `sio_init'
hello.c:31: warning: implicit declaration of function `sio_printf'


_________________
There are 10 types of people in the world: Those who understand binary, and those who don't...
Back to top
View user's profile Send private message Visit poster's website
blackdroid



Joined: 17 Jan 2004
Posts: 564
Location: Sweden

PostPosted: Wed Apr 27, 2005 7:18 pm    Post subject: Reply with quote

You dont seem to have the PS2* specific env variables defined.

read the top of toolchain.sh
_________________
Kung VU
Back to top
View user's profile Send private message Visit poster's website
Thanhda



Joined: 09 Apr 2005
Posts: 331
Location: Canada

PostPosted: Thu Apr 28, 2005 1:46 am    Post subject: Reply with quote

blackdroid wrote:
You dont seem to have the PS2* specific env variables defined.

read the top of toolchain.sh


Code:

#!/bin/sh
# toolchain.sh - Dan Peori <peori@oopo.net>
# Copy all you want. Please give me some credit.

 ########################
 ## MAIN CONFIGURATION ##
 ########################

  ## Main ps2dev settings.
  export PS2DEV="/usr/local/ps2dev"
  export PS2SDK="$PS2DEV/ps2sdk"
  export CVSROOT=":pserver:anonymous@cvs.ps2dev.org:2401/home/ps2cvs"
  export PAT


what am i looking for?
_________________
There are 10 types of people in the world: Those who understand binary, and those who don't...
Back to top
View user's profile Send private message Visit poster's website
ooPo
Site Admin


Joined: 17 Jan 2004
Posts: 2032
Location: Canada

PostPosted: Thu Apr 28, 2005 1:52 am    Post subject: Reply with quote

From the included README.TXT:

Quote:
==================
HOW DO I USE IT?
==================

Basically, you run the toolchain script:

## Make the script executable.
chmod a+x ./toolchain.sh

## Run the script.
./toolchain.sh

First, this script will attempt to make sure you have all the programs
you need to build the toolchain. Then it will download the source from
various places on the internet. Finally, it will compile and build the
source. This may take a long time.

Once finished, you need to add the following to your login settings:

## PS2DEV SETTINGS
export PS2DEV="/usr/local/ps2dev"
export PS2SDK="$PS2DEV/ps2sdk"
export CVSROOT=":pserver:anonymous@cvs.ps2dev.org:/home/ps2cvs"
export PATH="$PATH:$PS2DEV/bin:$PS2DEV/ee/bin:$PS2DEV/iop/bin:$PS2DEV/dvp/bin:$PS2SDK/bin"

Then you're done!

You can view the latest version in cvs yourself at:

http://cvs.ps2dev.org/ps2toolchain/README.TXT?rev=1.4&content-type=text/vnd.viewcvs-markup
Back to top
View user's profile Send private message Visit poster's website
Thanhda



Joined: 09 Apr 2005
Posts: 331
Location: Canada

PostPosted: Thu Apr 28, 2005 2:15 am    Post subject: Reply with quote

ooPo wrote:
From the included README.TXT:
You can view the latest version in cvs yourself at:

http://cvs.ps2dev.org/ps2toolchain/README.TXT?rev=1.4&content-type=text/vnd.viewcvs-markup


thanks man, got it to compile. works good now. but one small question, how do i place this in my login. i can get this to work when i switch to root and type the command lines in. but how do i get it to stay that way without having to do it everytime i boot up. besides creating a bat file.
_________________
There are 10 types of people in the world: Those who understand binary, and those who don't...
Back to top
View user's profile Send private message Visit poster's website
carlosn



Joined: 10 Mar 2005
Posts: 38
Location: Orlando, Florida, US

PostPosted: Thu Apr 28, 2005 6:56 am    Post subject: Reply with quote

Type all the export lines at the end of your ".bash_profile" file. This file contains your login settings. The file is located in your home directory.
Back to top
View user's profile Send private message Visit poster's website
Thanhda



Joined: 09 Apr 2005
Posts: 331
Location: Canada

PostPosted: Thu Apr 28, 2005 7:47 am    Post subject: Reply with quote

carlosn wrote:
Type all the export lines at the end of your ".bash_profile" file. This file contains your login settings. The file is located in your home directory.


there isnt such a file in the home dir. only see folder.
_________________
There are 10 types of people in the world: Those who understand binary, and those who don't...
Back to top
View user's profile Send private message Visit poster's website
blackdroid



Joined: 17 Jan 2004
Posts: 564
Location: Sweden

PostPosted: Thu Apr 28, 2005 6:09 pm    Post subject: Reply with quote

You banter about the good of linux, yet you cant use the system, please read up on basic unix/bash shell usage. This is afterall not a unix support forum.
_________________
Kung VU
Back to top
View user's profile Send private message Visit poster's website
Thanhda



Joined: 09 Apr 2005
Posts: 331
Location: Canada

PostPosted: Fri Apr 29, 2005 12:37 am    Post subject: Reply with quote

blackdroid wrote:
You banter about the good of linux, yet you cant use the system, please read up on basic unix/bash shell usage. This is afterall not a unix support forum.


it is good, i just dont know how to set this up. plus the setup of getting it on linux is SOOOOO much easier then windows. i have already manage to program a small demo for the ps2 and get it to compile. and i have yet to get it even to compile or install the toolchain on windows through cygwin. i've spend a good month trying to get it working on windows. and less then a day to set it up on linux. hmm whats better.

btw yes i figure it out. i have read the ldp.
_________________
There are 10 types of people in the world: Those who understand binary, and those who don't...
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group