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 

Common errors and Solutions

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



Joined: 08 Jun 2005
Posts: 326
Location: Fort Wayne, IN

PostPosted: Wed Jul 13, 2005 10:06 am    Post subject: Common errors and Solutions Reply with quote

OK, after reading these forums, I have compiled a list of some of the much more common errors that happen when compiling and using the SDK.

Q:HelloWorld Problems
A:This program is a problem in itself as of right now. It is outdated and you shouldn't try to compile it. Get the PSPSDK and try and compile the samples there.

Q:/bin/sh: no: command not found
A:Make sure you have gcc installed. While you're at it, make sure that autoconf and automake are there too. These are necessary tools to compile the SDK.

Q:bash: ./configure: Permission denied
A:Do a
Code:
chmod +x ./configure


Q:./bootstrap: line 81: aclocal: command not found
./bootstrap: line 83: autoheader: command not found
./bootstrap: line 84: automake: command not found
./bootstrap: line 86: autoconf: command not found

A:Install automake and autoconf.

Q: In function `__entrytable':
crt0.S:(.rodata.sceResident+0xc): undefined reference to `module_info'

A:Make sure that you have PSP_MODULE_INFO("SOMETHING", 0, 1, 1); somewhere in your program.

Q:In function `_sbrk_r':
../../../../../newlib/libc/reent/sbrkr.c:60: undefined reference to `sbrk'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libc.a(makebuf.o): In function `__smakebuf':
../../../../../newlib/libc/stdio/makebuf.c:96: undefined reference to `isatty'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libc.a(writer.o): In function `_write_r':
../../../../../newlib/libc/reent/writer.c:58: undefined reference to `_write'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libc.a(closer.o): In function `_close_r':
../../../../../newlib/libc/reent/closer.c:53: undefined reference to `_close'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libc.a(fstatr.o): In function `_fstat_r':
../../../../../newlib/libc/reent/fstatr.c:62: undefined reference to `_fstat'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libc.a(lseekr.o): In function `_lseek_r':
../../../../../newlib/libc/reent/lseekr.c:58: undefined reference to `_lseek'
/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/lib/libc.a(readr.o): In function `_read_r':
../../../../../newlib/libc/reent/readr.c:58: undefined reference to `_read'

A:Delete any previous installation of your toolchain and make sure you grab the latest toolchain and SDK from svn.

To get it, install subversion and do a
Code:
svn co svn://svn.pspdev.org/psp/trunk/pspsdk
svn co svn://svn.pspdev.org/psp/trunk/psptoolchain


Q:Why can't I use the math.h file? It is giving undefined errors.
A:Put a -lm in your linked libraries.

Q:I have installed the toolchain and SDK, but it says 'psp-gcc command not found' or 'make: psp-config: Command not found'.
A:Stated in the README:
Quote:
Code:
export PATH="/usr/local/pspdev/bin:$PATH"

(You can also add the above four lines to your .bash_profile, to save you from typing it in each time you open a new console window.)


Q:In Cygwin, it says 'wget: command not found'
A:Install the wget package.

Q:In Cygwin, it says 'gmake: command not found'
A:Install the make package

Q:I get 'Undefined Reference to __errorno'
A:Until the sdk is fixed for __errno just add
Code:

int __errno = 0;

to your main C file.

(This may even be fixed by updating to the new SDK)

Many, many other errors can be solved by just checking out the latest toolchain / sdk from svn.

Any others to add to the list?
_________________
Lego of my Ago!
Back to top
View user's profile Send private message AIM Address
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Tue Jan 03, 2006 1:20 am    Post subject: Reply with quote

Updated to remove unneeded environment variables and added 'make: psp-config: Command not found'.
Back to top
View user's profile Send private message
The Operator



Joined: 11 Jan 2006
Posts: 3
Location: Atlanta

PostPosted: Wed Jan 11, 2006 5:12 am    Post subject: Reply with quote

I am using psptoolchain-20051202 and i am getting the exact same error over and over when i try to install it. i have tried going out and getting the most up to date one and this is the one i find. I also tried running it with ./toolchain.sh -p to in stall just the psp sdk becuase that is where it is saying it is getting the error. here it is.


Code:

In file included from inethelper.c:18:
../../src/net/pspnet_resolver.h:22:24: error: netinet/in.h: No such file or dire
ctory
In file included from inethelper.c:18:
../../src/net/pspnet_resolver.h:62: warning: 'struct in_addr' declared inside pa
rameter list
../../src/net/pspnet_resolver.h:62: warning: its scope is only this definition o
r declaration, which is probably not what you want
../../src/net/pspnet_resolver.h:76: warning: 'struct in_addr' declared inside pa
rameter list
make[3]: *** [inethelper.o] Error 1
make[3]: Leaving directory `/tmp/pspdev/pspsdk/src/sdk'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/tmp/pspdev/pspsdk/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/pspdev/pspsdk'
make: *** [all] Error 2
ERROR BUILDING PSPSDK
[/code]
_________________
Insert witty and meaningful sig here......
Back to top
View user's profile Send private message Visit poster's website
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Wed Jan 11, 2006 5:41 am    Post subject: Reply with quote

Well... you need to latest toolchain from subversion, or at least the latest newlib patch. Stuff which was deemed to be in newlib's domain (i.e. standard socket headers) are in newlib. Unfortunately pspsdk now depends on those files being there, which is what is causing the problems :(
Back to top
View user's profile Send private message
The Operator



