Unix NetWork Programming -- 环境搭建(Ubuntu 12.04 x86_64)
1. 下载源代码:http://www.ituring.com.cn/book/download/60498ad9-ede6-4023-a92b-04d47be23578
2. 解压文件后进入文件根目录并运行以下命令:
$ autoconf
$ ./configure
3. 进入lib目录并且make
4. 进入libfree目录并且make
在该目录运行时出现错误,错误代码如下:
gcc -I../lib -g -O2 -D_REENTRANT -Wall -c -o inet_ntop.o inet_ntop.c
inet_ntop.c: In function ‘inet_ntop’:
inet_ntop.c::: error: argument ‘size’ doesn’t match prototype
/usr/include/arpa/inet.h::: error: prototype declaration
make: *** [inet_ntop.o] Error
经过查询inet_ntop.c 和 inet.h 文件发现在头文件中inet_ntop的原型声明与inet_ntop.c中的该函数实现原型的第三个参数类型不一致
inet.h 和 inet_ntop.c中的函数原型如下:
//inet.h
__const char *inet_ntop (int __af, __const void *__restrict __cp, char *__restrict __buf, socklen_t __len) __THROW;
//inet_ntop.c
const char *
inet_ntop(int af, const void *src, char *dst, size_t size);
其中第三个参数类型分别为socklen_t和size_t,解决方案为在inet_ntop.c中加入以下代码:
#define size_t socklen_t
5. 编译完成后将编译输出的libunp.a拷贝到库文件目录(/usr/lib 和 /usr/lib64)中去:
sudo cp libunp.a /usr/lib
sudo cp libunp.a /usr/lib64
6. 修改头文件unp.h和config.h拷贝到头文件目录中去(/usr/include)
gedit lib/unp.h //将unp.h中#include "../config.h"修改为#include "config.h"
sudo cp lib/unp.h /usr/include
sudo cp config.h /usr/include
7. 编译测试源代码
cd ./intro
gcc daytimetcpcli.c -o daytimetcpcli -lunp
gcc daytimetcpsrv.c -o daytimetcpsrv -lunp
Unix NetWork Programming -- 环境搭建(Ubuntu 12.04 x86_64)的更多相关文章
- Angularjs学习---angularjs环境搭建,ubuntu 12.04下安装nodejs、npm和karma
1.下载angularjs 进入其官网下载:https://angularjs.org/,建议下载最新版的:https://ajax.googleapis.com/ajax/libs/angular ...
- 【转】Unix NetWork Programming——环境搭建(解决unp.h等源码编译问题)
下面开始用简单但典型的客户端和服务器端程序说明如何进行网络编程.这一小节讲的是客户端,一个用来连接并读取服务器发送来的时间的客户端. 这里涉及到了编写代码,因此要 搭建unix网络编程环境 unix系 ...
- Hadoop伪分布式环境搭建+Ubuntu:16.04+hadoop-2.6.0
Hello,大家好 !下面就让我带大家一起来搭建hadoop伪分布式的环境吧!不足的地方请大家多交流.谢谢大家的支持 准备环境: 1, ubuntu系统,(我在16.04测试通过.其他版本请自行测试, ...
- 阿里云ECS服务器环境搭建 ubuntu 16.04 图形界面的安装
https://blog.csdn.net/zwq912318834/article/details/80528374
- ubuntu 12.04 x86_64:java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons
sy@sy-Aspire-:~$ .0_155965261/configuration/.log !SESSION -- ::39.595 ------------------------------ ...
- Nvidia CUDA 6 Installed In Ubuntu 12.04
环境:ubuntu 12.04 (x64) 如果不能够 service lightdm stop,显示:unknown service 或者其他的 sudo /etc/init.d/lightdm r ...
- 鸟哥的私房菜上 xpenguins 设备(ubuntu 12.04)
看了一个暑假linux,我觉得很辛苦啊,要很好地利用linux并不是的easy... 今天装了一下鸟哥课后给的xpenguins软件,就是桌面特性软件.会有非常多企鹅下落,本以为能够非常轻松的搞定.没 ...
- 【菜鸟学习Linux】-第三章- Linux环境搭建-使用VMware9安装Ubuntu 12.04系统
上一步,我们安装了VMware9虚拟机,现在我们就是用它来安装Ubuntu12.04系统,至于Ubuntu是什么,我就不废话了,大家google一下,比我讲的清楚,好了,开始干活! Ubuntu官网下 ...
- Ubuntu 12.04搭建MTK 6577 安卓开发环境
Ubuntu 12.04搭建 MTK 6577安卓开发环境 1. 下载并安装Vmware虚拟机: 2. 下载并在虚拟机上安装Ubuntu 12.04 iso 安装包:下载地址: ...
随机推荐
- struct和typedef struct
转自:http://www.cnblogs.com/qyaizs/articles/2039101.html struct和typedef struct 分三块来讲述: 1 首先://注意在C和C++ ...
- iOS开发资料链接
ios开发中文文档了 http://developer.apple.com/library/ios/#referencelibrary/GettingStarted/RoadMapiOSCh/chap ...
- Boost练习程序(multi_index_container)
代码来自:http://blog.csdn.net/whuqin/article/details/8482547 该容器能实现多列索引,挺好. #include <string> #inc ...
- Understanding Kafka Consumer Groups and Consumer Lag
In this post, we will dive into the consumer side of this application ecosystem, which means looking ...
- JQ学习(一)
通过 jQuery,您可以选取(查询,query) HTML 元素,并对它们执行“操作”(actions). jQuery 语法 jQuery 语法是为 HTML 元素的选取编制的,可以对元素执行某些 ...
- TweenMax参数补充
构造函数:TweenMax(target:Object, duration:Number, vars:Object) target:Object -- 需要缓动的对象 duration:Number ...
- hdu5119 dp
题目链接: http://acm.split.hdu.edu.cn/showproblem.php?pid=5119 题意: 输入T组数据,每组数据包括两个数n和m,接下来n个数,这n个数可以随意取( ...
- loopback 02
数据库连接操作,以mongodb为例 安装loopback-connector-mongodb 修改datasources.json //例子 { "db": { "na ...
- John the Ripper
John the RipperJohn the Ripper(简称John)是一款著名的密码破解工具.它主要针对各种Hash加密的密文.它不同于Rainbow Table方式.它采用实时运算的方式和密 ...
- Git 使用命令
$ git add . $ git commit -m "html files created 20160308 16:08" $ git push origin master 设 ...