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 

Linking issues using ps2ip from within IOP

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



Joined: 07 Jul 2005
Posts: 7

PostPosted: Thu Jul 07, 2005 5:18 pm    Post subject: Linking issues using ps2ip from within IOP Reply with quote

Hi guys,


I'm pretty new to PS2 development, and trying to get to grips with making iop modules.

I'm trying to build an IRX that uses ps2ip code using the latest ps2sdk. The code I am using basically looks like this:

Code:
void * rpcHandlerFunction(int command, void * buffer, int size)
{
    int s, con;
    struct sockaddr_in saddr;

    s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);

    memset(&saddr, 0, sizeof(saddr));
   
    saddr.sin_family = AF_INET;
    saddr.sin_port = 80;
    IP4_ADDR(((struct ip_addr*)&(saddr.sin_addr)), 192, 168, 0, 1);

    con = connect(s, &saddr, sizeof(saddr));

    return rpcBuffer;
}


I get unresolved type errors on the socket functions when linking:

    iop-gcc -miop -nostdlib -L/usr/local/ps2dev/ps2sdk/iop/lib -o ./iop.irx iop_main.o -lkernel -lkernel -lgcc
    iop_main.o(.text+0x20): In function `rpcHandlerFunction':
    iop_main.c: undefined reference to `lwip_socket'
    iop_main.o(.text+0x78):iop_main.c: undefined reference to `lwip_connect'
    collect2: ld returned 1 exit status
    make: *** [iop.irx] Error 1


I see that the iop/include dir has it's own ps2ip header file which appears to have exports for these functions and I checked that I am including the file in the iop dir and not the ee one.

I assume that these functions are provided by the ps2ip IRX since there aren't any libraries for the IOP except kernel, but how do I tell the linker that they won't be provided at link time?

Any ideas what I'm missing? Any help would be very appreciated.

// TJ
Back to top
View user's profile Send private message
pixel



Joined: 30 Jan 2004
Posts: 791

PostPosted: Thu Jul 07, 2005 7:26 pm    Post subject: Reply with quote

IOP modules works a strange way. Importing functions from a module goes thru a special system. Look at ps2sdk's source, try to understand how the "import.lst" system works, and how it creates a .o files that has to be linked with the final irx module.
_________________
pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department.
Back to top
View user's profile Send private message
TJ



Joined: 07 Jul 2005
Posts: 7

PostPosted: Thu Jul 07, 2005 11:00 pm    Post subject: Reply with quote

Thanks pixel, I've got it to link now, will have to test it later.

For any other newbies looking to do this have a look at the $(PS2SDKSRC)/iop/debug/ioptrap code. Steal and modify the imports.lst and irx_imports.h files and get the rules to make a .o file from a .lst file from the Rules.make file under iop.

I expect to be back with more dumb questions soon.


// TJ
Back to top
View user's profile Send private message
urchin



Joined: 02 Jun 2005
Posts: 121

PostPosted: Sat Jul 09, 2005 5:18 am    Post subject: Reply with quote

i could be completely wrong, but isn't the problem as simple as the lwip (lightweight tcpip) implementation code not being linked in?...
Back to top
View user's profile Send private message
pixel



Joined: 30 Jan 2004
Posts: 791

PostPosted: Sat Jul 09, 2005 7:42 pm    Post subject: Reply with quote

Indeed, you're completely wrong, and you haven't read anything more than the first post of this thread.
_________________
pixel: A mischievous magical spirit associated with screen displays. The computer industry has frequently borrowed from mythology. Witness the sprites in computer graphics, the demons in artificial intelligence and the trolls in the marketing department.
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 -> PS2 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