Question:
unp.h for Socket Networking API : Unix Network Programming?
Arun
2012-01-08 03:54:47 UTC
PLEASE HELP: I Just started reading the book Unix Network programming : The Socket Networking API (by Richard Stevens). if anyone can tell me what to do with the unpv12ep-0.2.tar.gz file that I downloaded from www.kegel.com so that it does not give me errors, I'd be thrilled. I use Linux (Ubuntu 11.10), I have already installed autoconfig and I've run ./config on the unpacked unpv12ep-0.2. There are a couple of patch files but I have no idea how to use them.

Besides below are the errors that I get in terminal

arun@arun:~/Templates/unpv12e$ cd lib
arun@arun:~/Templates/unpv12e/lib$ make
gcc -g -O2 -D_REENTRANT -Wall -c -o connect_nonb.o connect_nonb.c
In file included from connect_nonb.c:1:0:
unp.h:114:8: error: redefinition of ‘struct in_pktinfo’
/usr/include/i386-linux-gnu/bits/in.h:113:8: note: originally defined here
make: *** [connect_nonb.o] Error 1


arun@arun:~/Templates/unpv12e/libfree$ cd ../libgai
arun@arun:~/Templates/unpv12e/libgai$ make
gcc -g -O2 -D_REENTRANT -Wall -c -o getaddrinfo.o getaddrinfo.c
In file included from gai_hdr.h:1:0,
from getaddrinfo.c:2:
unp.h:114:8: error: redefinition of ‘struct in_pktinfo’
/usr/include/i386-linux-gnu/bits/in.h:113:8: note: originally defined here
getaddrinfo.c: In function ‘getaddrinfo’:
getaddrinfo.c:58:6: error: ‘EAI_ADDRFAMILY’ undeclared (first use in this function)
getaddrinfo.c:58:6: note: each undeclared identifier is reported only once for each function it appears in
getaddrinfo.c:116:21: error: ‘EAI_NODATA’ undeclared (first use in this function)
make: *** [getaddrinfo.o] Error 1


arun@arun:~/Templates/unpv12e/libgai$ cd ../libroute
arun@arun:~/Templates/unpv12e/libroute$ make
gcc -g -O2 -D_REENTRANT -Wall -c -o get_rtaddrs.o get_rtaddrs.c
In file included from unproute.h:1:0,
from get_rtaddrs.c:1:
unp.h:114:8: error: redefinition of ‘struct in_pktinfo’
/usr/include/i386-linux-gnu/bits/in.h:113:8: note: originally defined here
In file included from get_rtaddrs.c:1:0:
unproute.h:3:45: fatal error: net/if_dl.h: No such file or directory
compilation terminated.
make: *** [get_rtaddrs.o] Error 1


arun@arun:~/Templates/unpv12e/libroute$ cd ../libxti
arun@arun:~/Templates/unpv12e/libxti$ make
gcc -g -O2 -D_REENTRANT -Wall -c -o wrapxti.o wrapxti.c
In file included from unpxti.h:5:0,
from wrapxti.c:5:
unp.h:114:8: error: redefinition of ‘struct in_pktinfo’
/usr/include/i386-linux-gnu/bits/in.h:113:8: note: originally defined here
In file included from wrapxti.c:5:0:
unpxti.h:7:17: fatal error: xti.h: No such file or directory
compilation terminated.
make: *** [wrapxti.o] Error 1


arun@arun:~/Templates/unpv12e/libxti$ make
gcc -g -O2 -D_REENTRANT -Wall -c -o wrapxti.o wrapxti.c
In file included from unpxti.h:5:0,
from wrapxti.c:5:
unp.h:114:8: error: redefinition of ‘struct in_pktinfo’
/usr/include/i386-linux-gnu/bits/in.h:113:8: note: originally defined here
In file included from wrapxti.c:5:0:
unpxti.h:7:17: fatal error: xti.h: No such file or directory
compilation terminated.
make: *** [wrapxti.o] Error 1


arun@arun:~/Templates/unpv12e/libxti$ cd ../intro
arun@arun:~/Templates/unpv12e/intro$ make daytimetcpcli
gcc -g -O2 -D_REENTRANT -Wall -c -o daytimetcpcli.o daytimetcpcli.c
In file included from daytimetcpcli.c:1:0:
unp.h:114:8: error: redefinition of ‘struct in_pktinfo’
/usr/include/i386-linux-gnu/bits/in.h:113:8: note: originally defined here
make: *** [daytimetcpcli.o] Error 1

Apart from that is there any other simpler method that I can use so that I can run the programms in the book?
Three answers:
2012-01-08 05:41:19 UTC
Type "patch -p# < patch_file" in the directory that you want to patch, where # is the directory level to apply the patch to (usually 0 or 1).
Lori
2016-03-16 13:57:53 UTC
Perhaps if you have a specific question, we could be more helpful. I'm sure you will find c to be a very powerful programming language for both application and network programming. Have a nice Day!
Kevin Lain
2012-01-08 04:45:31 UTC
I don't know about the specific thing your trying to compile but some advice about make



Do "make" in the same directory that you did "./configure"



You usually need to run make as root so try "sudo make" or "su" then "make"


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...