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 

"undefined reference to _sprintf_r" in latest tool

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



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Tue Nov 01, 2005 5:45 pm    Post subject: "undefined reference to _sprintf_r" in latest tool Reply with quote

When I compile this:

Code:

#include <stdio.h>
#include <pspkernel.h>

/* Define the module info section */
PSP_MODULE_INFO("TEST", 0, 1, 1);

/* Define the main thread's attribute value (optional) */
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);

int main(void)
{
   tmpnam("");

   return 0;
}


with this Makefile:

Code:

TARGET = test
OBJS = main.o

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

LIBDIR =
LDFLAGS =
LIBS = -lpsputility

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Test

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


I'll get this error:

Code:

$ make
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall  -L. -L/usr/local/pspdev/psp/sdk/lib   main.o -lpsputility -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpsputility -lpspuser -lpspkernel -o test.elf
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libc.a(tmpnam.o): In function `worker':
../../../../../newlib/libc/stdio/tmpnam.c:121: undefined reference to `_sprintf_r'
collect2: ld returned 1 exit status
make: *** [test.elf] Error 1


Same error in Lua Player, which doesn't compile any more with the latest PSPSDK (or at least with my local environment, if this is the bug).
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Thu Nov 03, 2005 9:33 am    Post subject: Reply with quote

Looks like tmpnam() is violating newlib conventions and calling _sprintf_r() (instead of sprintf()) directly. I'm currently out of town, when I get back Friday I can fix it if no one else gets to it by then.
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