源码下载地点:

http://www.kohala.com/start/unpv22e/unpv22e.html

按照README中的操作,先configure,然后进入lib目录下make报错

gcc -g -O2 -D_REENTRANT -Wall -D_POSIX_PTHREAD_SEMANTICS   -c -o daemon_inetd.o daemon_inetd.cIn file included from /usr/include/netinet/in.h:24,                 from /usr/include/rpc/types.h:91,                 from /usr/include/rpc/rpc.h:38,                 from unpipc.h:115,                 from daemon_inetd.c:1:/usr/include/stdint.h:49: error: duplicate ‘unsigned’/usr/include/stdint.h:49: error: two or more data types in declaration specifiers/usr/include/stdint.h:50: error: duplicate ‘unsigned’/usr/include/stdint.h:50: error: duplicate ‘short’/usr/include/stdint.h:52: error: duplicate ‘unsigned’/usr/include/stdint.h:52: error: two or more data types in declaration specifiersmake: *** [daemon_inetd.o] Error 1

解决方法

vim ../config.h

注释掉,再make

//#define uint8_t unsigned char               /* <sys/types.h> */

//#define uint16_t unsigned short             /* <sys/types.h> */

//#define uint32_t unsigned int               /* <sys/types.h> */

cd ../pipe

make pipeconf

出现链接警告。

