Simple include problems with PSPSDK samples

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
cakestick
Posts: 6
Joined: Sun Jan 22, 2006 2:49 pm

Simple include problems with PSPSDK samples

Post by cakestick »

Hello all, new member here!

I have enough experience with C to make myself feel like a jackass for this, but here's the issue: I'm trying to compile the sample located in net/simple in the PSPSDK 'samples' directory. Note that whenever code references the actual sdk headers (pspkernel.h, pspdebug.h), these includes work and the EBOOT is properly compiled.

However, when I try compiling network sample code that includes 'netinet/in.h', or anything that's located in /usr/include by default, I get frustrating errors that I'm sure are due to a missing setting in cygwin. Can anyone lend a hand?

Note: When I manually add /usr/include as an INCDIR in the Makefile, I still get errors, as if the constants/functions referenced aren't actually in the headers (but no 'no such file' errors, arrr matey!):

---- (Without 'INCDIR = /usr/include') -----------------------------

$ make
psp-gcc -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -O0 -G0 -Wall -g -c -
o main.o main.c
main.c:24:24: error: netinet/in.h: No such file or directory
main.c:25:23: error: arpa/inet.h: No such file or directory
main.c:26:24: error: sys/select.h: No such file or directory
main.c:72: error: syntax error before 'port'
main.c: In function 'make_socket':
main.c:76: error: storage size of 'name' isn't known
main.c:78: warning: implicit declaration of function 'socket'
main.c:78: error: 'PF_INET' undeclared (first use in this function)
main.c:78: error: (Each undeclared identifier is reported only once
main.c:78: error: for each function it appears in.)
main.c:78: error: 'SOCK_STREAM' undeclared (first use in this function)
main.c:84: error: 'AF_INET' undeclared (first use in this function)
main.c:85: warning: implicit declaration of function 'htons'
main.c:85: error: 'port' undeclared (first use in this function)
main.c:86: warning: implicit declaration of function 'htonl'
main.c:86: error: 'INADDR_ANY' undeclared (first use in this function)
main.c:87: warning: implicit declaration of function 'bind'
main.c:76: warning: unused variable 'name'
main.c: In function 'start_server':
main.c:102: error: storage size of 'client' isn't known
main.c:117: warning: implicit declaration of function 'listen'
main.c:134: warning: implicit declaration of function 'select'
main.c:147: error: 'SOCKET_FD_PAT' undeclared (first use in this function)
main.c:150: warning: implicit declaration of function 'accept'
main.c:159: warning: implicit declaration of function 'inet_ntoa'
main.c:160: warning: implicit declaration of function 'ntohs'
main.c:160: warning: format '%s' expects type 'char *', but argument 3 has type
'int'
main.c:102: warning: unused variable 'client'
make: *** [main.o] Error 1

---- (With 'INCDIR = /usr/include') -----------------------------

$ make
psp-gcc -I/usr/include/ -I. -IC:/cygwin/usr/local/pspdev/psp/sdk/include -O0 -G0
-Wall -g -c -o main.o main.c
main.c: In function 'make_socket':
main.c:78: warning: implicit declaration of function 'socket'
main.c:78: error: 'PF_INET' undeclared (first use in this function)
main.c:78: error: (Each undeclared identifier is reported only once
main.c:78: error: for each function it appears in.)
main.c:78: error: 'SOCK_STREAM' undeclared (first use in this function)
main.c:84: error: 'AF_INET' undeclared (first use in this function)
main.c:87: warning: implicit declaration of function 'bind'
main.c: In function 'start_server':
main.c:117: warning: implicit declaration of function 'listen'
main.c:147: error: 'SOCKET_FD_PAT' undeclared (first use in this function)
main.c:150: warning: implicit declaration of function 'accept'
make: *** [main.o] Error 1

----

Can someone please tell me I'm doing something stupid, so I can get past this one hurdle?

Cheers!
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

This is because you do not have the latest version of newlib built and installed. The BSD sockets network includes are part of newlib and not pspsdk so that is why you are getting the errors.
cakestick
Posts: 6
Joined: Sun Jan 22, 2006 2:49 pm

Post by cakestick »

:-D Thank you, this is something I couldn't have dug up in 5 Sunday mornings, haha..

Is newlib a module that can be pulled down in cygwin setup, or do I have to get it from somewhere else?
cakestick
Posts: 6
Joined: Sun Jan 22, 2006 2:49 pm

Post by cakestick »

Nevermind, I put myself on the right track with svn checkout - only reply if I'm completely off-base.

Thank you!
Post Reply