Joined: 11 Jan 2006
Posts: 3
Location: Atlanta

PostPosted: Wed Jan 11, 2006 5:45 am    Post subject: Reply with quote

Okay can i just run ./toolchain -n to install the latest newlib? or do i need to go get it and redo the whole installation.
_________________
Insert witty and meaningful sig here......
Back to top
View user's profile Send private message Visit poster's website
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Wed Jan 11, 2006 10:04 am    Post subject: Reply with quote

You should be able to just do toolchain -n yes
Back to top
View user's profile Send private message
Yue



Joined: 28 Aug 2006
Posts: 2

PostPosted: Mon Aug 28, 2006 9:43 am    Post subject: Simple error (I think) Reply with quote

Hello everyone!

I just installed everything in order to develop for PSP. However, I tried to compile the following code I created just for testing the pad:

Code:

#include <pspdisplay.h>
#include <pspctrl.h>
#define printf pspDebugScreenPrintf

PSP_MODULE_INFO("For Emi",0,1,1);

/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
    sceKernelExitGame();
    return 0;
}

/* Callback thread */
int CallbackThread(SceSize args, void *argp) {
    int cbid;
   
    cbid = sceKernelCreateCallback("Exit Callback", exit_callback, 0);
    sceKernelRegisterExitCallback(cbid);
   
    sceKernelSleepThreadCB();
   
    return 0;
}

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void) {
    int thid = 0;
   
    thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
    if(thid >= 0) {
   sceKernelStartThread(thid, 0, 0);
    }

    return thid;
}

int main() {

    pspDebugScreenInit();
    SetupCallbacks();

    SceCtrlData pad;

   
    printf("Some message");
    printf("Some message");

    while (1) {
   sceCtrlReadBufferPositive(&pad,1);

   if (pad.Buttons && PSP_CTRL_CIRCLE) {
       printf("Circle");
   }
   else {
       if (pad.Buttons && PSP_CTRL_CROSS) {
      printf("Cross");
       }
       else {
      if (pad.Buttons && PSP_CTRL_SQUARE) {
          printf("Square");
      }
      else {
          if (pad.Buttons && PSP_CTRL_TRIANGLE) {
         printf("Triangle");
          }
      }
       }
   }
    }

    sceKernelSleepThread();

    return 0;
}


I named the file "foremi.c". The Makefile looks like this:
Code:

TARGET = foremi
OBJS = foremi.o

CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = For Emi

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak


But when I run make, I get the following:

Code:

psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall   -c -o foremi.o foremi.c
foremi.c:5: error: syntax error before string constant
foremi.c:5: 警告: type defaults to ‘int’ in declaration of ‘PSP_MODULE_INFO’
foremi.c:5: 警告: データ定義が型や記憶クラスを持っていません
foremi.c: In function ‘exit_callback’:
foremi.c:9: 警告: implicit declaration of function ‘sceKernelExitGame’
foremi.c: トップレベル:
foremi.c:14: error: syntax error before ‘args’
foremi.c: In function ‘CallbackThread’:
foremi.c:17: 警告: implicit declaration of function ‘sceKernelCreateCallback’
foremi.c:18: 警告: implicit declaration of function ‘sceKernelRegisterExitCallback’
foremi.c:20: 警告: implicit declaration of function ‘sceKernelSleepThreadCB’
foremi.c: In function ‘SetupCallbacks’:
foremi.c:29: 警告: implicit declaration of function ‘sceKernelCreateThread’
foremi.c:31: 警告: implicit declaration of function ‘sceKernelStartThread’
foremi.c: In function ‘main’:
foremi.c:39: 警告: implicit declaration of function ‘pspDebugScreenInit’
foremi.c:45: 警告: implicit declaration of function ‘pspDebugScreenPrintf’
foremi.c:71: 警告: implicit declaration of function ‘sceKernelSleepThread’
make: *** [foremi.o] エラー 1


If you can't see some characters from this output, don't worry. I use SUSE Linux 10.1 in Japanese, that's why the characters are in that language.

I'm pretty sure that the error is very very basic, but since I'm a beginner in PSP development and it's been a while since the last time I programmed in C, I better ask to the experts.

I'd be grateful for any tips you can tell me.

Thanks in advance.
Back to top
View user's profile Send private message Visit poster's website
Insert_witty_name



Joined: 10 May 2006
Posts: 376

PostPosted: Mon Aug 28, 2006 10:24 am    Post subject: Reply with quote

This is the wrong thread for this really.

Regardless, add these two lines to the start of your code:

Code:
#include <pspdebug.h>
#include <pspkernel.h>


You'd also be better using else if instead of all those else, like so:

Code:
if (pad.Buttons & PSP_CTRL_CIRCLE)
     printf("Circle");
else if (pad.Buttons & PSP_CTRL_CROSS)
     printf("Cross");
else if (pad.Buttons & PSP_CTRL_SQUARE)
     printf("Square");
else if (pad.Buttons & PSP_CTRL_TRIANGLE)
     printf("Triangle");
Back to top
View user's profile Send private message
Yue



Joined: 28 Aug 2006
Posts: 2

PostPosted: Tue Aug 29, 2006 12:51 pm    Post subject: Reply with quote

Thanks a lot for the reply and sorry for posting in the wrong place. I will try that!
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 -> PSP 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