gcc -g -O2 -D_REENTRANT -Wall   -c -o pipeconf.o pipeconf.cgcc -g -O2 -D_REENTRANT -Wall -o pipeconf pipeconf.o ../libunpipc.a -lrt -lpthread ../libunpipc.a(wrapunix.o): In function `Mktemp':/home/cherish/virtual/unpv22e/lib/wrapunix.c:184: warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'

mktemp是私有实现,修改为mkstemp就好了。

vim ../wrapunix.c

 //if (mktemp(template) == NULL || template[0] == 0)   if (mkstemp(template) == -1 || template[0] == 0)                       err_quit("mktemp error");                         

再次make,警告消失。

编译svmsg目录下的源码

ctl.c:10: error: ‘MSG_R’ undeclared (first use in this function)
……
ctl.c:10: error: ‘MSG_W’ undeclared (first use in this function)
ctl.c:18: error: ‘ulong_t’ undeclared (first use in this function)

在config.h中添加

#define typedef unsigned long ulong_t;#define MSG_R 0400#define MSG_W 0200

再次编译,出现

gcc -g -O2 -D_REENTRANT -Wall -I ../lib -c -o ctl.o ctl.c
ctl.c: In function ‘main’:
ctl.c:8: error: storage size of ‘buf’ isn’t known
ctl.c:8: warning: unused variable ‘buf’
make: *** [ctl.o] Error 1

参考http://bbs.unixbeta.com/viewthread.php?tid=48666
不能用#define __USE_GNU
而应该是:
#define _GNU_SOURCE
__USE_GNU是双划线。
在config.h中添加

#define _GNU_SOURCE

编译消息

mq_open老是失败。由于程序截取了错误码,无法定位。

查资料才发现,可能mq_open失败的错误码: EINVAL,错误信息:Invalid argument

帮助文档的解释如下:

View Code

EINVAL O_CREAT was specified in oflag, and attr was not NULL, butattr->mq_maxmsg or attr->mq_msqsize was invalid. Both of thesefields must be greater than zero. In a process that is unprivi‐leged (does not have the CAP_SYS_RESOURCE capability),attr->mq_maxmsg must be less than or equal to the msg_max limit,and attr->mq_msgsize must be less than or equal to the msg‐size_max limit. In addition, even in a privileged process,attr->mq_maxmsg cannot exceed the HARD_MAX limit. (See mq_over‐view(7) for details of these limits.)

于是查看,发现

cherish@Ares:~/virtual/unpv22e/pxmsg$ cat /proc/sys/fs/mqueue/msg_max
10
cherish@Ares:~/virtual/unpv22e/pxmsg$ cat /proc/sys/fs/mqueue/msgsize_max
8192

原来是自己输入的msg_max 超过了10.

转载于:https://www.cnblogs.com/westfly/archive/2011/07/28/2109179.html

UNP(2rd)第二卷源码编译相关推荐

  1. APUE第二版源码编译问题解决

    作为C/C++程序员肯定都知道APUE-<Unix环境高级编程>这本书.笔者在互联网上找了个遍 ,准备下个中文第三版,居然没有下载到 全TMD是第二版 冒充第三版,真气人.第二版就第二版呗 ...

  2. Docker源码编译(二)

    这是根据自己项目修改而记录的过程,对他人不具有参考性 一.按照以下教程,搭建docker编译环境:Docker源码编译和开发环境搭建 二.由于我对docker源码的修改导入了mysql数据库的包,如下 ...

  3. CentOS 7 源码编译MariaDB 5.5.46

    预备知识:     MySQL/MariaDB的源码编译需要借助于:cmake:     cmake的重要特性之一是其独立于源码(out-of-source)的编译功能,即编译工作可以在另一个指定的目 ...

  4. nginx源码编译、负载均衡及模块的扩展

    1.nginx源码编译 实验环境: iptables和selinux关闭 redhat6.5 nginx:test1: 172.25.1.11 [root@test1 ~]# ls nginx-1.1 ...

  5. LNMP架构详解(2)——Mysql、PHP、Nginx源码编译过程

    前言 本文将介绍LNMP架构中Mysql.PHP.Nginx的源码编译过程:这时有人不仅会问:在我们使用的Linux系统中,可以从yum源中获得mysql.php,为什么要进行如此漫长复杂的过程进行编 ...

  6. linux7安装haproxy,Centos7 源码编译安装haproxy

    Centos7 源码编译安装haproxy 操作环境: 一台haproxy主机地址为:192.168.80.100 两台web服务器地址分别为:192.168.80.102 192.168.80.10 ...

  7. 详解LAMP源码编译安装

    实战:LAMP源码编译安装 家住海边喜欢浪:zhang789.blog.51cto.com 目录 详解LAMP源码编译安装 LAMP简介 一.准备工作 二.编译安装 Apache 三.编译安装 MyS ...

  8. Android4.4源码编译(Ubuntu1204/1404)

    好久没写博客了,最近折腾了一个周,总算把Android4.4系统源码编译通过,有网上的大神们在,其实也不难. 效果图 一.介绍 我的电脑配置不咋滴(i3+4G+320),分了90个G来装了个Ubunt ...

  9. 源码 linux下编译_Linux云服务器软硬链接及源码编译安装python3.8的一些备注

    推荐一个简书作者写的从零开始学习Linux,非常细,授人以鱼不如授人以渔. https://www.jianshu.com/p/54c0e6a1da99 正文:看一下服务器的版本 cat /proc/ ...

  10. Tomcat8源码编译及导入Eclipse中研究

    最近因为需求需要修改Tomcat中的某些功能,无奈只能研究那部分源码然后稍作修改. 目前Tomcat最新版是8.0,下载了源码包,编译并导入Eclipse中研究比较方便. 1. Tomcat8源码编译 ...

最新文章

  1. 关于Installshield里一些常见问题的解答—艾泽拉斯之海洋女神出品
  2. LUOGU P4195 Spoj3105 Mod
  3. C#中RichTextBox文本居中显示
  4. 254. Factor Combinations
  5. 前端学习(2790):封装商品组件并且使用
  6. cdh mysql sqoop 驱动_大数据技术之Sqoop学习——原理、安装、使用案例、常用命令...
  7. 分享 | 开源的中文语音识别系统
  8. Nginx配置二级域名来实现多个站点
  9. git 从远程仓库指定分支clone代码到本地
  10. CTF杂项题解题思路与方法
  11. webview android 加载网页,关于webview:如何在android中离线加载网页
  12. 结构力学支座位移与温度荷载、力法与矩阵位移法、图乘法核心思想
  13. 区块链基本概念和名词解释
  14. 第四届橙瓜网络文学奖《元尊》的排行竟然比《剑来》低?
  15. (转)DCB文件格式解析
  16. 15款最好用的腾讯短链接(url.cn接口)批量在线生成接口
  17. 游戏《孢子》的思考 —— Ear Clipping算法
  18. teraterm 执行sql命令_tera term的ttl脚本使用方法
  19. python1到20数字阶乘_Python 程序求数字的阶乘
  20. 实验五、任意N进制异步计数器设计

热门文章

  1. Spark sql数据倾斜优化的一个演示案例
  2. spring+hibernate中clob、blob字段的处理方法
  3. 三种新型DDoS反射攻击出现
  4. 《Producter:让产品从0到1》一导读
  5. 如何使用虚拟实验室建设思科IPS***防御课程的实验环境
  6. 关于ASP.NET 将数据导出成Excel 的总结[下]
  7. 常见的简单的无监督学习算法总结
  8. 冲刺一团队五亲亲精英队
  9. django组件-cookie与session
  10. Python基础之字典