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 

Linker issues with autoconf w/ solution

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



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Sun Nov 27, 2005 7:34 pm    Post subject: Linker issues with autoconf w/ solution Reply with quote

While porting google-perftools to PSP, I noticed that configure wasn't picking up the sbrk() function in libc. The problem linker command was:
Code:
psp-gcc -o conftest -g -O2  -L/usr/local/pspdev/psp/sdk/lib -lc -lpspuser conftest.c
which meant that conftest.o appeared on the linker command line before "-lc -lpspuser". With this command, sbrk() wasn't being detected, but if I moved -lc to the end of the line, it would link as it was supposed to.

One solution is to pass the LIBS environment variable to configure, so that required libraries appear at the end of the linker command line, which is how the GNU linker prefers it. So the usual configure command line becomes:
Code:
LDFLAGS="-L`psp-config --pspsdk-path`/lib" LIBS="-lc -lpspuser" \
  ./configure --host psp --prefix=`psp-config --psp-prefix`
which produces:
Code:
psp-gcc -o conftest -g -O2  -L/usr/local/pspdev/psp/sdk/lib conftest.c -lc -lpspuser

I'm guessing that this change needs to be made across all of the autoconf'd programs and libraries we have in SVN, if anything to show the right way to do it. An easy way to tell if the change would make any difference is to do a diff of config.h before and after this change. If configure picked up any functions that it hadn't seen before, then the change is definitely needed.
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