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 `__ctype_b_loc'

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



Joined: 17 Nov 2007
Posts: 12

PostPosted: Sat Jun 28, 2008 12:07 pm    Post subject: undefined reference to `__ctype_b_loc' Reply with quote

I'm trying to compile a program that uses an external library (agar) and am getting some strange errors that I can't figure out. They all look something like:

keymap_ascii.c:(.text+0x300): undefined reference to `__ctype_b_loc'
OR
keymap_ascii.c:(.text+0x410): undefined reference to '__ctype_toupper_loc'

Has anyone ever run across anything like this? This one has me stumped...


A few more data points:

The library and app are being built with the same version of the toolchain (and SDK libraries, etc).

As far as I know, there's nothing special about the way the library is being built (e.g. no weird compiler or linker flags).


Here's the command line when I link it, if that helps.

psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -G0 -O2 -Wall -g -I.. -fno-strict-aliasing -I../.. -I/usr/local/pspdev/psp/include/agar -I/usr/local/pspdev/psp/include/SDL -I/usr/local/pspdev/psp/include -D_PSP_FW_VERSION=150 -L. -L/usr/local/pspdev/psp/sdk/lib cp.o -lag_gui -lag_core -lSDL -lpspgu -lfreetype -lpspaudio -lpsphprm -lm -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o cp.elf

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



Joined: 24 Jan 2007
Posts: 84

PostPosted: Sat Jun 28, 2008 7:44 pm    Post subject: Reply with quote

Looks like you didn't put the agar lib into the LIBS= line in the makefile....
Back to top
View user's profile Send private message
hectic128



Joined: 17 Nov 2007
Posts: 12

PostPosted: Sat Jun 28, 2008 11:41 pm    Post subject: Reply with quote

Hellcat wrote:
Looks like you didn't put the agar lib into the LIBS= line in the makefile....


Nope, it's there.

psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -G0 -O2 -Wall -g -I.. -fno-strict-aliasing -I../.. -I/usr/local/pspdev/psp/include/agar -I/usr/local/pspdev/psp/include/SDL -I/usr/local/pspdev/psp/include -D_PSP_FW_VERSION=150 -L. -L/usr/local/pspdev/psp/sdk/lib cp.o -lag_gui -lag_core -lSDL -lpspgu -lfreetype -lpspaudio -lpsphprm -lm -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o cp.elf

Plus, all of the other agar symbols link OK, its just these ctype ones.
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Wed Jul 02, 2008 4:50 am    Post subject: Reply with quote

Check Google.
__ctype_b_loc looks like a peculiarity of Linux libc/glibc; it's defined by the Linux Standard Base specification. PSP is not Linux and you'll have to define those symbols yourself if you want them.
Back to top
View user's profile Send private message
hectic128



Joined: 17 Nov 2007
Posts: 12

PostPosted: Wed Jul 02, 2008 11:28 am    Post subject: Reply with quote

OK, I figured out the problem. When building the library, it was grabbing the ctype.h file from /usr/include rather than the PSP toolchain one...
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