编译
1、根目录
cd unpv13e
./configure
*2、lib 目录
cd lib && make
3、libfree 目录
cd ../libfree && make 在 Mac OSX 下可能会出现以下错误
gcc -I../lib -g -O2 -D_REENTRANT -Wall -c -o in_cksum.o in_cksum.c
gcc -I../lib -g -O2 -D_REENTRANT -Wall -c -o inet_ntop.o inet_ntop.c
inet_ntop.c:56:1: error: conflicting types for 'inet_ntop'
inet_ntop(af, src, dst, size)
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/arpa/inet.h:77:13: note:
previous declaration is here
const char *inet_ntop(int, const void *, char *, socklen_t);
^
1 error generated.
make: *** [inet_ntop.o] Error 1
解决:打开 inet_ntop.c 文件第 60 行 size_t 改为 socklen_t
再重新执行:make,以下是执行结果
gcc -I../lib -g -O2 -D_REENTRANT -Wall -c -o inet_ntop.o inet_ntop.c
ar rv ../libunp.a in_cksum.o inet_ntop.o inet_pton.o
r - in_cksum.o
r - inet_ntop.o
r - inet_pton.o
ranlib ../libunp.a
4、libroute 目录
cd ../libroute && make
**5、intro 目录测试 daytimetcpcli **
cd ../intro
make daytimetcpcli
./daytimetcpcli 127.0.0.1