1. 编译原书所带例子:
unpv22e.tar.gz 下载地址: http://www.k ohala.com/st art/unpv22e/ unpv22e.tar. gz
2. 解压:
$tar -zxvf unpv22e.tar.gz
3. 编译:
$cd unpv22e
$ ./configure
$ cd lib
$ make
gcc -g -O2 -D_REENTRANT -Wall -D_POSIX_PTHREAD_SEMANTICS -c -odaemon_inetd.o daemon_inetd.c
In file included from /usr/include/netinet/in.h:23,
from /usr/include/rpc/types.h:90,
from /usr/include/rpc/rpc.h:41,
from unpipc.h:115,
from daemon_inetd.c:1:
/usr/include/stdint.h:49: 错误:重复的 'unsigned'
/usr/include/stdint.h:49: 错误:声明指定了两个以上的数据类型
/usr/include/stdint.h:50: 错误:重复的 'unsigned'
/usr/include/stdint.h:50: 错误:重复的 'short'
/usr/include/stdint.h:52: 错误:重复的 'unsigned'
/usr/include/stdint.h:52: 错误:声明指定了两个以上的数据类型
make: *** [daemon_inetd.o] 错误 1
修改unpipc.h第115行。unpipc.h中把115内容注释掉。再次编译。
$ make
gcc -g -O2 -D_REENTRANT -Wall -D_POSIX_PTHREAD_SEMANTICS -c -odaemon_inetd.o daemon_inetd.c
In file included from daemon_inetd.c:1:
unpipc.h:479: 错误:expected '=', ',', ';', 'asm' or '__attribute__'before '*' token
unpipc.h:480: 错误:expected ')' before '*' token
make: *** [daemon_inetd.o] 错误 1
把unpipc.h中第479,480行注释掉。再次编译。
$ make
...
gcc -g -O2 -D_REENTRANT -Wall -D_POSIX_PTHREAD_SEMANTICS -c -owrapsunrpc.o wrapsunrpc.c
wrapsunrpc.c:3: 错误:expected '=', ',', ';', 'asm' or'__attribute__' before '*' token
wrapsunrpc.c:16: 错误:expected ')' before '*' token
make: *** [wrapsunrpc.o] 错误 1
修改unpv22e/Make.defines中的LIB_OBJS的".o"文件,删除"wrapsunrpc.o"。
再次编译。
$ make
unpv22e.tar.gz 下载地址: http://www.k
2. 解压:
$tar -zxvf unpv22e.tar.gz
3. 编译:
$cd unpv22e
$ ./configure
$ cd lib
$ make
gcc -g -O2 -D_REENTRANT -Wall -D_POSIX_PTHREAD_SEMANTICS -c -odaemon_inetd.o daemon_inetd.c
In file included from /usr/include/netinet/in.h:23,
from /usr/include/rpc/types.h:90,
from /usr/include/rpc/rpc.h:41,
from unpipc.h:115,
from daemon_inetd.c:1:
/usr/include/stdint.h:49: 错误:重复的 'unsigned'
/usr/include/stdint.h:49: 错误:声明指定了两个以上的数据类型
/usr/include/stdint.h:50: 错误:重复的 'unsigned'
/usr/include/stdint.h:50: 错误:重复的 'short'
/usr/include/stdint.h:52: 错误:重复的 'unsigned'
/usr/include/stdint.h:52: 错误:声明指定了两个以上的数据类型
make: *** [daemon_inetd.o] 错误 1
修改unpipc.h第115行。unpipc.h中把115内容注释掉。再次编译。
$ make
gcc -g -O2 -D_REENTRANT -Wall -D_POSIX_PTHREAD_SEMANTICS -c -odaemon_inetd.o daemon_inetd.c
In file included from daemon_inetd.c:1:
unpipc.h:479: 错误:expected '=', ',', ';', 'asm' or '__attribute__'before '*' token
unpipc.h:480: 错误:expected ')' before '*' token
make: *** [daemon_inetd.o] 错误 1
把unpipc.h中第479,480行注释掉。再次编译。
$ make
...
gcc -g -O2 -D_REENTRANT -Wall -D_POSIX_PTHREAD_SEMANTICS -c -owrapsunrpc.o wrapsunrpc.c
wrapsunrpc.c:3: 错误:expected '=', ',', ';', 'asm' or'__attribute__' before '*' token
wrapsunrpc.c:16: 错误:expected ')' before '*' token
make: *** [wrapsunrpc.o] 错误 1
修改unpv22e/Make.defines中的LIB_OBJS的".o"文件,删除"wrapsunrpc.o"。
再次编译。
$ make
--这次应该没有问题了。
将config.h和pipe目录下的unpipc.h 复制到 /usr/include/ 下面 ,并修改unpipc.h 下面的#include "../config.h" 为 #include “config.h”
由于confg.h和unp1的config.h有些不一样,所以把两个config.h分别修改为unpconfig.h和unpipcconfig.h。
同时unp.h和unpipc.h中包含的头 文件也要修改。
再将libunp.a和libunpipc.a拷到/usr/lib中。
这样在练习的时候可以直接-lunp或-lunpipc -lrt 来编译。