在Linux环境下配置《UNIX网络编程的环境》

  1. 下载必要文件:http://www.unpbook.com/src.html
    在上面给出的网站下载需要的压缩包。
    在Linux环境下配置《UNIX网络编程的环境》
  2.  找到合适的目录安放压缩包,建议建立良好的文件管理系统,方便日后找起来方便一些。
    [[email protected] workspace]# ls
    UnixNetworkPrograming OtherDir
    [[email protected] workspace]# cd UnixNetworkPrograming/
    [[email protected] UnixNetworkPrograming]# ls
    unpv13e.tar.gz
    

     
  3. 解压压缩包:
    [[email protected] UnixNetworkPrograming]# tar -zxvf unpv13e.tar.gz
  4. 进入解压出来的文件夹
    [[email protected] UnixNetworkPrograming]# ls
    unpv13e  unpv13e.tar.gz
    [[email protected] UnixNetworkPrograming]# cd unpv13e/
    
  5. 根据README文件进行源码包编译安装
    [[email protected] unpv13e]# head README -n26
    QUICK AND DIRTY
    ===============
    
    Execute the following from the src/ directory:
    
        ./configure    # try to figure out all implementation differences
    
        cd lib         # build the basic library that all programs need
        make           # use "gmake" everywhere on BSD/OS systems
    
        cd ../libfree  # continue building the basic library
        make
    
        cd ../libroute # only if your system supports 4.4BSD style routing sockets
        make           # only if your system supports 4.4BSD style routing sockets
    
        cd ../libxti   # only if your system supports XTI
        make           # only if your system supports XTI
    
        cd ../intro    # build and test a basic client program
        make daytimetcpcli
        ./daytimetcpcli 127.0.0.1
    
    If all that works, you're all set to start compiling individual programs.
    
    Notice that all the source code assumes tabs every 4 columns, not 8.
    
  6. 将生成的libunp.a静态库复制到/usr/lib/ 和 /usr/lib64/中
    [[email protected] unpv13e]# cp libunp.a /usr/lib
    
  7. 将lib/unp.h中的   #include "../config.h"修改为 #include "config.h"
    并且将   cp lib/unp.h /usr/include   cp config.h /usr/include







    全部完成