工作了,以前只停留在pad里的书都想入手。手里有了unix网络编程卷1卷2,最近看ceph源码的过程中,越来越发现需要补充unix环境高级编程的知识。
从pad中走向了实体书。中午快递到货,迫不及待的翻开了。第一件事,安装
#include"apue.h"
1.官网下载
2.解压make
安装点依赖gcc make啥的
一make,果然报错,人生啊总是要走很多“弯”路。
/tmp/ccMkguDl.o: In function `thr_fn':
barrier.c:(.text+0x80): undefined reference to `heapsort'
collect2: error: ld returned 1 exit status
make[1]: *** [barrier] Error 1
make[1]: Leaving directory `/root/apue.3e/threads'
make: *** [all] Error 1
[root@localhost apue.3e]# yum update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* epel: mirror.lzu.edu.cn
* extras: mirrors.shu.edu.cn
* updates: mirrors.cn99.com
No packages marked for update
在这里缺少一个libbsd
下载
wget http://elrepo.reloumirrors.net/testing/el6/x86_64/RPMS/libbsd-devel-0.2.0-4.el6.elrepo.x86_64.rpm
wget http://elrepo.reloumirrors.net/testing/el6/x86_64/RPMS/libbsd-0.2.0-4.el6.elrepo.x86_64.rpm
安装
rpm -ivh libbsd-0.2.0-4.el6.elrepo.x86_64.rpm
rpm -ivh libbsd-devel-0.2.0-4.el6.elrepo.x86_64.rpm
3.重新make
成功
4.加入include
将apue.h中加入#include”error.c”
void log_exit(int, const char *, ...) __attribute__((noreturn));
void TELL_WAIT(void); /* parent/child from {Sec race_conditions} */
void TELL_PARENT(pid_t);
void TELL_CHILD(pid_t);
void WAIT_PARENT(void);
void WAIT_CHILD(void);
#include"error.c"
#endif /* _APUE_H */
cp include/apue.h lib/error.c /usr/include/