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 

when calling time(NULL) error linking in pspsdk

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



Joined: 04 Jul 2006
Posts: 28
Location: China

PostPosted: Tue May 15, 2007 5:06 pm    Post subject: when calling time(NULL) error linking in pspsdk Reply with quote

psp-gcc -I. -I/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=150 -L. -L/psp/sdk/lib main.o my.o -lpspumd -lSDL -ljpeg -lpspgu -lpspaudio -lpsphprm -lpng -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o dumper.elf
/lib/gcc/psp/4.1.0/../../../../psp/lib/libc.a(lib_a-timer.o): In function `_times_r':
../../../../../newlib/libc/reent/timer.c:64: undefined reference to `_times'
collect2: ld returned 1 exit status
make: *** [dumper.elf] Error 1

Anybody encounter this before?

thx

bin
Back to top
View user's profile Send private message MSN Messenger
be2003



Joined: 20 Apr 2006
Posts: 144

PostPosted: Wed May 16, 2007 8:56 am    Post subject: Reply with quote

im not sure....

try linking you're project with the kernel libc instead
_________________
- be2003
blog
Back to top
View user's profile Send private message
nataku92



Joined: 27 Dec 2005
Posts: 5

PostPosted: Fri May 25, 2007 5:54 pm    Post subject: Reply with quote

Hi,

I'm also having the same problem as the topic creator. How would I link my project with the kernel libc?

Thanks
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Fri May 25, 2007 6:32 pm    Post subject: Reply with quote

This looks like a toolchain regression, probably in the newlib 1.15 patch.

ooPo, I'm having a bit of trouble following the newlib stuff currently in svn.
Did we stop using the drop-in trees for some reason? How do we modify and regenerate newlib-1.15.0.patch in that case?
Back to top
View user's profile Send private message
anhanguera



Joined: 26 Aug 2004
Posts: 31

PostPosted: Tue May 29, 2007 10:42 pm    Post subject: Reply with quote

hi,

_times() function should be added to a seperate file (syscalls.c ?!). anyway here is a quick and ugly workaround....

Code:
Index: newlib-psp/newlib/libc/sys/psp/pipe.c
===================================================================
--- newlib-psp/newlib/libc/sys/psp/pipe.c  (revision 2233)
+++ newlib-psp/newlib/libc/sys/psp/pipe.c  (working copy)
@@ -234,3 +234,8 @@
        }
 }

+int __psp_set_errno(int code);
+time_t _times(time_t *t)
+{
+       return __psp_set_errno(sceKernelLibcTime(t));
+}

or,

Code:
Index: psptoolchain/patches/newlib-1.15.0-PSP.patch
===================================================================
--- psptoolchain/patches/newlib-1.15.0-PSP.patch     (revision 2233)
+++ psptoolchain/patches/newlib-1.15.0-PSP.patch     (working copy)
@@ -7484,7 +7484,7 @@
 diff -burN newlib-1.15.0/newlib/libc/sys/psp/pipe.c newlib-psp/newlib/libc/sys/psp/pipe.c
 --- newlib-1.15.0/newlib/libc/sys/psp/pipe.c   1970-01-01 01:00:00.000000000 +0100
 +++ newlib-psp/newlib/libc/sys/psp/pipe.c      2007-03-10 18:02:39.000000000 +0100
-@@ -0,0 +1,271 @@
+@@ -0,0 +1,277 @@
 +/*
 + * PSP Software Development Kit - http://www.pspdev.org
 + * -----------------------------------------------------------------------
@@ -7756,6 +7756,12 @@
 +      }
 +}
 +
++int __psp_set_errno(int code);
++time_t _times(time_t *t)
++{
++      return __psp_set_errno(sceKernelLibcTime(t));
++}
++
 diff -burN newlib-1.15.0/newlib/libc/sys/psp/pspcwd.c newlib-psp/newlib/libc/sys/psp/pspcwd.c
 --- newlib-1.15.0/newlib/libc/sys/psp/pspcwd.c 1970-01-01 01:00:00.000000000 +0100
 +++ newlib-psp/newlib/libc/sys/psp/pspcwd.c    2007-03-10 18:02:39.000000000 +0100

anhanguera.
Back to top
View user's profile Send private message
ooPo
Site Admin


Joined: 17 Jan 2004
Posts: 2032
Location: Canada

PostPosted: Wed May 30, 2007 3:48 am    Post subject: Reply with quote

jimparis wrote:
ooPo, I'm having a bit of trouble following the newlib stuff currently in svn. Did we stop using the drop-in trees for some reason? How do we modify and regenerate newlib-1.15.0.patch in that case?

Uhm, I hadn't seen much activity with it so I assumed it wasn't really useful for people. I had been planning to just merge new patches manually.

So no real good reason, at least. We can certainly go back to using the trees if you like. :)
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: Wed May 30, 2007 4:51 am    Post subject: Reply with quote

anhanguera wrote:
_times() function should be added to a seperate file (syscalls.c ?!). anyway here is a quick and ugly workaround....

I've merged this into newlib-1.15.0-PSP.patch in the repository.
Back to top
View user's profile Send private message Visit poster's website
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Wed May 30, 2007 5:57 am    Post subject: Reply with quote

Ugh, pipe.c is definitely not the right place for that :P

If we're not using drop in trees (which is fine with me), we should delete it from the repository. Maybe a readme describing how to regenerate the patch would be useful. I don't know the best way, maybe: Unpack newlib, make a copy, apply the psp patch, make edits, then diff the two copies?
Back to top
View user's profile Send private message
ooPo
Site Admin


Joined: 17 Jan 2004
Posts: 2032
Location: Canada

PostPosted: Wed May 30, 2007 6:48 am    Post subject: Reply with quote

Perhaps pipe.c is a bad place for it, but until a better place is decided we have working code. It is a small change that can be easily removed later.

In the meantime, I'll do up a howto for making patches and how to submit them.
Back to top
View user's profile Send private message Visit poster's website
anhanguera



Joined: 26 Aug 2004
Posts: 31

PostPosted: Fri Jun 01, 2007 6:49 am    Post subject: Reply with quote

i would like to pute _times(..) to a seperated file syscalls.c but there is something with my autoconf, version mismatch i think. when i generate .in and configure files with autotools ./configure gives strange errors in newlib.
Back to top
View user's profile Send private message
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