博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
UNIX高级环境编程:源码(apue)下载 编译和运行
阅读量:4213 次
发布时间:2019-05-26

本文共 2257 字,大约阅读时间需要 7 分钟。

整体上和unpv差不多,参见我的另一篇博文

1.源码下载

最简单的方式:(wget工具实在太好用)

wget http://www.apuebook.com/src.3e.tar.gz

2.解压查看目录结构

sunxiaowu@sunxiaowu:~/Downloads/apue/apue.3e$ diradvio       figlinks  lib                   printer   standardsdaemons     filedir   Make.defines.freebsd  proc      stdiodatafiles   fileio    Make.defines.linux    pty       systype.shdb          include   Make.defines.macos    README    termiosDISCLAIMER  intro     Make.defines.solaris  relation  threadctlenviron     ipc1      Makefile              signals   threadsexercises   ipc2      Make.libapue.inc      sockets
vim README

Read the file called DISCLAIMER.On Freebsd, type "gmake".On other platforms, type "make" (as long as this is gnu make).For FAQs, updated source code, and the lost chapter, see http://www.apuebook.com.Please direct questions, suggestions, and bug reports to sar@apuebook.com.Steve RagoJanuary 2013

3.编译

make

timeout.c:119:5: warning: ‘condition’ may be used uninitialized in this function [-Wmaybe-uninitialized]  if (condition) {     ^timeout.c:125:34: warning: ‘arg’ may be used uninitialized in this function [-Wmaybe-uninitialized]   timeout(&when, retry, (void *)((unsigned long)arg));                                  ^make[1]: Leaving directory `/home/sunxiaowu/Downloads/apue/apue.3e/threadctl'making threadsmake[1]: Entering directory `/home/sunxiaowu/Downloads/apue/apue.3e/threads'gcc -ansi -I../include -Wall -DLINUX -D_GNU_SOURCE  badexit2.c -o badexit2  -L../lib -lapue -pthread -lrt -lbsd/usr/bin/ld: cannot find -lbsdcollect2: error: ld returned 1 exit statusmake[1]: *** [badexit2] Error 1make[1]: Leaving directory `/home/sunxiaowu/Downloads/apue/apue.3e/threads'make: *** [all] Error 1
大部分编译通过,但最后出现以上错误,可以看出threads模块下的badexit2.c文件编译失败。原因是操作系统的限制,我的使用ubunu14.04,要想编译这个文件,需要在bsd下(还有些模块编译不通过,大部分都是这个原因,有兴趣的读者可以在其他操作系统下试试)

4.运行

sunxiaowu@sunxiaowu:~/Downloads/apue/apue.3e$ cd intro/sunxiaowu@sunxiaowu:~/Downloads/apue/apue.3e/intro$ dirgetcputc    hello.c  Makefile  shell1    shell2.c     uidgidgetcputc.c  ls1      mycat     shell1.c  testerror    uidgid.chello       ls1.c    mycat.c   shell2    testerror.csunxiaowu@sunxiaowu:~/Downloads/apue/apue.3e/intro$ ./hello hello world from process ID 9793sunxiaowu@sunxiaowu:~/Downloads/apue/apue.3e/intro$

转载地址:http://gjumi.baihongyu.com/

你可能感兴趣的文章
写给分布式神器Fourinone
查看>>
讨论一下淘宝的Fourinone
查看>>
写给高性能数据库引擎coolhash
查看>>
写给《数据库引擎 CoolHash 性能测试报告》
查看>>
java中的mmap实现
查看>>
Redis的Aof被阻塞原因调查
查看>>
Redis Cluster的FailOver失败案例分析
查看>>
Android Alarm驱动源代码分析(Alarm.c)
查看>>
Android震动vibrator(马达)--系统到驱动的流程
查看>>
针对高通平台的驱动开发CSDN博客
查看>>
LCD和键盘背光亮度---系统到驱动的流程和设置
查看>>
Android Camera架构浅析
查看>>
Android display架构分析
查看>>
S3C2440上LCD驱动 (FrameBuffer)实例开发讲解
查看>>
Linux音频编程指南
查看>>
针对windows编程-linux驱动编程-usb编程的号文章--推荐
查看>>
USB OTG的工作原理-相互切换和交互流程
查看>>
usb-otg-调试心得
查看>>
嵌入式开发指导博客-刘洪涛
查看>>
Linux启动流程-bootloader至kernel的过程--android系统启动流程
查看>>